Fix #26215: Exempt inline val from inliner postcondition check#26216
Open
starswap wants to merge 2 commits into
Open
Fix #26215: Exempt inline val from inliner postcondition check#26216starswap wants to merge 2 commits into
starswap wants to merge 2 commits into
Conversation
som-snytt
reviewed
Jun 2, 2026
Contributor
som-snytt
left a comment
There was a problem hiding this comment.
Approving but neutral without special expertise.
| def traverse(tree: Tree)(using Context): Unit = | ||
| tree match | ||
| case tree: RefTree if !Inlines.inInlineMethod && StagingLevel.level == 0 => | ||
| case tree: RefTree if !(Inlines.inInlineMethod || Inlines.inInlineVal) && StagingLevel.level == 0 => |
Contributor
There was a problem hiding this comment.
Could Inlines.inInlineMethodOrVal to reduce walking owners chain.
Contributor
There was a problem hiding this comment.
Perhaps it is more natural and efficient to check symbol.isInlineMethod before the rest of the condition.
| inline def x = 10 | ||
|
|
||
| object O2: | ||
| inline val y = O1.x // error: inline value must have a literal constant type |
Contributor
There was a problem hiding this comment.
This is an improvement in the error message, since transparent inline def x is the required fix in the test code, for either the check or the subsequent error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #26215.
How much have you relied on LLM-based tools in this contribution?
Not at all.
How was the solution tested?
New automated tests.