We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider the following example:
import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} class A { var x: Int = 42 } val a = new A val im: InstanceMirror = cm.reflect(a) val cs = im.reflectClass.symbol val f = cs.typeSignature.declaration(newTermName("x")).asTermSymbol val fm: FieldMirror = im.reflectField(f) fm.field.isVariable
The last expression returns false:
scala> fm.field.isVariable res0: Boolean = false
I expected that it returns true, according to the documentation:
/** Does this symbol represent a mutable value? * If yes, `isTerm` and `isValue` are also guaranteed to be true. */ def isVariable: Boolean
The MUTABLE-Flag is also not set (which is consistent with the above result)
scala> fm.field.flags.containsAll(Flag.MUTABLE) res174: Boolean = false
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-5889?orig=1 Reporter: @dgruntz Affected Versions: 2.10.0
Sorry, something went wrong.
@xeno-by said: scala> fm.field.isMethod res1 @ 3796a671: Boolean = true
I think, this is the problem.
@xeno-by said: Changing newTermName("x") to newTermName("x ") solves the problem (yes, "x " as in "x with a whitespace").
@xeno-by said: Superceded by #5895.
xeno-by
No branches or pull requests
Consider the following example:
The last expression returns false:
I expected that it returns true, according to the documentation:
The MUTABLE-Flag is also not set (which is consistent with the above result)
The text was updated successfully, but these errors were encountered: