summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-02-28 16:52:03 +0000
committerPaul Phillips <paulp@improving.org>2010-02-28 16:52:03 +0000
commit9bfc0f0ac615b48b39b696dc1fb61ba07e5e8274 (patch)
treefab4096e043c7a1468e239924cc70314819f05b5 /src
parentba5dbbd44db2c23c7532cde13453c6a031afb6e5 (diff)
downloadscala-9bfc0f0ac615b48b39b696dc1fb61ba07e5e8274.tar.gz
scala-9bfc0f0ac615b48b39b696dc1fb61ba07e5e8274.tar.bz2
scala-9bfc0f0ac615b48b39b696dc1fb61ba07e5e8274.zip
Modification to r21009 to preserve that classic...
Modification to r21009 to preserve that classic invariant, (x || !x) && !(x && !x). No review.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala13
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
2 files changed, 7 insertions, 12 deletions
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 &&