| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Towards correct positions in TASTY types
|
| |
| |
| |
| |
| | |
It seems like overengineering to use different names for
poly methods in definitions and synthetic lambdas.
|
|/
|
|
|
| |
Note that without the fix console tests will fail and without
the warning there is no way to test the fix.
|
|
|
|
| |
Fixes #1515. Review by @smarter.
|
| |
|
|
|
|
|
|
|
| |
The refactored logic only applies to infos of denotations, not
general types. The reactoring avoids special cases down the road
then PolyTypes and MethodTypes can be used for terms as well as
type(bounds).
|
| |
|
|
|
|
|
|
| |
Let them inherit the same traits and push as much
functionality as possibly into the common superclass
GenericType.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test case: orInf.scala. This showed a problem where an `either` operation
had to arbitrarily pick one constraint over another, leading to a type
error down the line. What happened was that a `constrainResult` generated
the constraint
Set[A] <: Set[String] | Set[Int]
But this constraint cannot be simplified without a cut and a resulting
loss of information. We avoid the problem by not constraining the result
if the prototype is a disjunction.
|
| |
|
|
|
|
| |
And remove the not used Printer#echo
|
|
|
|
|
|
|
| |
The special case in hasMatchingMember dealing with self-refential
members has to be generalized to deal lower and upper bounds.
Test case is t762.scala
|
|
|
|
|
|
| |
GADT logic is lost after PatMat. To make code typecheck, the typer
should already insert casts where a subtype check succeeded because
it involved bounds established by a GADT comparison.
|
|
|
|
|
| |
Needed to address problem shown by z1720.scala.
Another fix to avoidance is needed to make it pass completely.
|
|
|
|
| |
Turn assertion into test. Without this, neg/tcpoly_overloaded.scala fails.
|
|
|
|
|
|
| |
Roll `sm` and `i` into one interpolator (also called `i`)
Evolve `d` to `em` interpolator (for error messages)
New interpolator `ex` with more explanations, replaces disambiguation.
|
|
|
|
| |
This allows objects to be easily aliased
|
|
|
|
|
| |
Adapt operations TypeApplications and TypeComparer to account
for the possibilities of curried type lambdas.
|
|\
| |
| | |
Fix 1365: Fix bindings in patterns
|
| |
| |
| |
| |
| |
| | |
We need to compare pattern types with expected types in order
to derive knowledge about pattern-bound variables. This is done
use the mechanism of gadt bounds.
|
| |
| |
| |
| |
| |
| |
| | |
Enable checking of bounds when comparing type lambdas. This invalidates
a pattern used in t2994 and potentially other code, where a bound [X] -> Any
is used as a template that is a legal supertype of all other bounds. The old
behavior is still available under language:Scala2.
|
| |
| |
| |
| | |
Use (cached) superType where possible.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When applying a type alias of a type lambda, keep the original
application instead of reducing. But reduce anyway if
- the reduced type is an application where the type
constructor has the same kind as the original type constructor, or
- some of the arguments are wildcards.
|
| | |
|
| |
| |
| |
| |
| | |
Allows partially instantiated types as type constrictors when inferring higher-kinded
types.
|
| |
| |
| |
| |
| |
| |
| |
| | |
If there is a new named type param scheme it will almost certainly not
need something like compareAliasedRefined.
Also: harden printer to compute less and thereby avoid
a possible NPE.
|
| |
| |
| |
| | |
Gave several times improvement for linker.
|
| | |
|
| |
| |
| |
| |
| | |
Allows us to drop also the involved knownHK method. Lots of other
cleanups.
|
| |
| |
| |
| |
| |
| |
| | |
1. Make genericType a trait instead of a class.
2. Make TypeLambda a type proxy
3. Split underlying in TypeProxy into underlying and superType
4. Cleanups in many other places
|
| |
| |
| |
| |
| | |
Eliminate sameParams, add comments.
Also, minor cleanups elsewhere.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Remove the code that implemented the encoding of hk types
using refinements.
Drop the notion that RefinedTypes can be type parameters. This is
no longer true under the new representation.
Also, refactoring MemberBinding -> TypeParamInfo
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Follow aliases in isMatchingApply
- Avoid comparing with TypeBounds in compareHkApply
- Generalize kind adaption in liftIfHK
Previously we only covered EtaExpansion/reduction. Need to
generalize this to the case where a type is partially applied.
Test case is pos/partialApplications.scala
|
| |
| |
| |
| |
| |
| |
| |
| | |
Makes pos/partialApplications compile.
- Fix appliedTo for aliasTypes
Returned a general TypeBounds instance before.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The problem is that some existential types read from Java (and Scala
as well? not sure) appear as naked typerefs. They consequently get
expanded via eta expansion to type lambdas. This commit compensates for
this by collapsing an eta expansion if this can make a subtype tests succeed
or a union or intersection be legal.
Also, take hk types into account for liftToClasses
Needs to special-treat TypeLambda and HKApply since otherwise
we risk creating malformed And-types.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Make them each inherit from common BaseType GenericType.
That way we avoid inheriting accidentally stuff from PolyType in TypeLambda.
Also, Fix adaptation of type lambdas. Don't confuse them with PolyTypes.
|
| |
| |
| |
| | |
Add existential type elimination for HKApply
|
| |
| |
| |
| |
| | |
- Re-introduce newHK option. Label some things that will be
removed with OLD.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Simplify RefinedType
- Drop recursive definition of RefinedThis - this is now
taken over by RecType.
- Drop RefinedThis.
- Simplify typeParams
The logic avoiding forcing is no longer needed.
- Remove unused code and out of date comments.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Swap order of subtype tests
The theory is that if two refined types have the same refined name, then
they are likely to be of related classes. So it seems more fruitful to
check the argument before the typeconstructor because that way we test
the part that's more likely to fail first. Rough observations seem to
indicate a 3% improvement in the junit test time.
- Cleanups
Drop some unnecessary cases; improve comments.
- Smarter handling of LazyRefs in betaReduce
Try to combine type constructor and arguments under a
common LazyRef.
- Optimize RecType/RecType comparisons
- Fix compareHkLambda, make it check variances.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- compileMixed failed because there was a cycle between immutable.Seq (compiled) and
parallel.ParSeq (loaded from classfile). Inspection of the completion log (turn completions
Printer on) and the stack trace showed that there's nothing we can do here. The old hk scheme
did not go into the cycle because it did not force an unrelated type. I believe with enough
tweaking we would also hva egotten a cycle in the old hk scheme.
The test is "fixed" by adding parallel.ParSeq to the files to compile.
- Disable named parameter tests
Those tests do not work yet with the revised hk scheme.
Before trying to fix this, we should first decide what parts of
named parameters should be kept.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The previous scheme goes into an infinite recursion if the recursive type
does not contain a reference to itself.
Also, make typeParams more defensive
The problematic case is something like
{ z => CC { type hk$0 = z.hk$0; type(param) hk$0 }
Here $hk0 becomes a type parameter through CC and the type lambda.
It's true that such types are eliminated later on. But we want to
avoid mispredictions at all points.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Swap subtype tests
Previous order could create constraints where hk type parameters
got a * bound. (this is now caught in an assert).
- Make underlyingClassRef work for hk types under new scheme.
- Ensure that toAvoid does not creat hk from * types
- Let getClass return a * type
We will be pickier than before. An unapplied type such as
`java.lang.Class` will always be an hk type. Hence, the type
of getClass has to be appleid to [_] to make it a * type.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The new one only reduces straight applications of type lambdas with
definite arguments. It is called very early on appliedTo, and derivedRefinedType.
The old one, now renamed to normalizeHkApply also handles wildcard arguments
and can garbage collect general unneeded hk-refinements. It is called later, at various
places.
TODO: See what functionality of normalizeHkApply should go into betaReduce instead.
Maybe we can even drop normalizeHkApply? However: need to be careful to maintain aliases
for hk type inference.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The new one only reduces straight applications of type lambdas with
definite arguments. It is called very early on appliedTo, and derivedRefinedType.
The old one, now renamed to normalizeHkApply also handles wildcard arguments
and can garbage collect general unneeded hk-refinements. It is called later, at various
places.
TODO: See what functionality of normalizeHkApply should go into betaReduce instead.
Maybe we can even drop normalizeHkApply? However: need to be careful to maintain aliases
for hk type inference.
Handle LazyRefs in BetaReduce
Needs to be careful to not skip LazyRefs when dealiasing.
- Fix^2 of asMemberOf: This fix ensures that
- under the old hk scheme test succeeds for compilestdlib and tasty-new-all
- under the new scheme test succeeds for i94-nada (i.e. REP[T] = T).
- Try to beta-reduce bounds before adding to a constraint.
- More subtle handling of LazyRefs in BetaReduce
- Another refinement to asMemberOf
Need to assume lastSymbol in sync with lastDenotation.
- Drop isSafe test from BetaReduce
Instead, track the higherkinded argument names that a
type variable could potentially instantiate to.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Swap order of tests in lookupRefined
- Change joins of BindingKinds.
A type parameter joint with a normal refinement represents
a type parameter that has been filled in. So the Binding attribute
should be removed.
- Fix printing of type lambdas under new hk scheme
- refine isRef for hk type
The new definition avoids that a higher-kinded type "isRef"
of an underlying class. I.e. `[X] -> Any` is not longer a ref
to `Any`.
- Fix withBindingKind for type aliases
Old definition converted aliases to type bounds.
- Multiple fixes to BetaReduce
- Fix logic for hk subtype tests
- Make isHK more precise
|
| |
| |
| |
| |
| |
| |
| | |
For the moment under newHK flag.
- avoid crasher in derivedTypeParams (NamedTypes don't always have symbols)
- Revise logic in type comparer for new HK scheme
|