| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Previously, only implicit method types were eligible as views. This is too strict,
as it rules out view bounds. We now also consider types that derive from Function1.
The reason for not allowing any type is that this would cause us to check many more
types for applicability when an implicit view is searched.
|
|
|
|
| |
A debug assertion in implicitSearch gave a false alarm and was removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Goal is better modularization and avoiding code duplication and divergence between Typer and tpd. As a first step, we split Inferencing into Inferencing, Checking, and ProtoTypes. Inferencing and Checking become Typer traits, while ProtoTypes remains a global object.
Eventually:
- we want to have a SimpleTyper, which does the main stuff in tpd, and can mixin either full checking or no checking. Each method in SimpleTyper takes an untyped tree (which is assumed to have typed arguments) and adds a toplevel type to that tree. The methods subsume the type-checking parts in Typers, except for
(1) simplifications and expansions (2) computing prototypes and recursing with them into childtrees (3) adaptation. The method calls the necessary checking operations, which may however be stubbed out.
The idea is already exercised in the typechecking code for Literal and New, except that for now it calls methods in tpd (they will become methods in SimpleTyper instead).
- Typer should inherit from SimpleTyper, and forward all logic except for (1) - (3) to it.
- tpd should call the simple typer it gets from ctx.typer
- ctx.typer should be a SimpleTyper, not a complete one.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several measures:
1. Invalidate classOfId and superIdOfClass in ContextBase after each run. These contain local classes
that should become inaccessible.
2. Also clear implicitScope cache that maps types to their implicit scopes after each run. (not sure whether
this is needed; it did show up in paths from root, but on second thought this might have been a gc-able
cycle.
3. Avoid capturing contexts in lazy annotations.
4. Avoid capturing contexts in functions that compute souceModule and moduleClass
5. Avoid capturing contexts in Unpickler's postReadOp hook.
|
| |
|
|
|
|
| |
There were too many problems caused by it, and too little gained. So, now SelectionProto is no longer a Subtype of RefinedType.
|
|
|
|
|
| |
1) Split out wildApprox into separate function
2) Be more careful not to follow static prefix chains where not needed
|
|\
| |
| |
| |
| | |
1) Make definitions load symbols in current run
2) Change handling of invalid parents. Instead of a copied denotation, we now invalidate the caches of the existing one. (Copying was not enough, as old versions of denotations kept leaking in).
|
|/ |
|
| |
|
|
|
|
| |
"conforms" is no longer special-cased to be eligible as a implicit conversion. Only implicit methods are eligible, whereas conforms is an implicit value with an apply method. So far, "conforms" as an implicit conversion masked in effect some type inference bugs. With the previous two commits, it is no longer necessary because two type inference bugs got fixed.
|
|
|
|
|
|
| |
Now this is required only for members of a template. Local statements can still have implicits with no result type. (Maybe we need to get back on this).
Also, changed Dotty itself and tests to adhere to the new restriction.
|
|
|
|
| |
Improves effectiveness of elidable cache from ~66% to ~85% and reduces # of implicits that need to be checked after discarding to about 20% what it was before.
|
|
|
|
|
|
|
|
|
|
|
|
| |
some nested import.
This also changes the criterion when a root import is disabled.
A root import is now disabled if there is an inner import from the same package or module, and the inner import contains at least one disabling clause X => _. (The latter crierion is new; without it, we would consider something like
import scala.{collections => c}
as a hiding import for Scala, which seems to go too far.)
|
| |
|
|
|
|
| |
Instead of doing a wildApprox of the whole type, we fuse with the logix for method types and just do a wild approx of the single method type argument we have to test.
|
|
|
|
|
| |
(1) Moved into refMatches, to avoid normalize on references that are discarded anyway
(2) Added another check if the expected type is a value class
|
|
|
|
|
|
| |
eligibility.
Unless we do this, typevars would sneak into eligibility checks.
|
| |
|
| |
|
|
|
|
| |
We now track eligible calls and the number of refs tested in an eligible call.
|
|
|
|
|
|
|
|
| |
To avoid to always create a type before checking its uniqueness we specialize on the three most common categories: RefinedTypes, TypeBounds and NamedTypes.
Each category gets its own uniques map. Hashing is disentangled from Types.
The new treatement seems to give some improvement (2-5%?) but not much.
|
|
|
|
|
|
| |
To save time we handle these directly, rather than looking for implicit conversions. Reason: this saves time (looks like 5-10% of frontend), and we know these are always available.
The scheme would be foiled if someone introduced additional implicit conversions between numeric types. We could detect and forbid that.
|
|
|
|
| |
Previous flagsString is no longer accessible. Have to use Dotty's mechanism to show flags,
|
|
|
|
| |
Reason: This works even for typeRefs with joint-ref denotations, even if the symbol does not exist. The only reason to use symbol.isAliasType is if info.isAlias can produce a cycle.
|
|
|
|
| |
For packages, the implicit scope consists of the implicit definitions in a nested `package` object, not the package itself.
|
| |
|
|
|
|
| |
The implicit scope of a ThisType is now always the implicit scope of the self type. This caused cycles which necessitated cycle detectors in namedParts and computeImplicitScope.
|
|
|
|
| |
More generally, a refactoring of the Compatibility trait to use value passing instead of inheritance.
|
| |
|
| |
|
| |
|
|
|
|
| |
Because eligibility is tested in a context which is different from the implicit search context, we cannot assume that type variables have their constraint recorded. So we have to approximate subtype tests with PolyParams which are not in the constraint set.
|
| |
|
| |
|
|
|
|
| |
The test did not fire if the set of class symbols of the searched-for type was empty.
|
| |
|
|
|
|
| |
Need to pass a current context to be able to find instances of typevars.
|
|
|
|
| |
Thus constraining the search space.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Need to handle the case of a curried method with result type
(Ts)T
and expected type
Ts => T
|
|
|
|
| |
This triggered an assertion violation in ImplicitSearch. When checking an argument for a method, it's possible that the method parameter is a lower bound, and the argument is incompatible with that lower bound. In this case an implicit conversion towards the variable was searched, which leads to an explosion of the search space (the variable expands to WildcardType, so _every_ implicit is eligible). Better to search for a conversion to the lower bound (or, in fact, and equivalently, the underlying type parameter) instead.
|
|
|
|
|
|
|
| |
1) endPos works now even for NoPosition.
2) On the other hand, there's an assertion in Typer.typed which requires every non-empty tree that's type checked in a globally committable context to have a defined position.
Some fixes were needed to make the tests pass the new assert.
|
|
|
|
| |
To avoid duplication between by-name parameters and expr types, we treat by-name parameters as as having ExprType. A part of this is introducing ByNameTypeTree, a specific tree class for => T types.
|
| |
|
|
|
|
| |
Shadowing got confused if the shadowing expression truned out to be a closure.
|
|
|
|
|
|
|
|
| |
1. Shadowing tree uses adaptation funProto of prototype. Previously many shadowing tries failed with errors like "need to follow with "_" to adapt to function". These early failures hid potential shadowing conflicts.
2. Shadowing conflict testing is now done using symbols instead of comparing references. Comparing references gave false negative when a shadoing tree had inferred type parameters, for instance. There were other problems as well. Generally, comparsing references seems too fragile.
3. Inferred views are now re-adapted. This is necessary if the view itself takes another implicit parameter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Faced with a pattern like
Apply(x, xs)
we first look for an Apply object which is an extractor. If this fails, we now
interprete Apply as a type. If it is a type alias which points to a class type that
has a companion module, we then try that companion module as an extractor.
Scala 2.x does ot that way, and it's used widely within dotty itself. Think tpd.Apply as the found object,
Trees.Apply as the extractor.
Also, added a fix to normalization which made normalization go deep into a method type.
|
|
|
|
| |
Previously, we did not strip off the => when comparing against expected type.
|
| |
|