summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@gmail.com>2012-08-06 18:48:52 +0200
committerHubert Plociniczak <hubert.plociniczak@gmail.com>2012-08-08 10:45:29 +0200
commit95b36489829c12eb323e6252a28bbf54b27b9977 (patch)
tree85b930d2c94d19aa0fa9a4fc368430c0e1a84f56 /src
parent937da62be2834a646a31dbfb01527a82672f111e (diff)
downloadscala-95b36489829c12eb323e6252a28bbf54b27b9977.tar.gz
scala-95b36489829c12eb323e6252a28bbf54b27b9977.tar.bz2
scala-95b36489829c12eb323e6252a28bbf54b27b9977.zip
Fixes SI-5687.
Recover from erroneous type alias override to report more useful error message.
Diffstat (limited to 'src')
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 8972dfa828..d4f36e3c6d 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -2201,7 +2201,15 @@ trait Types extends api.Types { self: SymbolTable =>
override protected def normalizeImpl =
if (typeParamsMatchArgs) betaReduce.normalize
else if (isHigherKinded) super.normalizeImpl
- else ErrorType
+ else {
+ // if we are overriding a type alias in an erroneous way, don't just
+ // return an ErrorType since that will result in useless error msg.
+ // Instead let's try to recover from it and rely on refcheck reporting the correct error,
+ // if that fails fallback to the old behaviour.
+ val overriddenSym = sym.nextOverriddenSymbol
+ if (overriddenSym != NoSymbol) pre.memberType(overriddenSym).normalize
+ else ErrorType
+ }
// isHKSubType0 introduces synthetic type params so that
// betaReduce can first apply sym.info to typeArgs before calling