| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
val definitions and for expressions both distinguish whether
something is a pattern or a variable binding. They no do it
the same way: `ident` or an `ident: type` is a variable binding,
everything else is a pattern. Previously, capitalized idents
were considered as bindings in valdefs but as pattern in fors.
|
| |
|
|\
| |
| | |
Fix #1907: Improve error message
|
| |
| |
| |
| |
| |
| |
| |
| | |
It seems in most cases this leads to weird behavior and cause
confusing error messages later.
It also means we cannot create an Array[Nothing], except by
passing the classtag explicitly.
|
|\ \
| | |
| | | |
Better positions for infix operations
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This has two advantages:
- We can distinguish BackquotedIdent from Ident, allowing the user to
use a defined "type `&`", see testcase.
- We get better positions for the operators. This is useful in IDEs, for
example to get the type at point.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| | |
f-bounded-case-class.scala exhibited a StackOverflow in wildApprox before
the fixes. The problem was due to F-bounds.
Note: wildApprox is performance critical. I ran timed-bootstrap-repeated
a couple of times to verify that the changes did not affect runtimes in
significant ways. We should also watch out for a slowdown in the
benchmark tests.
|
|\ \
| | |
| | | |
Fix-#1723: Avoid private leaks on completion
|
| |/
| |
| |
| | |
As #1723 demonstrates, doing this at PostTyper is too late.
|
|\ \
| | |
| | | |
Implement structural type member access
|
| | |
| | |
| | |
| | | |
The PR also fixes #1866, as shown by this test case.
|
| | |
| | |
| | |
| | |
| | | |
Use base types instead of implicits. This is more robust
in the presence of type abstraction.
|
| | |
| | |
| | |
| | | |
New scheme for implementing structural type member access.
|
| |/
|/|
| |
| |
| | |
xxl closures need to get the SAM type FunctionXXL as their explicit
type field after ersure.
|
| |
| |
| |
| | |
The b-test would compile for a millenia without the fix.
|