@@ -2041,8 +2041,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
20412041 else if (! tp2.exists) tp1
20422042 else if tp1.isAny && ! tp2.isLambdaSub || tp1.isAnyKind || isBottom(tp2) then tp2
20432043 else if tp2.isAny && ! tp1.isLambdaSub || tp2.isAnyKind || isBottom(tp1) then tp1
2044- else if tp1.isFromJavaObject && ! tp2.isLambdaSub then tp2
2045- else if tp2.isFromJavaObject && ! tp1.isLambdaSub then tp1
2044+ else if tp1.containsFromJavaObject && ! tp2.isLambdaSub then
2045+ tp2 // If tp1 is FromJavaObject or a union containing FromJavaObject, tp2 <:< tp1
2046+ else if tp2.containsFromJavaObject && ! tp1.isLambdaSub then
2047+ tp1 // Similarly, tp1 <:< tp2
20462048 else tp2 match
20472049 case tp2 : LazyRef =>
20482050 glb(tp1, tp2.ref)
@@ -2091,8 +2093,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
20912093 if (tp1 eq tp2) tp1
20922094 else if (! tp1.exists) tp1
20932095 else if (! tp2.exists) tp2
2094- else if tp1.isFromJavaObject && ! tp2.isLambdaSub then tp1
2095- else if tp2.isFromJavaObject && ! tp1.isLambdaSub then tp2
2096+ else if tp1.containsFromJavaObject && ! tp2.isLambdaSub then
2097+ tp1 // If tp1 is FromJavaObject or a union containing FromJavaObject, tp2 <:< tp1
2098+ else if tp2.containsFromJavaObject && ! tp1.isLambdaSub then
2099+ tp2 // Similarly, tp1 <:< tp2
20962100 else if tp1.isAny && ! tp2.isLambdaSub || tp1.isAnyKind || isBottom(tp2) then tp1
20972101 else if tp2.isAny && ! tp1.isLambdaSub || tp2.isAnyKind || isBottom(tp1) then tp2
20982102 else
0 commit comments