Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix upper bound constraints, that are higher-kinded (#16744)
When recording an upper bound, when it's a some higher-kinded type variable applied to some type arguments, TypeComparer was re-applying the type arguments to the type parameter (the type variable's origin). Meaning that the instantiation of the type variable won't reflect in the upper bound. See the error message: `F$1[Int]` correctly appears as the lower bound, but `F$1[Int]` isn't the upper bound, `F[Int]` is, which is the original type parameter, in `Foo.Bar.apply[F](..)`. -- [E007] Type Mismatch Error: i12478.scala:8:13 ------------------------------- 8 | Foo.Bar(fu1) | ^^^^^^^^^^^^ |Found: Foo.Bar[F$1] |Required: Foo[T1] | |where: F$1 is a type in method id1 with bounds <: [_] =>> Any | T1 is a type in method id1 with bounds >: F$1[Int] and <: F[Int] | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: i12478.scala:18:13 ------------------------------ 18 | Foo.Bar(fu3) | ^^^^^^^^^^^^ |Found: Foo.Bar[F$2] |Required: Foo[T3] | |where: F$2 is a type in method id3 with bounds <: [_] =>> Any | T3 is a type in method id3 with bounds >: F$2[Int] and <: F[Int] | | longer explanation available when compiling with `-explain`
- Loading branch information