scala3
scala3 copied to clipboard
i22587 Divergence check for Match Types
Closes #22587: Implement Divergence Checking for Match Types
- Addresses the issue where match type reduction relies on catching
StackOverflowErrorto handle infinite recursion, which is unsafe and slow. - Adapts the "Open Implicits" divergence checking algorithm (from SIP-31) to
ApplyTypesandMatchTypes. - Introduces a new
Propertyin theContextto 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 Typewhen divergence is detected.