From fcc753b081c9f3ac11021a5a8838728e2c04ed4d Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Fri, 23 Jun 2023 16:27:07 +0100 Subject: [PATCH] Test term ref scrutinees aren't generally widened Co-Authored-By: Matt Bovel --- tests/neg/mt-scrutinee-widen.scala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/neg/mt-scrutinee-widen.scala diff --git a/tests/neg/mt-scrutinee-widen.scala b/tests/neg/mt-scrutinee-widen.scala new file mode 100644 index 000000000000..b9cb5c8769f4 --- /dev/null +++ b/tests/neg/mt-scrutinee-widen.scala @@ -0,0 +1,24 @@ +// We widen scrutinee's that are inline proxies +// But make sure that term refs in scrutinees are not widened in general + +val x: Int = 42 +val y: Int = 43 +val z: Int = 44 + +type IsX[T] = + T match + case x.type => true + case _ => false +def test = summon[IsX[y.type] =:= IsX[z.type]] // error + +def test2 = summon[ + ( + y.type match + case x.type => true + case _ => false + ) =:= ( + z.type match + case x.type => true + case _ => false + ) +] // error