Commit 609e40e
committed
Make forwardTypeParams configurable
A new setting, -Ysuppress-param-forwarding is used
to make forwarding type parameters confihurable.
Forwarding type parameters from base class to subclass instance
is done in `normalizeToClassRefs` for optimization, but I just found
out this optimization is not always type-preserving and in fact can
lead to type errors.
SortedMap.scala in the collection strawman is an example. With parameter
forwarding enabled, we get:
Error: immutable/SortedMap.scala --------------------------------------------
| with MapValuePolyTransforms[K, V, C] {
| ^
|Type argument C does not conform to upper bound [=X, +Y] =>
| strawman.collection.immutable.Map[=X, +Y] &
| strawman.collection.immutable.MapValuePolyTransforms[=X', +Y', LazyRef(C)]
|
|where: +Y is a type variable
| +Y' is a type variable
| =X is a type variable
| =X' is a type variable
If we turn off forwarding with the option, the strawman compiles OK.
Unfortunately turning the option off altogether does not work (yet).
It leads to increased compile times, and more tests fail with deep subtype
recursions. Dotty bootstrap seems to not terminate at all.
Related: Refine notion of self in RefChecks. This is
Needed to make pos/i1401.scala compile when forwardTypeParams is off.
# Conflicts:
# compiler/src/dotty/tools/dotc/typer/RefChecks.scala1 parent 6c21f08 commit 609e40e
File tree
5 files changed
+9
-4
lines changed- compiler/src/dotty/tools/dotc
- config
- core
- tests/pos
5 files changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
| 342 | + | |
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3030 | 3030 | | |
3031 | 3031 | | |
3032 | 3032 | | |
| 3033 | + | |
| 3034 | + | |
3033 | 3035 | | |
3034 | 3036 | | |
3035 | 3037 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments