diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-22 11:08:22 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-22 11:08:22 +0200 |
commit | c61892842cebdee0dbb0c7a80bb468ae20ea57e1 (patch) | |
tree | d7f4559a65fa6ebff5a3287ddf809893e0580bc5 /src/dotty/tools/dotc/core/Types.scala | |
parent | 478be16e8d6af6004215682dda4730b78533c543 (diff) | |
download | dotty-c61892842cebdee0dbb0c7a80bb468ae20ea57e1.tar.gz dotty-c61892842cebdee0dbb0c7a80bb468ae20ea57e1.tar.bz2 dotty-c61892842cebdee0dbb0c7a80bb468ae20ea57e1.zip |
Avoid junk produced by Constraint#replace.
There were two instances where a constraint undergoing a replace would still refer
to poly params that are no longer bound after the replace.
1. In an ordering the replaced parameters was n ot removed from the bounds of the others.
2. When a parameter refers to the replaced parameter in a type, (not a TypeBounds), the
replaced parameter was not replaced.
We now have checking in place that in globally committable typer states, TypeVars are not instantiated
to PolyParams and (configurable) that constraints of such typer states are always closed.
Fixes #670.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 026e69539..1270466e9 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -2458,6 +2458,9 @@ object Types { if (fromBelow && isOrType(inst) && isFullyDefined(inst) && !isOrType(upperBound)) inst = inst.approximateUnion + if (ctx.typerState.isGlobalCommittable) + assert(!inst.isInstanceOf[PolyParam], i"bad inst $this := $inst, constr = ${ctx.typerState.constraint}") + instantiateWith(inst) } |