@@ -3582,17 +3582,19 @@ object Parsers {
3582
3582
def extensionDef (start : Offset , mods : Modifiers ): ModuleDef =
3583
3583
in.nextToken()
3584
3584
val name = if isIdent && ! isIdent(nme.on) then ident() else EmptyTermName
3585
- if ! isIdent(nme.on) then syntaxErrorOrIncomplete(" `on` expected" )
3586
- if isIdent(nme.on) then in.nextToken()
3587
- val tparams = typeParamClauseOpt(ParamOwner .Def )
3588
- val extParams = paramClause(0 , prefix = true )
3589
- val givenParamss = paramClauses(givenOnly = true )
3590
- possibleTemplateStart()
3591
- if ! in.isNestedStart then syntaxError(" Extension without extension methods" )
3592
- val templ = templateBodyOpt(makeConstructor(tparams, extParams :: givenParamss), Nil , Nil )
3593
- templ.body.foreach(checkExtensionMethod(tparams, _))
3594
- val edef = ModuleDef (name, templ)
3595
- finalizeDef(edef, addFlag(mods, Given ), start)
3585
+ in.endMarkerScope(if name.isEmpty then nme.extension else name) {
3586
+ if ! isIdent(nme.on) then syntaxErrorOrIncomplete(" `on` expected" )
3587
+ if isIdent(nme.on) then in.nextToken()
3588
+ val tparams = typeParamClauseOpt(ParamOwner .Def )
3589
+ val extParams = paramClause(0 , prefix = true )
3590
+ val givenParamss = paramClauses(givenOnly = true )
3591
+ possibleTemplateStart()
3592
+ if ! in.isNestedStart then syntaxError(" Extension without extension methods" )
3593
+ val templ = templateBodyOpt(makeConstructor(tparams, extParams :: givenParamss), Nil , Nil )
3594
+ templ.body.foreach(checkExtensionMethod(tparams, _))
3595
+ val edef = ModuleDef (name, templ)
3596
+ finalizeDef(edef, addFlag(mods, Given ), start)
3597
+ }
3596
3598
3597
3599
/* -------- TEMPLATES ------------------------------------------- */
3598
3600
0 commit comments