Skip to content

Commit c6132fa

Browse files
committed
Merge only method types of the same kind
Merge only method types that have the same companion
1 parent ffc5b6f commit c6132fa

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler/src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,8 @@ object Denotations {
624624
tp2 match {
625625
case tp2: PolyType =>
626626
tp1
627-
case tp2: MethodType if ctx.typeComparer.matchingMethodParams(tp1, tp2) &&
628-
tp1.isImplicitMethod == tp2.isImplicitMethod =>
627+
case tp2: MethodType
628+
if ctx.typeComparer.matchingMethodParams(tp1, tp2) && (tp1.companion eq tp2.companion) =>
629629
tp1.derivedLambdaType(
630630
mergeParamNames(tp1, tp2),
631631
tp1.paramInfos,
@@ -683,8 +683,7 @@ object Denotations {
683683
case tp1: MethodType =>
684684
tp2 match {
685685
case tp2: MethodType
686-
if ctx.typeComparer.matchingMethodParams(tp1, tp2) &&
687-
tp1.isImplicitMethod == tp2.isImplicitMethod =>
686+
if ctx.typeComparer.matchingMethodParams(tp1, tp2) && (tp1.companion eq tp2.companion) =>
688687
tp1.derivedLambdaType(
689688
mergeParamNames(tp1, tp2),
690689
tp1.paramInfos,

0 commit comments

Comments
 (0)