diff options
author | Paul Phillips <paulp@improving.org> | 2009-02-26 21:46:01 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-02-26 21:46:01 +0000 |
commit | 5d802d95ce759ab6cd183b0f1e143c4ff3599207 (patch) | |
tree | de387b21b8741cf36cad13fc69cc4edc01aee225 /src | |
parent | 4e52d412b12f785b3518d51d70e034cc67cf807c (diff) | |
download | scala-5d802d95ce759ab6cd183b0f1e143c4ff3599207.tar.gz scala-5d802d95ce759ab6cd183b0f1e143c4ff3599207.tar.bz2 scala-5d802d95ce759ab6cd183b0f1e143c4ff3599207.zip |
Fix and test case for #1392.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 9518f62c37..427a299d51 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -572,13 +572,16 @@ trait Typers { self: Analyzer => * </ol> */ private def stabilize(tree: Tree, pre: Type, mode: Int, pt: Type): Tree = { + def isNotAValue(sym: Symbol) = // bug #1392 + !sym.isValue || (sym.isModule && isValueClass(sym.linkedClassOfModule)) + if (tree.symbol.hasFlag(OVERLOADED) && (mode & FUNmode) == 0) inferExprAlternative(tree, pt) val sym = tree.symbol if (tree.tpe.isError) tree else if ((mode & (PATTERNmode | FUNmode)) == PATTERNmode && tree.isTerm) { // (1) checkStable(tree) - } else if ((mode & (EXPRmode | QUALmode)) == EXPRmode && !sym.isValue && !phase.erasedTypes) { // (2) + } else if ((mode & (EXPRmode | QUALmode)) == EXPRmode && isNotAValue(sym) && !phase.erasedTypes) { // (2) errorTree(tree, sym+" is not a value") } else { if (sym.isStable && pre.isStable && tree.tpe.typeSymbol != ByNameParamClass && |