Skip to content

Commit b712447

Browse files
authored
fix: don't consider into as a soft-modifier (#21924)
Closes #21786 Closes #21635
2 parents 1947828 + 04934b7 commit b712447

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

compiler/src/dotty/tools/dotc/parsing/Tokens.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ object Tokens extends TokensCommon {
297297

298298
final val closingParens = BitSet(RPAREN, RBRACKET, RBRACE)
299299

300-
final val softModifierNames = Set(nme.inline, nme.into, nme.opaque, nme.open, nme.transparent, nme.infix)
300+
final val softModifierNames = Set(nme.inline, nme.opaque, nme.open, nme.transparent, nme.infix)
301301

302302
def showTokenDetailed(token: Int): String = debugString(token)
303303

tests/neg/i21786.check

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- [E103] Syntax Error: tests/neg/i21786.scala:1:0 ---------------------------------------------------------------------
2+
1 |into class X // error
3+
|^^^^
4+
|Illegal start of toplevel definition
5+
|
6+
| longer explanation available when compiling with `-explain`

tests/neg/i21786.scala

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
into class X // error

tests/pos/i21635.scala

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class A(val into: Boolean) {
2+
def m1(): Any =
3+
into
4+
5+
def m2(): Int = 1
6+
}

0 commit comments

Comments
 (0)