diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2016-08-24 13:38:40 +0200 |
---|---|---|
committer | Nicolas Stucki <nicolas.stucki@gmail.com> | 2016-09-05 11:52:37 +0200 |
commit | bd54fd04dada033836d2b9113e40b9485a52522a (patch) | |
tree | 8bf563d777ea2bdd17cf3578e30e9df9b3681e75 /tests/neg | |
parent | a0e7adb070ee9c73c0cca081196198296cbd63ab (diff) | |
download | dotty-bd54fd04dada033836d2b9113e40b9485a52522a.tar.gz dotty-bd54fd04dada033836d2b9113e40b9485a52522a.tar.bz2 dotty-bd54fd04dada033836d2b9113e40b9485a52522a.zip |
Fix #1468: Add type parameter support for scala.Dynamic
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/t6663.check | 6 | ||||
-rw-r--r-- | tests/neg/t6663.scala | 19 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/neg/t6663.check b/tests/neg/t6663.check new file mode 100644 index 000000000..aa4faa4a4 --- /dev/null +++ b/tests/neg/t6663.check @@ -0,0 +1,6 @@ +t6663.scala:16: error: type mismatch; + found : String + required: Int + var v = new C(42).foo[String].get :Int + ^ +one error found diff --git a/tests/neg/t6663.scala b/tests/neg/t6663.scala new file mode 100644 index 000000000..aa4ab08ed --- /dev/null +++ b/tests/neg/t6663.scala @@ -0,0 +1,19 @@ +import language.dynamics + +class C(v: Any) extends Dynamic { + def selectDynamic[T](n: String): Option[T] = Option(v.asInstanceOf[T]) + def applyDynamic[T](n: String)(): Option[T] = Option(v.asInstanceOf[T]) +} + +object Test extends App { + // this should be converted to + // C(42).selectDynamic[String]("foo").get + // causing a compile error. + + // but, before fixing SI-6663, became + // C(42).selectDynamic("foo").get, ignoring + // the [String] type parameter + var v = new C(42).foo[String].get :Int // error + println(v) +} + |