Commit 5975a06
committed
Fix
Before the addition of `SymDenotation#mayDeriveFrom`,
tests/neg/i17132.min.scala was unsoundly accepted without a type error
because `R[T]` is reduced to `Any` where `T <: P[Any]`
by testing `provablyDisjointClasses` before `P` is added as a baseClass of `Q`.
Now, a recursion overflows occurs because:
- reducing `R[T] := T match case Q[t] => R[t]; case ...` requires
- proving `T` disjoint from `Q[t]` where `T <: P[Any]`, which asks
- whether existsCommonBaseTypeWithDisjointArguments, which requires
- normalizing the type arg to the base class P for the class Q, i.e. R[t]
- ...
In short, despite the use of the pending set in provablyDisjoint, diverging is
still possible when there is "cycle" in the type arguments in the base classes,
(and where the pending set is thus reset for a separate normalization problem).
One could attempt to add some more logic to detect these loops
s.t. they are considered "stuck", as opposed to reporting an error.
But it isn't clear that there are any concrete motivations for this.derivesFrom false negative in provablyDisjointClasses
1 parent ee2f641 commit 5975a06
File tree
4 files changed
+52
-1
lines changed- compiler/src/dotty/tools/dotc/core
- tests/neg
4 files changed
+52
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
865 | 865 | | |
866 | 866 | | |
867 | 867 | | |
| 868 | + | |
868 | 869 | | |
869 | 870 | | |
870 | 871 | | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
871 | 882 | | |
872 | 883 | | |
873 | 884 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3230 | 3230 | | |
3231 | 3231 | | |
3232 | 3232 | | |
3233 | | - | |
| 3233 | + | |
3234 | 3234 | | |
3235 | 3235 | | |
3236 | 3236 | | |
| |||
| 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 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments