diff options
author | Martin Odersky <odersky@gmail.com> | 2016-11-05 15:45:03 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-11-05 15:45:11 +0100 |
commit | cf351a20fcd9de79eedeca76fad59bad55d5a5ec (patch) | |
tree | 70eb84e7cbd58884094c4d0e23c58bb67a18fc21 /tests/neg | |
parent | f532c9acb9aef9a93f52109c320ea5c944de46bc (diff) | |
download | dotty-cf351a20fcd9de79eedeca76fad59bad55d5a5ec.tar.gz dotty-cf351a20fcd9de79eedeca76fad59bad55d5a5ec.tar.bz2 dotty-cf351a20fcd9de79eedeca76fad59bad55d5a5ec.zip |
Disallow wildcard arguments in new
These might lead to bad bounds if unchecked.
Scalac disallows them also, but with a confusing error message
("class type expected" on the class).
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/i1643.scala | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/neg/i1643.scala b/tests/neg/i1643.scala new file mode 100644 index 000000000..d836a4255 --- /dev/null +++ b/tests/neg/i1643.scala @@ -0,0 +1,19 @@ +trait T extends Array { + def t1(as: String*): Array[String] = { varargs1(as: _*) } // error + def t2(as: String*): Array[String] = { super.varargs1(as: _*) } // error +} +class C extends Base_1 { // error + def c1(as: String*): Array[String] = { varargs1(as: _*) } // error + def c2(as: String*): Array[String] = { super.varargs1(as: _*) } // error +} +object Test extends App { + val t = new T {} // error + println(t.t1("a", "b").mkString(",")) + println(t.t2("a", "b").mkString(",")) + val c = new C {} + println(c.c1("a", "b").mkString(",")) + println(c.c2("a", "b").mkString(",")) + + class CC[T] + val x = new CC[_] // error +} |