Commit 2dec682
authored
AppliedTypes returned by baseType shouldn't have type lambdas as constructors (#17071)
AppliedTypes returned by baseType shouldn't have type lambdas as
constructors
In tests/pos/argDenot-alpakka.min.scala, we want
`(([O] =>> Foo[O, S]) @UV)[Int]`.baseType(`Foo`)
to return `Foo[Int]` rather than an applied type lambda, so that we can
rely on
the invariant that the type arguments of the type returned by
baseType(cls)
correspond to the type parameter of cls which `NamedType#argDenot` is
implicitly
relying on.
This could be achieved by removing the initial if branch from the
AppliedType
case in baseTypeOf, since the recursive fallback will always work, but
it makes
sense to keep a special case for performance, so we just explicitly add
as a
condition to the fast-path that the type constructor of the AppliedType
can't be
a lambda.File tree
3 files changed
+32
-3
lines changed- compiler/src/dotty/tools/dotc/core
- tests/pos
3 files changed
+32
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2226 | 2226 | | |
2227 | 2227 | | |
2228 | 2228 | | |
2229 | | - | |
2230 | | - | |
| 2229 | + | |
| 2230 | + | |
2231 | 2231 | | |
2232 | 2232 | | |
2233 | 2233 | | |
2234 | 2234 | | |
2235 | | - | |
2236 | 2235 | | |
2237 | 2236 | | |
2238 | 2237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments