Skip to content

Commit 1079192

Browse files
committed
Relax double definition check for inline methods
If one of the methods is an inline method that is not retained, no need to report a double definition.
1 parent ac1e0b5 commit 1079192

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,15 @@ class ElimErasedValueType extends MiniPhase with InfoTransformer { thisPhase =>
107107
(sym1.owner.derivesFrom(defn.PolyFunctionClass) ||
108108
sym2.owner.derivesFrom(defn.PolyFunctionClass))
109109

110+
def oneErasedInline =
111+
sym1.isInlineMethod && !sym1.isRetainedInlineMethod
112+
|| sym2.isInlineMethod && !sym2.isRetainedInlineMethod
113+
110114
// super-accessors start as private, and their expanded name can clash after
111115
// erasure. TODO: Verify that this is OK.
112116
def bothSuperAccessors = sym1.name.is(SuperAccessorName) && sym2.name.is(SuperAccessorName)
113-
if (sym1.name != sym2.name && !bothSuperAccessors ||
114-
!info1.matchesLoosely(info2) && !bothPolyApply)
117+
if (sym1.name != sym2.name && !bothSuperAccessors
118+
|| !info1.matchesLoosely(info2) && !bothPolyApply && !oneErasedInline)
115119
report.error(DoubleDefinition(sym1, sym2, root), root.srcPos)
116120
}
117121
while (opc.hasNext) {

0 commit comments

Comments
 (0)