diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index a7dec8281d89..f170304d20d4 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -1899,7 +1899,9 @@ object SymDenotations { * someone does a findMember on a subclass. */ def delete(sym: Symbol)(using Context): Unit = { - info.decls.openForMutations.unlink(sym) + val scope = info.decls.openForMutations + scope.unlink(sym, sym.name) + if sym.name != sym.originalName then scope.unlink(sym, sym.originalName) if (myMemberCache != null) myMemberCache.remove(sym.name) if (!sym.flagsUNSAFE.is(Private)) invalidateMemberNamesCache() } diff --git a/tests/pos/i11731.scala b/tests/pos/i11731.scala new file mode 100644 index 000000000000..bef8fdef00f4 --- /dev/null +++ b/tests/pos/i11731.scala @@ -0,0 +1,5 @@ +import scala.annotation.targetName + +trait Example: + @targetName("funfun") + inline def fun: Unit = ???