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) +}