Skip to content

Commit

Permalink
Fix for SI-6687, wrong isVar logic.
Browse files Browse the repository at this point in the history
Fields which back lazy vals need to be excluded via !isLazy
lest isVar return true.
  • Loading branch information
paulp committed Nov 24, 2012
1 parent 5b498a2 commit 7f1ba06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/reflect/scala/reflect/internal/Symbols.scala
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions test/files/run/t6687.scala
@@ -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.