@@ -1923,7 +1923,12 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
1923
1923
|| symInfo.isInstanceOf [MethodType ]
1924
1924
&& symInfo.signature.consistentParams(info2.signature)
1925
1925
1926
- def tp1IsSingleton : Boolean = tp1.isInstanceOf [SingletonType ]
1926
+ def allowGadt : Boolean =
1927
+ def rec (tp : Type ): Boolean = tp match
1928
+ case RefinedType (parent, name1, _) => name == name1 || rec(parent)
1929
+ case tp : TypeRef => tp.symbol.isClass
1930
+ case _ => false
1931
+ ! approx.low && rec(tp1)
1927
1932
1928
1933
// A relaxed version of isSubType, which compares method types
1929
1934
// under the standard arrow rule which is contravarient in the parameter types,
@@ -1939,8 +1944,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
1939
1944
matchingMethodParams(info1, info2, precise = false )
1940
1945
&& isSubInfo(info1.resultType, info2.resultType.subst(info2, info1), symInfo1.resultType)
1941
1946
&& sigsOK(symInfo1, info2)
1942
- case _ => inFrozenGadtIf(tp1IsSingleton ) { isSubType(info1, info2) }
1943
- case _ => inFrozenGadtIf(tp1IsSingleton ) { isSubType(info1, info2) }
1947
+ case _ => inFrozenGadtIf(! allowGadt ) { isSubType(info1, info2) }
1948
+ case _ => inFrozenGadtIf(! allowGadt ) { isSubType(info1, info2) }
1944
1949
1945
1950
def qualifies (m : SingleDenotation ): Boolean =
1946
1951
val info1 = m.info.widenExpr
0 commit comments