diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 4b687e222ae3..8ff0a7d83dc8 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -3876,6 +3876,8 @@ object Types { x.declaredVariance == y.declaredVariance)) && { val bs1 = new BinderPairs(this, that, bs) + // `paramInfos` and `resType` might still be uninstantiated at this point + paramInfos != null && resType != null && paramInfos.equalElements(that.paramInfos, bs1) && resType.equals(that.resType, bs1) } diff --git a/tests/neg/i13513.scala b/tests/neg/i13513.scala new file mode 100644 index 000000000000..637f432ca504 --- /dev/null +++ b/tests/neg/i13513.scala @@ -0,0 +1,5 @@ +final case class TwoTypes[F, A](value: A) +class Minimal { + def x[C[_]]: C[Int] = ??? + x[TwoTypes].value // error: Type argument TwoTypes does not conform to upper bound [_] =>> Any +}