summaryrefslogtreecommitdiff
path: root/test/files/pos/sd219.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan@lightbend.com>2016-09-08 18:17:45 +0200
committerAdriaan Moors <adriaan.moors@typesafe.com>2016-09-26 15:46:21 -0700
commit9a39e0c283ac60edabb8dba9ad8513199112882a (patch)
treeb261ffcd79d1adb9e01d727d70fb3eff8d2183e1 /test/files/pos/sd219.scala
parent6df14e57a4980897d5517f002c04584b82e05b15 (diff)
downloadscala-9a39e0c283ac60edabb8dba9ad8513199112882a.tar.gz
scala-9a39e0c283ac60edabb8dba9ad8513199112882a.tar.bz2
scala-9a39e0c283ac60edabb8dba9ad8513199112882a.zip
Avoid mismatched symbols in fields phase
The info of the var that stores a trait's lazy val's computed value is expressed in terms of symbols that exist before the fields phase. When we're implementing the lazy val in a subclass of that trait, we now see symbols created by the fields phase, which results in mismatches between the types of the lhs and rhs in the assignment of `lazyVar = super.lazyImpl`. So, type check the super-call to the trait's lazy accessor before our own phase. If the lazy var's info depends on a val that is now implemented by an accessor synthesize by our info transformer, we'll get a mismatch when assigning `rhs` to `lazyVarOf(getter)`, unless we also run before our own phase (like when we were creating the info for the lazy var). This was revealed by Hanns Holger Rutz's efforts in compiling scala-refactoring's test suite (reported on scala-internals). Fixes scala/scala-dev#219
Diffstat (limited to 'test/files/pos/sd219.scala')
-rw-r--r--test/files/pos/sd219.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/sd219.scala b/test/files/pos/sd219.scala
new file mode 100644
index 0000000000..3c3f4962f0
--- /dev/null
+++ b/test/files/pos/sd219.scala
@@ -0,0 +1,11 @@
+class Global { class Name }
+
+trait CommonPrintUtils {
+ val global: Global
+
+ lazy val precedence: global.Name => Int = ???
+}
+
+trait CompilerProvider { val global: Global = ??? }
+
+class AbstractPrinter extends CommonPrintUtils with CompilerProvider \ No newline at end of file