summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan@lightbend.com>2016-07-14 16:52:20 -0700
committerAdriaan Moors <adriaan@lightbend.com>2016-08-29 09:52:04 +0200
commitdf3689139c4d4bcd2933364d13b8195c3433eb43 (patch)
tree0e8a6cbf6a870869a4ffac6e1a90be2cbf9f1320 /test/files/jvm
parenta3604707303e4b1f45b6afabccaf00510b281912 (diff)
downloadscala-df3689139c4d4bcd2933364d13b8195c3433eb43.tar.gz
scala-df3689139c4d4bcd2933364d13b8195c3433eb43.tar.bz2
scala-df3689139c4d4bcd2933364d13b8195c3433eb43.zip
Fields phase expands lazy vals like modules
They remain ValDefs until then. - remove lazy accessor logic now that we have a single ValDef for lazy vals, with the underlying machinery being hidden until the fields phase leave a `@deprecated def lazyAccessor` for scala-refactoring - don't skolemize in purely synthetic getters, but *do* skolemize in lazy accessor during typers Lazy accessors have arbitrary user code, so have to skolemize. We exempt the purely synthetic accessors (`isSyntheticAccessor`) for strict vals, and lazy accessors emitted by the fields phase to avoid spurious type mismatches due to issues with existentials (That bug is tracked as https://github.com/scala/scala-dev/issues/165) When we're past typer, lazy accessors are synthetic, but before they are user-defined to make this hack less hacky, we could rework our flag usage to allow for requiring both the ACCESSOR and the SYNTHETIC bits to identify synthetic accessors and trigger the exemption. see also https://github.com/scala/scala-dev/issues/165 ok 7 - pos/existentials-harmful.scala ok 8 - pos/t2435.scala ok 9 - pos/existentials.scala previous attempt: skolemize type of val inside the private[this] val because its type is only observed from inside the accessor methods (inside the method scope its existentials are skolemized) - bean accessors have regular method types, not nullary method types - must re-infer type for param accessor some weirdness with scoping of param accessor vals and defs? - tailcalls detect lazy vals, which are defdefs after fields - can inline constant lazy val from trait - don't mix in fields etc for an overridden lazy val - need try-lift in lazy vals: the assign is not seen in uncurry because fields does the transform (see run/t2333.scala) - ensure field members end up final in bytecode - implicit class companion method: annot filter in completer - update check: previous error message was tangled up with unrelated field definitions (`var s` and `val s_scope`), now it behaves consistently whether those are val/vars or defs - analyzer plugin check update seems benign, but no way to know... - error message gen: there is no underlying symbol for a deferred var look for missing getter/setter instead - avoid retypechecking valdefs while duplicating for specialize see pos/spec-private - Scaladoc uniformly looks to field/accessor symbol - test updates to innerClassAttribute by Lukas
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/innerClassAttribute/Test.scala12
-rw-r--r--test/files/jvm/javaReflection.check8
2 files changed, 10 insertions, 10 deletions
diff --git a/test/files/jvm/innerClassAttribute/Test.scala b/test/files/jvm/innerClassAttribute/Test.scala
index 5c666a615f..288c6ee30f 100644
--- a/test/files/jvm/innerClassAttribute/Test.scala
+++ b/test/files/jvm/innerClassAttribute/Test.scala
@@ -298,7 +298,7 @@ object Test extends BytecodeTest {
assertEnclosingMethod ("SI_9105$B$5" , "SI_9105", "m$1", "()Ljava/lang/Object;")
assertEnclosingMethod ("SI_9105$C$1" , "SI_9105", null , null)
assertEnclosingMethod ("SI_9105$D$1" , "SI_9105", "met", "()Lscala/Function1;")
- assertEnclosingMethod ("SI_9105$E$1" , "SI_9105", "m$3", "()Ljava/lang/Object;")
+ assertEnclosingMethod ("SI_9105$E$1" , "SI_9105", "m$2", "()Ljava/lang/Object;")
assertEnclosingMethod ("SI_9105$F$1" , "SI_9105", "met", "()Lscala/Function1;")
assertNoEnclosingMethod("SI_9105")
@@ -311,7 +311,7 @@ object Test extends BytecodeTest {
// by-name
assertEnclosingMethod("SI_9105$G$1", "SI_9105", null , null)
- assertEnclosingMethod("SI_9105$H$1", "SI_9105", "m$2", "()Ljava/lang/Object;")
+ assertEnclosingMethod("SI_9105$H$1", "SI_9105", "m$3", "()Ljava/lang/Object;")
assertEnclosingMethod("SI_9105$I$1", "SI_9105", null , null)
assertEnclosingMethod("SI_9105$J$1", "SI_9105", "bnM", "()I")
assertEnclosingMethod("SI_9105$K$2", "SI_9105", "m$4", "()Ljava/lang/Object;")
@@ -323,11 +323,11 @@ object Test extends BytecodeTest {
def testSI_9124() {
val classes: Map[String, String] = {
List("SI_9124$$anon$10",
- "SI_9124$$anon$11",
"SI_9124$$anon$12",
+ "SI_9124$$anon$13",
"SI_9124$$anon$8",
"SI_9124$$anon$9",
- "SI_9124$O$$anon$13").map({ name =>
+ "SI_9124$O$$anon$11").map({ name =>
val node = loadClassNode(name)
val fMethod = node.methods.asScala.find(_.name.startsWith("f")).get.name
(fMethod, node.name)
@@ -380,8 +380,8 @@ object Test extends BytecodeTest {
val b3 = assertLocal(_ : InnerClassNode, "ImplClassesAreTopLevel$B3$1", "B3$1", flags = publicAbstractInterface)
val b4 = assertLocal(_ : InnerClassNode, "ImplClassesAreTopLevel$B4$1", "B4$1", flags = publicAbstractInterface)
- testInner("ImplClassesAreTopLevel$$anon$14", an14, b3)
- testInner("ImplClassesAreTopLevel$$anon$15", an15, b2)
+ testInner("ImplClassesAreTopLevel$$anon$14", an14, b2)
+ testInner("ImplClassesAreTopLevel$$anon$15", an15, b3)
testInner("ImplClassesAreTopLevel$$anon$16", an16, b4)
testInner("ImplClassesAreTopLevel$B1", b1)
diff --git a/test/files/jvm/javaReflection.check b/test/files/jvm/javaReflection.check
index 9e9fe36d14..f3924940e9 100644
--- a/test/files/jvm/javaReflection.check
+++ b/test/files/jvm/javaReflection.check
@@ -2,13 +2,13 @@ A / A (canon) / A (simple)
- declared cls: List(class A$B, interface A$C, class A$D$)
- enclosing : null (declaring cls) / null (cls) / null (constr) / null (meth)
- properties : false (local) / false (member)
-A$$anon$1 / null (canon) / $anon$1 (simple)
+A$$anon$2 / null (canon) / $anon$2 (simple)
- declared cls: List()
- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
- properties : true (local) / false (member)
A$$anon$3 / null (canon) / $anon$3 (simple)
- declared cls: List()
-- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
- properties : true (local) / false (member)
A$$anon$4 / null (canon) / $anon$4 (simple)
- declared cls: List()
@@ -16,7 +16,7 @@ A$$anon$4 / null (canon) / $anon$4 (simple)
- properties : true (local) / false (member)
A$$anon$5 / null (canon) / $anon$5 (simple)
- declared cls: List()
-- enclosing : null (declaring cls) / class A (cls) / null (constr) / public java.lang.Object A.f() (meth)
+- enclosing : null (declaring cls) / class A (cls) / null (constr) / null (meth)
- properties : true (local) / false (member)
A$$anon$6 / null (canon) / $anon$6 (simple)
- declared cls: List()
@@ -38,7 +38,7 @@ A$D$ / A.D$ (canon) / D$ (simple)
- declared cls: List(class A$D$B, interface A$D$C, class A$D$D$)
- enclosing : class A (declaring cls) / class A (cls) / null (constr) / null (meth)
- properties : false (local) / true (member)
-A$D$$anon$2 / null (canon) / anon$2 (simple)
+A$D$$anon$1 / null (canon) / anon$1 (simple)
- declared cls: List()
- enclosing : null (declaring cls) / class A$D$ (cls) / null (constr) / null (meth)
- properties : true (local) / false (member)