Skip to content

Commit b456c1b

Browse files
stable identifiers test
1 parent 9ffa984 commit b456c1b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,4 +1605,23 @@ class ErrorMessagesTests extends ErrorMessagesTest {
16051605
message.msg
16061606
)
16071607
}
1608+
1609+
@Test def StableIdentifiers() =
1610+
checkMessagesAfter(FrontEnd.name) {
1611+
"""
1612+
| object Test {
1613+
| var x = 2
1614+
| def test = 2 match {
1615+
| case `x` => x + 1
1616+
| }
1617+
| }
1618+
""".stripMargin
1619+
}.expect { (_, messages) =>
1620+
assertMessageCount(1, messages)
1621+
val message = message.head
1622+
assertTrue(message.isInstanceOf[StableIdentPattern])
1623+
assertEquals(
1624+
"Stable identifier required, but `x` found"
1625+
)
1626+
}
16081627
}

0 commit comments

Comments
 (0)