diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/patmatexhaust.check | 6 | ||||
-rw-r--r-- | test/files/neg/t5845.check | 7 | ||||
-rw-r--r-- | test/files/neg/t5845.scala | 16 | ||||
-rw-r--r-- | test/files/pos/exhaustive_heuristics.scala | 12 | ||||
-rw-r--r-- | test/files/pos/value-class-override-no-spec.flags | 1 | ||||
-rw-r--r-- | test/files/pos/value-class-override-no-spec.scala | 9 | ||||
-rw-r--r-- | test/files/pos/value-class-override-spec.scala | 9 |
7 files changed, 54 insertions, 6 deletions
diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 6172811e13..1168f36e11 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -18,10 +18,6 @@ patmatexhaust.scala:53: error: match may not be exhaustive. It would fail on the following input: Gp() def ma5(x:Deep) = x match { ^ -patmatexhaust.scala:59: error: match may not be exhaustive. -It would fail on the following input: Nil - def ma6() = List(1,2) match { // give up - ^ patmatexhaust.scala:75: error: match may not be exhaustive. It would fail on the following input: B() def ma9(x: B) = x match { @@ -38,4 +34,4 @@ patmatexhaust.scala:126: error: match may not be exhaustive. It would fail on the following input: C1() def ma10(x: C) = x match { // not exhaustive: C1 is not abstract. ^ -10 errors found +9 errors found diff --git a/test/files/neg/t5845.check b/test/files/neg/t5845.check new file mode 100644 index 0000000000..8c6100d6de --- /dev/null +++ b/test/files/neg/t5845.check @@ -0,0 +1,7 @@ +t5845.scala:9: error: value +++ is not a member of Int + println(5 +++ 5) + ^ +t5845.scala:15: error: value +++ is not a member of Int + println(5 +++ 5) + ^ +two errors found diff --git a/test/files/neg/t5845.scala b/test/files/neg/t5845.scala new file mode 100644 index 0000000000..823c722c14 --- /dev/null +++ b/test/files/neg/t5845.scala @@ -0,0 +1,16 @@ +class Num[T] { + def mkOps = new Ops + class Ops { def +++(rhs: T) = () } +} + +class A { + implicit def infixOps[T, CC[X] <: Num[X]](lhs: T)(implicit num: CC[T]) = num.mkOps + implicit val n1 = new Num[Int] { } + println(5 +++ 5) +} + +class B { + implicit def infixOps[T, CC[X] <: Num[X]](lhs: T)(implicit num: CC[T]) : CC[T]#Ops = num.mkOps + implicit val n1 = new Num[Int] {} + println(5 +++ 5) +} diff --git a/test/files/pos/exhaustive_heuristics.scala b/test/files/pos/exhaustive_heuristics.scala index f6bea455a5..297900510b 100644 --- a/test/files/pos/exhaustive_heuristics.scala +++ b/test/files/pos/exhaustive_heuristics.scala @@ -12,5 +12,15 @@ object Test { case _ if turnOffChecks => } - // TODO: we back off when there are any user-defined extractors + // we back off when there are any user-defined extractors + // in fact this is exhaustive, but we pretend we don't know since List's unapplySeq is not special to the compiler + // to compensate our ignorance, we back off + // well, in truth, we do rewrite List() to Nil, but otherwise we do nothing + // the full rewrite List(a, b) to a :: b :: Nil, for example is planned (but not sure it's a good idea) + List(true, false) match { + case List(_, _, _*) => + case List(node, _*) => + case Nil => + } + }
\ No newline at end of file diff --git a/test/files/pos/value-class-override-no-spec.flags b/test/files/pos/value-class-override-no-spec.flags new file mode 100644 index 0000000000..a7e64e4f0c --- /dev/null +++ b/test/files/pos/value-class-override-no-spec.flags @@ -0,0 +1 @@ +-no-specialization
\ No newline at end of file diff --git a/test/files/pos/value-class-override-no-spec.scala b/test/files/pos/value-class-override-no-spec.scala new file mode 100644 index 0000000000..79de5d9305 --- /dev/null +++ b/test/files/pos/value-class-override-no-spec.scala @@ -0,0 +1,9 @@ +// There are two versions of this tests: one with and one without specialization. +// The bug was only exposed *without* specialization. +trait T extends Any { + def x: Any +} + +final class StringOps(val repr0: String) extends AnyVal with T { + def x = () +} diff --git a/test/files/pos/value-class-override-spec.scala b/test/files/pos/value-class-override-spec.scala new file mode 100644 index 0000000000..79de5d9305 --- /dev/null +++ b/test/files/pos/value-class-override-spec.scala @@ -0,0 +1,9 @@ +// There are two versions of this tests: one with and one without specialization. +// The bug was only exposed *without* specialization. +trait T extends Any { + def x: Any +} + +final class StringOps(val repr0: String) extends AnyVal with T { + def x = () +} |