aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run/inline-constant-in-constructor-1.check3
-rw-r--r--tests/run/inline-constant-in-constructor-1.scala15
-rw-r--r--tests/run/inline-constant-in-constructor-2.check3
-rw-r--r--tests/run/inline-constant-in-constructor-2.scala14
4 files changed, 35 insertions, 0 deletions
diff --git a/tests/run/inline-constant-in-constructor-1.check b/tests/run/inline-constant-in-constructor-1.check
new file mode 100644
index 000000000..05035c26d
--- /dev/null
+++ b/tests/run/inline-constant-in-constructor-1.check
@@ -0,0 +1,3 @@
+assert
+s
+r init
diff --git a/tests/run/inline-constant-in-constructor-1.scala b/tests/run/inline-constant-in-constructor-1.scala
new file mode 100644
index 000000000..11a727fd6
--- /dev/null
+++ b/tests/run/inline-constant-in-constructor-1.scala
@@ -0,0 +1,15 @@
+
+
+abstract class A {
+ def s: Boolean = { println("s"); r }
+ def r: Boolean
+}
+
+object Test extends A {
+ assert({ println("assert"); r == s }) // r constant type not replaced by true, r not initialized yet
+ override val r: true = {
+ println("r init")
+ true
+ }
+ def main(args: Array[String]): Unit = {}
+}
diff --git a/tests/run/inline-constant-in-constructor-2.check b/tests/run/inline-constant-in-constructor-2.check
new file mode 100644
index 000000000..05035c26d
--- /dev/null
+++ b/tests/run/inline-constant-in-constructor-2.check
@@ -0,0 +1,3 @@
+assert
+s
+r init
diff --git a/tests/run/inline-constant-in-constructor-2.scala b/tests/run/inline-constant-in-constructor-2.scala
new file mode 100644
index 000000000..a8d351ab6
--- /dev/null
+++ b/tests/run/inline-constant-in-constructor-2.scala
@@ -0,0 +1,14 @@
+
+abstract class A {
+ def s: Boolean = { println("s"); r }
+ def r: Boolean
+}
+
+object Test extends A {
+ assert({ println("assert"); r == s }) // r constant type replaced by false
+ override val r: false = {
+ println("r init")
+ false
+ }
+ def main(args: Array[String]): Unit = {}
+}