aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Constraint.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-13 14:39:13 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-13 14:39:26 +0100
commit620359dc261c12456519c142e3a6e9842f750989 (patch)
tree56c85f5b2e0b1da1eeb720ed7d4a9b5ba04e67a0 /src/dotty/tools/dotc/core/Constraint.scala
parent12983c39486b3759028502125944f09d62267e83 (diff)
downloaddotty-620359dc261c12456519c142e3a6e9842f750989.tar.gz
dotty-620359dc261c12456519c142e3a6e9842f750989.tar.bz2
dotty-620359dc261c12456519c142e3a6e9842f750989.zip
When instantiating a type var, need to map back from polyparams to typevars.
Diffstat (limited to 'src/dotty/tools/dotc/core/Constraint.scala')
-rw-r--r--src/dotty/tools/dotc/core/Constraint.scala9
1 files changed, 9 insertions, 0 deletions
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`.
*/