summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2009-08-06 10:25:28 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2009-08-06 10:25:28 +0000
commitf22d1313c2527dd87b342e3461b577e51a2f1576 (patch)
treea910e5d9d797bbc68fa90288f42a0a9bdd951ca7 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parentd32130e1f4795b0d5c9ac891474c88c3884ee898 (diff)
downloadscala-f22d1313c2527dd87b342e3461b577e51a2f1576.tar.gz
scala-f22d1313c2527dd87b342e3461b577e51a2f1576.tar.bz2
scala-f22d1313c2527dd87b342e3461b577e51a2f1576.zip
fixed ticket #2197
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 0b50b0b94d..8056c2794e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -762,8 +762,14 @@ trait Typers { self: Analyzer =>
adapt(tree setType tr.normalize.skolemizeExistential(context.owner, tree), mode, pt)
case et @ ExistentialType(_, _) if ((mode & (EXPRmode | LHSmode)) == EXPRmode) =>
adapt(tree setType et.skolemizeExistential(context.owner, tree), mode, pt)
- case PolyType(tparams, restpe) if ((mode & (TAPPmode | PATTERNmode)) == 0) => // (3)
- assert((mode & HKmode) == 0) //@M
+ case PolyType(tparams, restpe) if ((mode & (TAPPmode | PATTERNmode | HKmode)) == 0) => // (3)
+ // assert((mode & HKmode) == 0) //@M a PolyType in HKmode represents an anonymous type function,
+ // we're in HKmode since a higher-kinded type is expected --> hence, don't implicitly apply it to type params!
+ // ticket #2197 triggered turning the assert into a guard
+ // I guess this assert wasn't violated before because type aliases weren't expanded as eagerly
+ // (the only way to get a PolyType for an anonymous type function is by normalisation, which applies eta-expansion)
+ // -- are we sure we want to expand aliases this early?
+ // -- what caused this change in behaviour??
val tparams1 = cloneSymbols(tparams)
val tree1 = if (tree.isType) tree
else TypeApply(tree, tparams1 map (tparam =>