From 04934b77546bb2d1c64a702752161d2808db0610 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Mon, 11 Nov 2024 17:48:35 +0100 Subject: [PATCH] fix: don't consider `into` as a soft-modifier Co-authored-by: kasiaMarek Co-authored-by: KacperFKorban --- compiler/src/dotty/tools/dotc/parsing/Tokens.scala | 2 +- tests/neg/i21786.check | 6 ++++++ tests/neg/i21786.scala | 1 + tests/pos/i21635.scala | 6 ++++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/neg/i21786.check create mode 100644 tests/neg/i21786.scala create mode 100644 tests/pos/i21635.scala diff --git a/compiler/src/dotty/tools/dotc/parsing/Tokens.scala b/compiler/src/dotty/tools/dotc/parsing/Tokens.scala index b0a533b2f1df..c78a336ecdf5 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Tokens.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Tokens.scala @@ -297,7 +297,7 @@ object Tokens extends TokensCommon { final val closingParens = BitSet(RPAREN, RBRACKET, RBRACE) - final val softModifierNames = Set(nme.inline, nme.into, nme.opaque, nme.open, nme.transparent, nme.infix) + final val softModifierNames = Set(nme.inline, nme.opaque, nme.open, nme.transparent, nme.infix) def showTokenDetailed(token: Int): String = debugString(token) diff --git a/tests/neg/i21786.check b/tests/neg/i21786.check new file mode 100644 index 000000000000..47f7e2456c3d --- /dev/null +++ b/tests/neg/i21786.check @@ -0,0 +1,6 @@ +-- [E103] Syntax Error: tests/neg/i21786.scala:1:0 --------------------------------------------------------------------- +1 |into class X // error + |^^^^ + |Illegal start of toplevel definition + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg/i21786.scala b/tests/neg/i21786.scala new file mode 100644 index 000000000000..c5bb9c595d32 --- /dev/null +++ b/tests/neg/i21786.scala @@ -0,0 +1 @@ +into class X // error diff --git a/tests/pos/i21635.scala b/tests/pos/i21635.scala new file mode 100644 index 000000000000..dc0a8314c7d8 --- /dev/null +++ b/tests/pos/i21635.scala @@ -0,0 +1,6 @@ +class A(val into: Boolean) { + def m1(): Any = + into + + def m2(): Int = 1 +}