| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Fix #2198: Don't widen module singletons
|
| |
| |
| |
| |
| |
| |
| |
| | |
Since module classes are a compiler-generated construct that's not directly
visible to programmers, it seems better not to automatically widen a module
singleton to its underlying class.
Fixes #2198.
|
|\ \
| | |
| | | |
Fix #2188: Do cbn transform also on Selects
|
| |/
| |
| |
| | |
These can arise as a result of an explicit outer transform.
|
|\ \
| | |
| | | |
Fix #2192: Follow supertypes when determining whether an expect type …
|
| |/
| |
| |
| | |
function type
|
|\ \
| |/
|/| |
Fix #2220: Change handling of package objects and tweak hk type inference
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we believed that reducing type applications did not affect
type inference as long as the reduced type constructor had the same
arity as the unreduced one, for example reducing `Foo[X, Y]` is fine
when `Foo` is defined as:
type Foo[A, B] = Bar[A, B]
but not when it's defined as:
type Foo[A] = Bar[A, A]
But this is not a sufficient condition: the bounds of the type
constructor arguments also matter for type inference, so we need to be
more strict and disallow reductions in cases like:
type Foo[A, B] = Bar[B, A]
and:
type Foo[A, B] = Bar[A, Int]
|
|\
| |
| | |
Add "enum" construct
|
| | |
|
|\ \
| | |
| | | |
Fix #2024: TypeApply can be a final apply of a recursive method.
|
| | | |
|
| | | |
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`checkNoPrivateLeaks` can force a lot of things, this lead to
hard-to-reproduce issues in unpickling because we called
`checkNoPrivateLeaks` on the type parameters of a class before anything
in the class was indexed. We fix this by making sure that
`checkNoPrivateLeaks` never transforms type symbols, only term symbols,
therefore we can unpickle type parameters without forcing too many
things. tests/neg/leak-type.scala illustrates the new restriction that
this necessitates.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
* Fix varargs in methods (Issue: #1625)
* Fix minor comments
* Change varargs parameter message
* Fix failed test, fix case for constructor
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously, the added testcase failed with (when running with -Ydebug-alias):
2 | def foo = Seq(a)
| ^
|covariant type A occurs in invariant position in type => Seq.CC[Cov.this.A] of method foo
Because the type parameter of `CC` is invariant.
Of course, this is fine because `CC[A]` can be reduced to `Seq[A]`, but
before this commit, `TypeApplications#appliedTo` used to disallow
reductions that replaced an invariant type parameter with a variant one.
I believe that for type inference, only preserving the arity is
important, so I removed this restriction.
|
|\ \
| | |
| | | |
Fix #2051: allow override T with => T or ()T
|
| | | |
|
| | | |
|
| | | |
|
|/ / |
|
|\ \
| | |
| | | |
Fix #2066: Don't qualify private members in SelectionProto's...
|
| | |
| | |
| | |
| | | |
... unless they would be accessible in the given context.
|
| | | |
|
|/ /
| |
| |
| |
| |
| | |
The essential change is that we do not throw away more
precise info of the avoided type if the expected type
is fully defined.
|
|\ \
| | |
| | | |
Fix bug in erasedLub leading to incorrect signatures
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Before this commit, the added testcase failed in a strange way:
14 | def bla(foo: Foo) = orElse2(identity).apply(foo)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|value of type <nonsensical><notype></nonsensical> does not take parameters
This happened because the TermRef for the apply method had an incorrect
signature, therefore its underlying type was NoType.
According to the documentation of `erasedLub`, the erasure should be:
"a common superclass or trait S of the argument classes, with the
following two properties:
S is minimal: no other common superclass or trait derives from S]
S is last : in the linearization of the first argument type `tp1`
there are no minimal common superclasses or traits that
come after S.
(the reason to pick last is that we prefer classes over traits that way)."
I'm not convinced that the implementation satisfies either of these two
properties, but this commit at least makes S closer to being minimal by
making sure that the last best candidate never derives from it.
|
|\ \ \
| | | |
| | | | |
Fix #2064: Avoid illegal types in OrDominator
|
| | |/
| |/|
| | |
| | |
| | | |
Need to skip type bounds in `underlying` chain, since
TypeBounds is not a legal operand type for OrType.
|
|\ \ \
| | | |
| | | | |
Fix type inference for HLists and HMaps
|
| | | |
| | | |
| | | |
| | | | |
and a typo fixed
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
I believe this worked only accidentally because we matched
more things with wildcards which turned out to be flawed. The test
errors show some funky _#_ types, so not sure whether the tests
are still valid or not. Moved back to pending awaiting further
resolution.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
These now compile with the changes to dependent methods, except
for one which is invalid under dotty.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Now only Scala2 mode treats Function1's as implicit conversions. Instead we introduce
a new subclass ImplicitConverter of Function1, instances of which are turned into
implicit conversions.
|
| |_|/
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The new test `falseView.scala` shows the problem. We might create
an implicit value of some type that happens to be a subtype of Function1.
We might now expect that this gives us an implicit conversion, this
is most often unintended and surprising.
See the comment in Implicits#discardForView for a discussion why
we picked the particular scheme implemented here.
|
| |/
|/| |
|
|/
|
|
|
|
| |
In various places we do "case EmptyTree =>", since Tree#equals uses
reference equality this means that EmptyTree should never be copied,
otherwise some other code path will be taken.
|
|\
| |
| | |
Add overloading support for case-closures
|
| | |
|
| |
| |
| |
| |
| |
| | |
case-closures (which are represented as Match nodes) have a known
arity just like other function literals. So shape analysis for
overloading resolution should apply to them as well.
|
|/
|
|
|
|
|
|
|
|
| |
* Fix #2009: Fix placeholder params logic for lambdas
Logic was missing placeholders in rhs of lambdas.
* Add comment
* Fix typo
|
|\
| |
| | |
Fix #1990: Handle inlining where this proxies change types
|
| |
| |
| |
| |
| |
| |
| | |
They are sorted according to the nesting depth of the classes they
represent. This is no necessarily the same as the nesting level of
the symbols of the proxy classes. i1990a.scala shows an example where
the two differ.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The new situation in the test was that outer of the inlined method
was `A` but it's as seen from type is a subtype `B`.
We need two fixes:
- Ignore outerSelects in TreeChecker. These are treated as having fixed symbols.
- Adapt the outer-path logic to deal with code that's moved to another context.
|
|/
|
|
| |
This is necessary if we ever want to get rid of our dependency on scala-compiler
|
|
|
|
|
|
| |
This is a gross hack to support the need for a $scope
binding when XML literals are created. It should go away
once we phase out XML literals. A library-based
solution should use implicits instead.
|