From 4eaab9b2efe9bb3c78782ccbd10cdea6ad77fc64 Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Mon, 8 Jun 2020 15:32:03 +0200 Subject: [PATCH 1/2] fix #8956: add regression test --- tests/pos/i8956.scala | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/pos/i8956.scala diff --git a/tests/pos/i8956.scala b/tests/pos/i8956.scala new file mode 100644 index 000000000000..d35fb2bc84df --- /dev/null +++ b/tests/pos/i8956.scala @@ -0,0 +1,22 @@ +type Numeric = Double | Int + +val v1 = 100 +val v2 = 100.0 +def check1(i: Double | Int | String): Unit = { + i match { + case a:(Double | Int) => println(s"numeric = $a") + case _ => println("categorical") + } +} +/* + [warn] 25 | case a:Numeric => println(s"numeric = $a") + [warn] | ^^^^^^^^^ + [warn] | the type test for gg.SlidingIssue.Numeric cannot be checked at runtime + [warn] one warning found + */ +def check2(i: Double | Int | String): Unit = { + i match { + case a:Numeric => println(s"numeric = $a") + case _ => println("categorical") + } +} From 7309b35f4d65a98602c16a46d58ffd48f448f62d Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Mon, 8 Jun 2020 16:00:26 +0200 Subject: [PATCH 2/2] move test to be fatal-warnings --- tests/{pos => pos-special/fatal-warnings}/i8956.scala | 6 ------ 1 file changed, 6 deletions(-) rename tests/{pos => pos-special/fatal-warnings}/i8956.scala (62%) diff --git a/tests/pos/i8956.scala b/tests/pos-special/fatal-warnings/i8956.scala similarity index 62% rename from tests/pos/i8956.scala rename to tests/pos-special/fatal-warnings/i8956.scala index d35fb2bc84df..6b935946de17 100644 --- a/tests/pos/i8956.scala +++ b/tests/pos-special/fatal-warnings/i8956.scala @@ -8,12 +8,6 @@ def check1(i: Double | Int | String): Unit = { case _ => println("categorical") } } -/* - [warn] 25 | case a:Numeric => println(s"numeric = $a") - [warn] | ^^^^^^^^^ - [warn] | the type test for gg.SlidingIssue.Numeric cannot be checked at runtime - [warn] one warning found - */ def check2(i: Double | Int | String): Unit = { i match { case a:Numeric => println(s"numeric = $a")