aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-09-05 15:35:59 +0200
committerMartin Odersky <odersky@gmail.com>2013-09-05 15:35:59 +0200
commit441613bd49f9b5629eefffdc30a52869c0732ca0 (patch)
tree73ac2e6d505bbcacf03aa0edc69341efaed5d05a /src/dotty/tools/dotc/core/Types.scala
parenteeffffdb4285e26cd7dd01124a3d94664266a168 (diff)
downloaddotty-441613bd49f9b5629eefffdc30a52869c0732ca0.tar.gz
dotty-441613bd49f9b5629eefffdc30a52869c0732ca0.tar.bz2
dotty-441613bd49f9b5629eefffdc30a52869c0732ca0.zip
added widenSingleton method.
Needed to make normalize correct.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 19c0e3128..518b13dbe 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -534,6 +534,11 @@ object Types {
case _ => this
}
+ final def widenSingleton(implicit ctx: Context): Type = this match {
+ case tp: SingletonType => tp.underlying.widenSingleton
+ case _ => this
+ }
+
/** If this is an alias type, its alias, otherwise the type itself */
final def dealias(implicit ctx: Context): Type = stripTypeVar match {
case tp: TypeRef if tp.symbol.isAliasType => tp.info.bounds.hi
@@ -1745,6 +1750,7 @@ object Types {
/** Instantiate variable with given type */
def instantiateWith(tp: Type)(implicit ctx: Context): Type = {
assert(owningState.undetVars contains this)
+ owningState.constraint -= origin
owningState.undetVars -= this
if (ctx.typerState eq creatorState) inst = tp
else ctx.typerState.instType = ctx.typerState.instType.updated(this, tp)