Skip to content

Commit 0ef70b2

Browse files
committed
Revert "Special error message for extension (...) with"
This reverts commit 1173fcc.
1 parent f9c37a3 commit 0ef70b2

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3619,11 +3619,8 @@ object Parsers {
36193619
isUsingClause(extParams)
36203620
do ()
36213621
leadParamss ++= paramClauses(givenOnly = true, numLeadParams = nparams)
3622-
if in.token == WITH then
3623-
syntaxError(
3624-
i"""No `with` expected here.
3625-
|
3626-
|An extension clause is simply followed by one or more method definitions.""")
3622+
if in.token == COLON then
3623+
syntaxError("no `:` expected here")
36273624
in.nextToken()
36283625
val methods =
36293626
if isDefIntro(modifierTokens) then

tests/neg/extension-colon.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Error: tests/neg/extension-colon.scala:1:18 -------------------------------------------------------------------------
2+
1 |extension (x: Int): // error
3+
| ^
4+
| no `:` expected here

tests/neg/extension-colon.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
extension (x: Int): // error
2+
def foo = x

tests/neg/extension-with.check

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/neg/extension-with.scala

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)