Commit bd5c3b9
committed
Rework variances of higher-kinded types
Decouple variances from type lambdas. A type lambda is just
a function from types to types, it does not have a declared
parameter variance. Of course, the variance of a type parameter
can be determined by tracking occurrences of the parameter
on the right hand side. That's a structural criterion, not
a user-defined one.
Intead of storing variances in type lambdas, store them in
TypeBounds types. A non-alias type bound can have a declared
parameter variance.
The hope is that this change clarifies things conceptually
and addresses tricky type inference problems that involve
type aliases.
First commit: Change TypeBounds data structures so that they can
contain type parameter variances.1 parent b96a026 commit bd5c3b9
File tree
4 files changed
+43
-5
lines changed- compiler/src/dotty/tools/dotc/core
- tasty
- tasty/src/dotty/tools/tasty
4 files changed
+43
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4251 | 4251 | | |
4252 | 4252 | | |
4253 | 4253 | | |
| 4254 | + | |
| 4255 | + | |
| 4256 | + | |
| 4257 | + | |
| 4258 | + | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
4254 | 4262 | | |
4255 | 4263 | | |
4256 | 4264 | | |
| |||
4296 | 4304 | | |
4297 | 4305 | | |
4298 | 4306 | | |
4299 | | - | |
| 4307 | + | |
4300 | 4308 | | |
4301 | 4309 | | |
4302 | 4310 | | |
4303 | 4311 | | |
4304 | 4312 | | |
4305 | | - | |
| 4313 | + | |
4306 | 4314 | | |
4307 | 4315 | | |
4308 | 4316 | | |
4309 | 4317 | | |
4310 | 4318 | | |
4311 | 4319 | | |
| 4320 | + | |
| 4321 | + | |
| 4322 | + | |
| 4323 | + | |
| 4324 | + | |
| 4325 | + | |
| 4326 | + | |
| 4327 | + | |
| 4328 | + | |
| 4329 | + | |
| 4330 | + | |
| 4331 | + | |
| 4332 | + | |
| 4333 | + | |
| 4334 | + | |
| 4335 | + | |
| 4336 | + | |
| 4337 | + | |
| 4338 | + | |
| 4339 | + | |
| 4340 | + | |
| 4341 | + | |
4312 | 4342 | | |
4313 | 4343 | | |
4314 | 4344 | | |
| |||
4352 | 4382 | | |
4353 | 4383 | | |
4354 | 4384 | | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
4355 | 4388 | | |
4356 | 4389 | | |
4357 | 4390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
238 | 242 | | |
239 | 243 | | |
240 | 244 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | | - | |
| 158 | + | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| |||
0 commit comments