From 441613bd49f9b5629eefffdc30a52869c0732ca0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 5 Sep 2013 15:35:59 +0200 Subject: added widenSingleton method. Needed to make normalize correct. --- src/dotty/tools/dotc/core/Types.scala | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/dotty/tools/dotc/core/Types.scala') 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) -- cgit v1.2.3