Skip to content

Conversation

@som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Jan 5, 2026

Fixes #24894

Annotation args can be inline transparent, but Inlining phase doesn't inline into annotations.

The Inlined node must be handled when emitting the annotation and also when inspecting args.

@som-snytt som-snytt force-pushed the issue/24894-quoted-annot-array-arg branch 2 times, most recently from 72117fd to ebae84c Compare January 7, 2026 16:27
@som-snytt
Copy link
Contributor Author

som-snytt commented Jan 7, 2026

I'm glad the checks are green, but I had a local failure that final val was no longer stable in a pattern. I tossed in some StableRealizable and UncheckedStableAnnot but apparently that is not necessary. Probably I had a stale binary in .ivy2.

I wonder if there's a way for the test rig to warn me if a failure includes a suspicious artifact.

At the moment:

[error] -- [E046] Cyclic Error: /home/amarki/projects/scala3/staging/test/scala/quoted/staging/repl/StagingScriptedReplTests.scala:11:39
[error] 11 |class StagingScriptedReplTests extends ReplTest(ReplTest.withStagingOptions) {
[error]    |                                       ^
[error]    |                             Cyclic reference involving val <import>

I'm not going to investigate, but it would be nice if the test suite just ran (locally). Elsewhere, a PR includes tweaks to help run under JDK 25. Spurious warnings and errors are demoralizing and distracting.

I'll add a simple test for the stability check in patterns. (Bootstrapping would fail, as it did for me spuriously, if that were broken. It complained about the vals in concurrent.duration which are aliases of Java enums.) I'll also ask myself why it doesn't need more help with stability. The check is checkLegalValue in typer.

@som-snytt som-snytt marked this pull request as ready for review January 7, 2026 18:47
@som-snytt som-snytt requested a review from a team as a code owner January 7, 2026 18:47
@Gedochao Gedochao requested a review from jchyb January 8, 2026 14:55
@som-snytt som-snytt force-pushed the issue/24894-quoted-annot-array-arg branch 2 times, most recently from 0515c55 to cd320a8 Compare January 10, 2026 05:22
@som-snytt
Copy link
Contributor Author

som-snytt commented Jan 10, 2026

Moving the second fix for final val enum to a separate PR, including @inelidable or @inelisible.

Copy link
Contributor

@jchyb jchyb left a comment

Choose a reason for hiding this comment

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

Thank you for the fix! (and for splitting the PR up - from what I understand, the API changes for stdlib are effectively frozen until 3.10, so the PR would have had to wait until then).

Overall the fix looks great, but I do have one question about the allArguments and allTermArguments parts.

Comment on lines 156 to 158
case Apply(fn, args) => allArguments(fn) ::: args
case TypeApply(fn, args) => allArguments(fn) ::: args
case Block(Nil, expr) => allArguments(expr)
case Inlined(_, _, expansion) => allArguments(expansion)
case _ => Nil
Copy link
Contributor

@jchyb jchyb Jan 12, 2026

Choose a reason for hiding this comment

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

I don't really understand this part. It seems like we are removing the Inlined node from the function of Apply, rather than the argument, which seems unrelated to the rest of the PR.
Like for annotation @annot([Inlined] "someString")) allArguments will still return [Inlined] "someString"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Likely! I didn't get back to write a test, a mental block. I'll follow up.

@som-snytt som-snytt force-pushed the issue/24894-quoted-annot-array-arg branch from cd320a8 to 236bf2f Compare January 12, 2026 16:38
@som-snytt som-snytt changed the title Search term args in inline expansion Find annotation args in inline expansion Jan 12, 2026
@som-snytt
Copy link
Contributor Author

Dropped the ill-considered allTermArguments tweak and added a unit test for what is actually witnessed. Did not fiddle with adding a helper for convenience.

@som-snytt som-snytt requested a review from jchyb January 13, 2026 09:11
Copy link
Contributor

@jchyb jchyb left a comment

Choose a reason for hiding this comment

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

Thank you!

@jchyb jchyb merged commit 2311847 into scala:main Jan 13, 2026
56 checks passed
@som-snytt som-snytt deleted the issue/24894-quoted-annot-array-arg branch January 13, 2026 15:24
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.

Inline not considered for annotation parameters even if macro returns constant expression

2 participants