We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2136fc1 + b077695 commit 83735d2Copy full SHA for 83735d2
library/src/scala/reflect/Selectable.scala
@@ -8,7 +8,7 @@ class Selectable(val receiver: Any) extends AnyVal with scala.Selectable {
8
fld.get(receiver)
9
}
10
catch {
11
- case ex: NoSuchFieldError =>
+ case ex: NoSuchFieldException =>
12
selectDynamicMethod(name).asInstanceOf[() => Any]()
13
14
tests/run/i4496a.scala
@@ -0,0 +1,11 @@
1
+import scala.reflect.Selectable.reflectiveSelectable
2
+class Foo1 { val a: Int = 10 }
3
+class Foo2 { def a: Int = 10 }
4
+class Foo3 { var a: Int = 10 }
5
+object Test {
6
+ def main(args: Array[String]): Unit = {
7
+ assert((new Foo1 : {val a: Int}).a == 10)
+ assert((new Foo2 : {val a: Int}).a == 10)
+ assert((new Foo3 : {val a: Int}).a == 10)
+ }
+}
0 commit comments