From 9bfc0f0ac615b48b39b696dc1fb61ba07e5e8274 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sun, 28 Feb 2010 16:52:03 +0000 Subject: Modification to r21009 to preserve that classic... Modification to r21009 to preserve that classic invariant, (x || !x) && !(x && !x). No review. --- src/compiler/scala/tools/nsc/symtab/Symbols.scala | 13 ++++--------- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 +++--- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index cbe3d3f172..30f006201f 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -381,18 +381,13 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => /** Is this symbol a type but not a class? */ def isNonClassType = false - /** Term symbols with the exception of static parts of Java classes and packages */ - final def isValue = isTerm && !(isModule && hasFlag(PACKAGE | JAVA)) + /** Term symbols with the exception of static parts of Java classes and packages + * and the faux companion objects of primitives. (See tickets #1392 and #3123.) + */ + final def isValue = isTerm && !(isModule && (hasFlag(PACKAGE | JAVA) || isValueClass(linkedClassOfModule))) final def isVariable = isTerm && hasFlag(MUTABLE) && !isMethod - // See bugs #1392 and #3123 - this exists specifically to exclude the faux - // companion objects of scala.Int and etc. from appearing to be stable identifiers - // and then crashing the backend. This is surely better handled a different - // way (personally I would vote for making those companion objects real objects - // unless that is impossible.) - def isNotAValue = !isValue || (isModule && isValueClass(linkedClassOfModule)) - // interesting only for lambda lift. Captured variables are accessed from inner lambdas. final def isCapturedVariable = isVariable && hasFlag(CAPTURED) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 98ee29c32b..04cbc6f5d2 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -648,9 +648,9 @@ trait Typers { self: Analyzer => if (tree.tpe.isError) tree else if ((mode & (PATTERNmode | FUNmode)) == PATTERNmode && tree.isTerm) { // (1) - if (sym.isNotAValue) errorTree(tree, sym+" is not a value") - else checkStable(tree) - } else if ((mode & (EXPRmode | QUALmode)) == EXPRmode && sym.isNotAValue && !phase.erasedTypes) { // (2) + if (sym.isValue) checkStable(tree) + else errorTree(tree, sym+" is not a value") + } else if ((mode & (EXPRmode | QUALmode)) == EXPRmode && !sym.isValue && !phase.erasedTypes) { // (2) errorTree(tree, sym+" is not a value") } else { if (sym.isStable && pre.isStable && tree.tpe.typeSymbol != ByNameParamClass && -- cgit v1.2.3