diff options
Diffstat (limited to 'tests/neg/i1263.scala')
-rw-r--r-- | tests/neg/i1263.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/neg/i1263.scala b/tests/neg/i1263.scala new file mode 100644 index 000000000..e6d8c37b5 --- /dev/null +++ b/tests/neg/i1263.scala @@ -0,0 +1,33 @@ +object Test { + trait Foo(val s: String) + + val foo1 = new Foo("bar") {} + val foo2 = new Foo { override val s = "bar" } // error: parameterized trait lacks argument list + 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") {} +} +object Test3 { + trait Foo(final val s: String) + + val foo1 = new Foo("bar") {} + def main(args: Array[String]): Unit = { + assert(foo1.s == "bar") + } +} |