diff options
author | Martin Odersky <odersky@gmail.com> | 2010-04-12 11:52:39 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2010-04-12 11:52:39 +0000 |
commit | cfe47e4b74cc166af31cc130b0830112c46bdc61 (patch) | |
tree | 7716cb0c8cb0179f0b09328779e0c2ac06621025 /test/files/neg | |
parent | bed1ffb1c357e09c05ea6a58bd19a75510f1822e (diff) | |
download | scala-cfe47e4b74cc166af31cc130b0830112c46bdc61.tar.gz scala-cfe47e4b74cc166af31cc130b0830112c46bdc61.tar.bz2 scala-cfe47e4b74cc166af31cc130b0830112c46bdc61.zip |
Closes #3224. Review by retronym.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t3224.check | 6 | ||||
-rwxr-xr-x | test/files/neg/t3224.scala | 30 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/files/neg/t3224.check b/test/files/neg/t3224.check new file mode 100644 index 0000000000..de196f15be --- /dev/null +++ b/test/files/neg/t3224.check @@ -0,0 +1,6 @@ +/home/odersky/workspace/scala/test/files/neg/t3224.scala:29: error: polymorphic expression cannot be instantiated to expected type; + found : [T]Array[T] + required: List[?] + println(Texts textL Array()); println(Texts textL Array(1)); println(Texts textL Array(1, 1)) + ^ +one error found diff --git a/test/files/neg/t3224.scala b/test/files/neg/t3224.scala new file mode 100755 index 0000000000..0e24baf28a --- /dev/null +++ b/test/files/neg/t3224.scala @@ -0,0 +1,30 @@ +object Texts{ + def textL[T](list: List[T]) = { + list match{ + case List() => "Empty" + case List(_) => "One" + case List(_*) => "Many" + } + } + + def textA[T](array: Array[T]) = { + array match{ + case Array() => "Empty" + case Array(_) => "One" + case Array(_*) => "Many" + } + } +} + +object Test extends Application { + + implicit def array2list[T](array: Array[T]) = { + println(array.toList.size) + array.toList + } + + + println(Texts textL List()); println(Texts textL List(1)); println(Texts textL List(1, 1)); + + println(Texts textL Array()); println(Texts textL Array(1)); println(Texts textL Array(1, 1)) +} |