Skip to content

Commit 2bc51b2

Browse files
committed
Fix scala#8717: Add missing extension span
1 parent 63ee630 commit 2bc51b2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3588,7 +3588,7 @@ object Parsers {
35883588
if !in.isNestedStart then syntaxError("Extension without extension methods")
35893589
val templ = templateBodyOpt(makeConstructor(tparams, vparamss), Nil, Nil)
35903590
templ.body.foreach(checkExtensionMethod(tparams, vparamss, _))
3591-
val edef = ModuleDef(name, templ)
3591+
val edef = atSpan(start, in.offset)(ModuleDef(name, templ))
35923592
finalizeDef(edef, addFlag(mods, Given | extensionFlag), start)
35933593
}
35943594

compiler/test-resources/repl/i8717

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
scala>extension { }
2+
1 |extension { }
3+
|^
4+
|anonymous instance must implement a type or have at least one extension method

0 commit comments

Comments
 (0)