diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-07 18:24:44 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-11 13:35:07 +0200 |
commit | 4693a78edf4bf52b9060a99ca48785d077e5599b (patch) | |
tree | 76885978c6f293ed92b47c21593ef2f22d8e40a2 /src/dotty/tools/dotc/core/Constraint.scala | |
parent | fd62c7b6dc6882f658ba2d614cb95a7141842929 (diff) | |
download | dotty-4693a78edf4bf52b9060a99ca48785d077e5599b.tar.gz dotty-4693a78edf4bf52b9060a99ca48785d077e5599b.tar.bz2 dotty-4693a78edf4bf52b9060a99ca48785d077e5599b.zip |
Less eager removal of type parameters from constraint
Previously, a unified or otherwise instantiated type parameter
would be removed from the constraint, i.e. if it was the
last parameter of its polytype to be instantiated, the polytype
would be dropped. This is a potential problem since it means
that the alias `param = instance` is forgetten whereas we might
still need it in the same subtype test sequence.
The solution is to wait with cleaning up polytypes until
all associated type variables are fully instantiated.
This change uncovered another bug, where we failed
to follow an existing instantiation when adding to
a constraint. This manifested itself in deep subtype
errors for run/colltest1 and some others.
Diffstat (limited to 'src/dotty/tools/dotc/core/Constraint.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Constraint.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Constraint.scala b/src/dotty/tools/dotc/core/Constraint.scala index 38f714131..e480d1bfe 100644 --- a/src/dotty/tools/dotc/core/Constraint.scala +++ b/src/dotty/tools/dotc/core/Constraint.scala @@ -117,12 +117,11 @@ abstract class Constraint extends Showable { */ def narrowBound(param: PolyParam, bound: Type, isUpper: Boolean)(implicit ctx: Context): This - /** Is entry associated with `pt` removable? - * @param removedParam The index of a parameter which is still present in the - * entry array, but is going to be removed at the same step, - * or -1 if no such parameter exists. + /** Is entry associated with `pt` removable? This is the case if + * all type parameters of the entry are associated with type variables + * which have its `inst` fields set. */ - def isRemovable(pt: GenericType, removedParam: Int = -1): Boolean + def isRemovable(pt: GenericType): Boolean /** A new constraint with all entries coming from `pt` removed. */ def remove(pt: GenericType)(implicit ctx: Context): This |