Skip to content

Conversation

@lihaoyi
Copy link
Contributor

@lihaoyi lihaoyi commented Jan 10, 2026

Attempts to fix #24588, vibe coded

From claude

Problem: Inline match with string interpolation failed because StringContext.s (and other interpolators) are macros marked with the Erased flag. The code checking for erased values in inline match scrutinees incorrectly treated macro calls as erased values.

Root Cause: Commit 7f9b4be changed the check from specifically looking for compiletime.erasedValue to a general _.symbol.isErased check. This broader check caught macros which have the Erased flag but are not truly erased values.

Fix: Added a helper function isTrulyErased that excludes macros:
def isTrulyErased(sym: Symbol): Boolean =
sym.isErased && !sym.is(Macro)

Files Changed:

  • compiler/src/dotty/tools/dotc/inlines/InlineReducer.scala - Added isTrulyErased check
  • tests/pos/i24588.scala - Comprehensive test cases

Verified:

  • New test i24588.scala passes (was failing before)
  • Existing test i23406.scala still correctly reports errors for compiletime.erasedValue usage
  • Bootstrapped compiler compiles successfully

@Gedochao Gedochao requested a review from jchyb January 13, 2026 09:51
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.

Since 3.8.0-RC1, inline match with inlined values sometimes does not compile as it erases values that it accesses

2 participants