Skip to content

Conversation

WojciechMazur
Copy link
Contributor

Backports #23834 to the 3.7.4.

PR submitted by the release tooling.
[skip ci]

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.

[Cherry-picked 5975a06]
For some reason, the derivesFrom issue was only observable in the minimization.
The original test case diverges similarly to the previous description,
but only when attempting normalizing during CodeGen...

[Cherry-picked 43af511]
Base automatically changed from release-3.7.4_backport-23813 to release-3.7.4 September 22, 2025 10:16
@WojciechMazur WojciechMazur merged commit 532315e into release-3.7.4 Sep 22, 2025
48 checks passed
@WojciechMazur WojciechMazur deleted the release-3.7.4_backport-23834 branch September 22, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants