From 42e0f73311cfaf0883b85a1a41f400c3eb3cae96 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Fri, 16 Aug 2013 11:30:33 +0200 Subject: SI-7716 Exclude patmat synthetics from bounds checking Consider this pattern match translation, that occurs *before* refchecks: scala> val e: java.lang.Enum[_] = java.util.concurrent.TimeUnit.SECONDS scala> e match { case x => x } :9: error: type arguments [_$1] do not conform to class Enum's type parameter bounds [E <: Enum[E]] e match { case x => x } ^ [[syntax trees at end of refchecks]] // package $line5 { case val x1: Enum[_$1] = $line3.$read.$iw.$iw.e; case4(){ matchEnd3(x1) }; matchEnd3(x: Enum[_$1]){ x } RefChecks turns a blind eye to the non-conformant type `Enum[_$1]` in the label defs because of `65340ed4ad2e`. (Incidentally, that is far too broad, as I've noted in SI-7756.) This commit extends this exception to cover the synthetic ValDef `x1`. Commit log watchers might notice the similarities to SI-7694. --- test/files/pos/t7716.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/files/pos/t7716.scala (limited to 'test') diff --git a/test/files/pos/t7716.scala b/test/files/pos/t7716.scala new file mode 100644 index 0000000000..40117051ed --- /dev/null +++ b/test/files/pos/t7716.scala @@ -0,0 +1,16 @@ +object Test { + def test: Unit = { + val e: java.lang.Enum[_] = java.util.concurrent.TimeUnit.SECONDS + e match { case x => println(x) } + + + trait TA[X <: CharSequence] + val ta: TA[_] = new TA[String] {} + + ta match { + case _ => println("hi") + } + + def f(ta: TA[_]) = ta match { case _ => "hi" } + } +} -- cgit v1.2.3