diff options
author | Martin Odersky <odersky@gmail.com> | 2013-11-20 15:06:12 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-11-20 15:06:12 +0100 |
commit | 5240de72c9cc0beb552dc1fd77510b3d7b19a8c6 (patch) | |
tree | fbd652d601f647f6788bb15a02f6d8216a70083c /src/dotty/tools/dotc/core/Constraint.scala | |
parent | db5066bbb4c281bd3b65fe6422314afee115de5e (diff) | |
download | dotty-5240de72c9cc0beb552dc1fd77510b3d7b19a8c6.tar.gz dotty-5240de72c9cc0beb552dc1fd77510b3d7b19a8c6.tar.bz2 dotty-5240de72c9cc0beb552dc1fd77510b3d7b19a8c6.zip |
Splitting constraint.appky into at, bounds, contains.
Motivation: Keep usages separate, prepare for larger constraint refactoring.
Diffstat (limited to 'src/dotty/tools/dotc/core/Constraint.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Constraint.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Constraint.scala b/src/dotty/tools/dotc/core/Constraint.scala index d2ea6aa65..7d1ad5abe 100644 --- a/src/dotty/tools/dotc/core/Constraint.scala +++ b/src/dotty/tools/dotc/core/Constraint.scala @@ -28,11 +28,16 @@ class Constraint(val map: SimpleMap[PolyType, Array[Type]]) extends AnyVal with /** The constraint for given type parameter `param`, or NoType if `param` is not part of * the constraint domain. */ - def apply(param: PolyParam): Type = { + def at(param: PolyParam): Type = { val entries = map(param.binder) if (entries == null) NoType else entries(param.paramNum) } + /** The constraint bounds for given type parameter `param`. + * @pre `param` is not part of the constraint domain. + */ + def bounds(param: PolyParam): TypeBounds = at(param).asInstanceOf[TypeBounds] + /** The constraint for the type parameters of `pt`. * @pre The polytype's type parameters are contained in the constraint's domain. */ @@ -116,7 +121,7 @@ class Constraint(val map: SimpleMap[PolyType, Array[Type]]) extends AnyVal with def constraintText(indent: Int, printer: Printer): Text = { val assocs = for (param <- domainParams) - yield (" " * indent) ~ param.toText(printer) ~ this(param).toText(printer) + yield (" " * indent) ~ param.toText(printer) ~ at(param).toText(printer) Text(assocs, "\n") } |