Skip to content

Commit fcc753b

Browse files
dwijnandmbovel
andcommitted
Test term ref scrutinees aren't generally widened
Co-Authored-By: Matt Bovel <[email protected]>
1 parent 97dcf78 commit fcc753b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/neg/mt-scrutinee-widen.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// We widen scrutinee's that are inline proxies
2+
// But make sure that term refs in scrutinees are not widened in general
3+
4+
val x: Int = 42
5+
val y: Int = 43
6+
val z: Int = 44
7+
8+
type IsX[T] =
9+
T match
10+
case x.type => true
11+
case _ => false
12+
def test = summon[IsX[y.type] =:= IsX[z.type]] // error
13+
14+
def test2 = summon[
15+
(
16+
y.type match
17+
case x.type => true
18+
case _ => false
19+
) =:= (
20+
z.type match
21+
case x.type => true
22+
case _ => false
23+
)
24+
] // error

0 commit comments

Comments
 (0)