| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
If we do not do that, any type variables in the parent type get interpolated
later, when the whole primary constructor is typed. But by then we miss the
context of what their variance was.
|
|
|
|
| |
Remove unused functionality
|
|
|
|
| |
nameddefaults.scala now compiles without crashing
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Use fromParams instead.
|
|
|
|
|
| |
- 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In #2139 I added code to create dummy companions for companion-less
objects, but not for companion-less classes because I thought it wasn't
needed. But it turns out that even if the classpath only has `Foo.class`
and not `Foo$.class`, a module for `Foo` is entered by
`initializeFromClassPath` when it calls `enterClassAndModule`, so we
have to add dummy companions to classes. I don't have a test to
illustrate this issue, but note that it fixes the incremental
compilation bug demonstrated by
https://github.com/dotty-staging/dotty/commits/incremental-compilation-bug.
Note: I verified that adding a dummy companion to "class Foo" did not
cause the backend to emit a Foo$.class, so this should have no visible
impact.
|
|
|
|
|
|
|
|
|
|
|
| |
The previous commit introduced two new usages of `denotNamed` which broke
tests/run/t1987b because `denotNamed` indirectly calls `packageObj`
which caches the package object, except that at this point the package
object is not yet entered, so the cache was incorrect. We fix this by
using `effectiveScope.lookup` instead since we only need to look into
the current scope, this is also true for the two existing usage of
`denotNamed` in `createCompanionLinks` so they were also replaced by
`effectiveScope.lookup`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we sometimes ended up forcing a companion class symbol from
a previous run or from the classpath which lead to weird issues like in
`false-companion`. Even if we end up not forcing such a symbol, its
presence can still lead to issue: before this commit incremental
compilation of `dotty-compiler-bootstrapped` was broken because we
recorded a false dependency on the non-bootstrapped `dotty-compiler`
jar.
The added test is currently marked pending because it does not work with
JUnit (which doesn't handle separate compilation), only partest. I
didn't managed to get it to work right, and this won't be necessary once
our testing framework is overhauled by
https://github.com/lampepfl/dotty/pull/2125 anyway, so I'll just have to
remember to enable this test afterwards.
|
| |
|
|\
| |
| | |
support merging companion objects in expanded trees
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previous implementation is problematic when there are multiple
transforms before typer:
1. There might be objects needing merging that only exist in the
expanded trees, which cannot be handled by the previous algorithm.
2. There may be companion object and class defined only in the
expanded trees, the previous algorithm doesn't create links for them.
This PR simplifies the companion object merging logic and
fixes the problems above.
In fact, this PR supports multiple pre-typer transform during expansion.
The protocol is that the expansion of a MemberDef is either a flattened
thicket or a non-thicket tree.
|
|/
|
|
|
|
|
| |
It's hard to predict for defKind all the desugarings that can be
applied to a definition. Better to do it once the desugarings have been
applied. NoInit and PureInterface are both tested only after Typer,
so it's OK to delay their initialization until regular Typer.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we computed the scope in `findModuleBuddy` using
`this.effectiveScope`, this means that we captured `this` which has a
self-type of `Context`, replacing it by `ctx.effectiveScope`
would be wrong since we are interested in the scope at the time
`adjustModuleCompleter` was called, not the scope at the time the
completer is called. Therefore, we have to eagerly compute
`this.effectiveScope` so that we don't capture the Context but can use
the right scope in `findModuleBuddy`.
We also move `findModuleBuddy` to a companion object to avoid accidental
captures of `this`.
This capture lead to crashes in the IDE.
|
| |
|
|\
| |
| | |
Fix to wildapprox
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously `mergeCompanionDefs` assumes that if the attachment of class `Foo` is as follows:
x :: y :: tdef @ TypeDef(_, templ)
Then the `tdef` must be `Foo$`. When there are multiple pre-typer transforms,
this is not necessarily true. For example, an annotation macro expansion may
expand a non-case class `Foo` to `class Foo; object FooA`.
We need to check the name of `tdef` to be equal to `Foo$`.
|
|\ \
| |/
|/| |
support pre-typer transform of trees
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently `mergeCompanionDefs` assume `ModuleDef` is expanded
exactly to `module val; module class`. To enable more
general pre-typer transform, we need to weaken the assumption
to that the first two elements of the thicket must be
`module val; module class`.
This change will enable transform def macros defined inside
an object, as well as other pre-typer transforms.
|
|/
|
|
|
| |
avoidPrivateLeaks got moved from Checking to TypeAssigner, where it
fits well besides the other avoid methods.
|
|
|
|
|
|
|
|
|
|
| |
scalac hides a root import from Predef if there is an eplicit Predef import.
We now do the same (previously we did this only if the overriding import undefined
something, using a `x => _` syntax). To avoid cycles and races one had to be very careful
not to force import symbols too early, so we now compare the name before the symbol proper.
All this is likely temporary - the comment of ImportInfo#unimported points to a different,
more systematic solution.
|
|
|
|
|
|
|
| |
If a parent type of an anonymous class is an Ident or Select which refers
to a parameterized type, use the expected type to infer its type parameters.
Fixes #1803.
|
|
|
|
|
|
|
|
|
| |
Since we now allow to drop the explicit type of a local implicit val
it can happen that this causes a cyclic reference, namely when the
typechecking of the right-hand side involves an implicit search.
It's unpractical and fragile to avoid this. Instead we give now
a nice error message explaining the problem and how to fix it in
source code.
|
|
|
|
|
| |
Drop explicit types for local implicit vals of type Context
and Position. Exercises the functionality and shortens the code.
|
| |
|
| |
|
|
|
|
|
|
| |
If we want to do annotation macros right, we need to add
annotations before completing definitions. This commit achieves
that by adding a new "phase" between index and typecheck.
|
|
|