From 620359dc261c12456519c142e3a6e9842f750989 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 13 Jan 2014 14:39:13 +0100 Subject: When instantiating a type var, need to map back from polyparams to typevars. --- src/dotty/tools/dotc/core/Constraint.scala | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/dotty/tools/dotc/core/Constraint.scala') diff --git a/src/dotty/tools/dotc/core/Constraint.scala b/src/dotty/tools/dotc/core/Constraint.scala index 8704a35d8..b47cc921c 100644 --- a/src/dotty/tools/dotc/core/Constraint.scala +++ b/src/dotty/tools/dotc/core/Constraint.scala @@ -59,6 +59,15 @@ class Constraint(val myMap: SimpleMap[PolyType, Array[Type]]) extends AnyVal wit */ def bounds(param: PolyParam): TypeBounds = at(param).asInstanceOf[TypeBounds] + /** The type variable corresponding to parameter `param`, or + * NoType, if `param` is not in constrained or is not paired with a type variable. + */ + def typeVarOfParam(param: PolyParam): Type = { + val entries = myMap(param.binder) + if (entries == null) NoType + else typeVar(entries, param.paramNum) + } + /** A new constraint which is derived from this constraint by adding or replacing * the entries corresponding to `pt` with `entries`. */ -- cgit v1.2.3