aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TyperState.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-04-21 14:49:40 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-05-08 21:48:08 +0200
commitafb541ade2fc83f47661e1d94cee00f7a4b32178 (patch)
tree4a2d855b2f4d4ffcc29697a049073a8907d22fea /src/dotty/tools/dotc/core/TyperState.scala
parentb6e3c9d15d1e9569d14cd98a57406683fbb3690d (diff)
downloaddotty-afb541ade2fc83f47661e1d94cee00f7a4b32178.tar.gz
dotty-afb541ade2fc83f47661e1d94cee00f7a4b32178.tar.bz2
dotty-afb541ade2fc83f47661e1d94cee00f7a4b32178.zip
Fix of TyperState#instType
If a type variable TV1 is instantiated to a poly param, and the poly param is itself accomanied by a type variable TV2, then the instance of TV1 should be TV2 and not the original poly param. Otherwise we lose instantiations. This is demonstrated by running dotc on the .scala files in the dotc directory itself with option -Ycheck.
Diffstat (limited to 'src/dotty/tools/dotc/core/TyperState.scala')
-rw-r--r--src/dotty/tools/dotc/core/TyperState.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala
index a4b365b17..65cebf967 100644
--- a/src/dotty/tools/dotc/core/TyperState.scala
+++ b/src/dotty/tools/dotc/core/TyperState.scala
@@ -27,6 +27,9 @@ class TyperState(val reporter: Reporter) extends DotClass with Showable {
*/
def instType(tvar: TypeVar): Type = constraint.at(tvar.origin) match {
case _: TypeBounds => NoType
+ case tp: PolyParam =>
+ var tvar1 = constraint.typeVarOfParam(tp)
+ if (tvar1.exists) tvar1 else tp
case tp => tp
}