Skip to content

Conversation

@Lluc24
Copy link
Contributor

@Lluc24 Lluc24 commented Dec 4, 2025

Closes #22587: Implement Divergence Checking for Match Types

  • Addresses the issue where match type reduction relies on catching StackOverflowError to handle infinite recursion, which is unsafe and slow.
  • Adapts the "Open Implicits" divergence checking algorithm (from SIP-31) to ApplyTypes and MatchTypes.
  • Introduces a new Property in the Context to track the history of types currently being reduced.
  • Enforces termination by verifying that arguments of the Match Type do not increase in size compared to previous reductions in the history.
  • Returns a standard Error Type when divergence is detected.
@mbovel mbovel self-requested a review December 4, 2025 10:43
case AnyVal => Wrap[List[Int]]

@main def test03(): Unit =
val e1: Wrap[Int] = ??? // error
Copy link
Member

@bishabosha bishabosha Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List[Int] is not AnyVal , so then it stops there right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants