Permalink
Browse files

Fix for SI-6687, wrong isVar logic.

Fields which back lazy vals need to be excluded via !isLazy
lest isVar return true.
  • Loading branch information...
1 parent 5b498a2 commit 7f1ba06f1313383fe60ce9bc6566afc78b3dae75 @paulp paulp committed Nov 19, 2012
Showing with 11 additions and 1 deletion.
  1. +1 −1 src/reflect/scala/reflect/internal/Symbols.scala
  2. +10 −0 test/files/run/t6687.scala
@@ -79,7 +79,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
def isImplementationArtifact: Boolean = (this hasFlag BRIDGE) || (this hasFlag VBRIDGE) || (this hasFlag ARTIFACT)
def isJava: Boolean = isJavaDefined
def isVal: Boolean = isTerm && !isModule && !isMethod && !isMutable
- def isVar: Boolean = isTerm && !isModule && !isMethod && isMutable
+ def isVar: Boolean = isTerm && !isModule && !isMethod && !isLazy && isMutable
def newNestedSymbol(name: Name, pos: Position, newFlags: Long, isClass: Boolean): Symbol = name match {
case n: TermName => newTermSymbol(n, pos, newFlags)
@@ -0,0 +1,10 @@
+import scala.reflect.runtime.universe._
+
+class A { lazy val x = 1 }
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val vars = typeOf[A].members.toList filter (x => x.isTerm && x.asTerm.isVar)
+ assert(vars.isEmpty, vars)
+ }
+}

0 comments on commit 7f1ba06

Please sign in to comment.