| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
| |
Two benefits: (1) less code. (2) finding subtle bugs about
parameter dependent method types. By merging with PolyTypes
we are forced to take parameter dependencies into account.
|
| |
|
| |
|
|
|
|
|
| |
- Use TypeLambda instead of PolyType.
- Further harmonize factory operations
|
| |
|
|
|
|
|
|
| |
MethodTypes have paramTypes whereas PolyTypes have paramBounds.
We now harmonize by alling both paramInfos, and parameterizing
types that will become common to both.
|
|
|
|
|
| |
and generalize MethodParam to ParamRef, and
TypeParamInfo to ParamInfo
|
|
|
|
|
|
|
|
|
|
| |
This leads to a slight overall simplification, harmonizes pickle
format with internal representation, and makes MethodTypes and
PolyTypes more similar to each other.
I believe the change is useful as it is, but in particular it is
a useful step for an eventual unification of MethodTypes and
PolyTypes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this commit, the added testcase failed because the type of `inv`
was inferred to be `Inv[Any]` instead of `Inv[Int]`. The situation looks
like this:
def inv(cond: Boolean) =
if (cond)
new Inv(1) // : Inv[A] where A >: Int
else
Inv.empty // : Inv[A'] where A' unconstrained
// : Inv[A] | Inv[A']
To get the type of `inv`, we call `harmonizeUnion` which will take the
lub of `Inv[A]` and `Inv[A']`, eventually this mean that we do:
A' <:< A
But since `harmonizeUnion` uses `fluidly`, this does not result in `A'`
getting constrained to be a subtype of `A`, instead we constrain `A` to
the upper bound of `A'`:
Any <:< A
We use `fluidly` to avoid creating OrTypes in `lub`, but it turns out
that there is a less aggressive solution: `lub` calls `mergeIfSuper`
which then calls `isSubTypeWhenFrozen`, if we just make these subtype
calls non-frozen, we can achieve what we want. This is what the new
`lub` parameter `canConstrain` allows.
|
|
|
|
|
| |
To allow for dependencies between method type parameters, construct MethodTypes
from a closure that maps the currently constructed MethodType to its parameter types.
|
|\
| |
| | |
Fix type inference for HLists and HMaps
|
| | |
|
| |
| |
| |
| | |
and a typo fixed
|
| |
| |
| |
| |
| |
| |
| | |
Turned out hmaps.scala requires the arg alignment to compile.
So we have our first counterexample that we cannot drop this
hack. Now it is made safe in the sense that no constraints get
lost anymore.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We previously tried to force S1 and S2 be the same type
when encountering a lub like `T1 { A = S1 } & T2 { A = S2 }`.
The comments in this commit explain why this is unsound, so
this rewrite is now made subject to a new config option, which
is off by default.
I verified that the new behavior does not affect the performance of
the junit tests.
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
Drop the [type T] syntax, and what's associated to make it work.
Motivation: It's an alternative way of doing things for which there seems
to be little need. The implementation was provisional and bitrotted during
the various iterations to introduce higher-kinded types. So in the end the
complxity-cost for language and compiler was not worth the added benefit
that [type T] parameters provide.
Noe that we still accept _named arguments_ [A = T] in expressions; these are useful
for specifying some parameters and letting others be inferred.
|
|
|
|
|
|
|
|
|
| |
Implicit and non-implicit functions are incomparable with <:<, but are
treated as equivalent with `matches`. This means implicit and non-implicit
functions of the same types override each other, but RefChecks will
give an error because their types are not subtypes.
Also contains a test for #2002.
|
| |
|
|
|
|
|
|
|
|
| |
Before adding a constraint, make sure there is no way
the two types are already in a subtype relation.
Adding redundant constraints is problematic because we
might introduce cycles. See i1891.scala for a test.
|
|
|
|
|
| |
Argument comparison of hk types did not take into account that
the compared types could have themselves wildcard arguments.
|
|\
| |
| | |
Add implicit function types
|
| |
| |
| |
| |
| |
| | |
Implicitness is ignored for matching (otherwise
apply in ImplicitFunction could not shadow apply in Function).
And explicit trumps implicit in subtyping comparisons.
|
|/
|
|
|
|
|
|
|
| |
Typer#ensureReported's comment outlines an example where errors
could go unreported, resulting in error trees after typer without
any reported error messages. This commit makes sure that at least
one error is reported if a tree node has an error type.
Fixes #1802.
|
|
|
|
|
| |
Drop explicit types for local implicit vals of type Context
and Position. Exercises the functionality and shortens the code.
|
| |
|
|
|
|
|
|
| |
In this case, a path went through a type parameter which was
aliased to a singleton type. Need to dealias to get to the
special case handling two paths.
|
|
|