aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2016-07-28 13:24:59 +0200
committerGitHub <noreply@github.com>2016-07-28 13:24:59 +0200
commitfe36073ee1ae974fbb82d7bcb220b44ec0afc68b (patch)
treeb62a3dbb57db4b30f85565cc4c35188cd0eef5e5 /tests
parent79e0fe02708a115140f53678499c423c773123c4 (diff)
parent66b04551306a20d1a8b1efd4914193e49209cf76 (diff)
downloaddotty-fe36073ee1ae974fbb82d7bcb220b44ec0afc68b.tar.gz
dotty-fe36073ee1ae974fbb82d7bcb220b44ec0afc68b.tar.bz2
dotty-fe36073ee1ae974fbb82d7bcb220b44ec0afc68b.zip
Merge pull request #1410 from dotty-staging/fix-#1263
Fix #1263: Suppress super initializer call for val parameters of traits.
Diffstat (limited to 'tests')
-rw-r--r--tests/run/i1263.scala34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/run/i1263.scala b/tests/run/i1263.scala
new file mode 100644
index 000000000..630e5758e
--- /dev/null
+++ b/tests/run/i1263.scala
@@ -0,0 +1,34 @@
+object Test {
+ trait Foo(val s: String)
+
+ val foo1 = new Foo("bar") {}
+ val foo2 = new Foo { override val s = "bar" }
+ def main(args: Array[String]): Unit = {
+ assert(foo1.s == "bar")
+ assert(foo2.s == "bar")
+ }
+}
+object Test1 {
+ trait Foo(private val s0: String) {
+ def s = s0
+ }
+
+ val foo1 = new Foo("bar") {}
+ def main(args: Array[String]): Unit = {
+ assert(foo1.s == "bar")
+ }
+}
+object Test2 {
+ trait Foo(protected val s: String)
+
+ val foo1 = new Foo("bar") {}
+ val foo2 = new Foo { override val s = "bar" }
+}
+object Test3 {
+ trait Foo(final val s: String)
+
+ val foo1 = new Foo("bar") {}
+ def main(args: Array[String]): Unit = {
+ assert(foo1.s == "bar")
+ }
+}