From 4a47296dd903129988430055c76013e560b22a00 Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Wed, 28 Feb 2018 05:14:00 +0100 Subject: [PATCH] Fix #1828: add test --- tests/neg-custom-args/isInstanceOf/1828.scala | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/neg-custom-args/isInstanceOf/1828.scala diff --git a/tests/neg-custom-args/isInstanceOf/1828.scala b/tests/neg-custom-args/isInstanceOf/1828.scala new file mode 100644 index 000000000000..aeb83f1a1070 --- /dev/null +++ b/tests/neg-custom-args/isInstanceOf/1828.scala @@ -0,0 +1,9 @@ +class Test { + def remove[S](a: S | Int, f: Int => S):S = a match { + case a: S => a // error + case a: Int => f(a) + } + + val t: Int | String = 5 + val t1 = remove[String](t, _.toString) +}