Skip to content

Commit 70db293

Browse files
committed
Fix #7529: Don't drop modifiers when desugaring extension methods
1 parent ca6b1c6 commit 70db293

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ object desugar {
901901
mdef
902902
}
903903
else cpy.DefDef(mdef)(tparams = tparams ++ mdef.tparams, vparamss = leadingParams :: mdef.vparamss)
904-
.withFlags(Extension)
904+
.withMods(mdef.mods | Extension)
905905
case mdef: Import =>
906906
mdef
907907
case mdef =>

tests/neg/i7529.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
given fooOps: [A](a: A) with
2+
3+
@nonsense // error: not found: nonsense
4+
def foo = ???

0 commit comments

Comments
 (0)