Skip to content

Commit 4c13c95

Browse files
committed
Fix #7529: Don't drop modifiers when desugaring extension methods
1 parent 4d66d32 commit 4c13c95

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
@@ -904,7 +904,7 @@ object desugar {
904904
else cpy.DefDef(mdef)(
905905
tparams = tparams ++ mdef.tparams,
906906
vparamss = leadingParams :: givenParamss ::: mdef.vparamss
907-
).withFlags(Extension)
907+
).withMods(mdef.mods | Extension)
908908
case mdef: Import =>
909909
mdef
910910
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)