Skip to content

Support inline val references in top level splices #12235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2021

Conversation

nicolasstucki
Copy link
Contributor

Fixes #12196

@nicolasstucki nicolasstucki marked this pull request as ready for review April 27, 2021 13:59
@@ -242,6 +243,11 @@ object Splicer {
case Literal(Constant(value)) =>
interpretLiteral(value)

case tree: Ident if tree.symbol.is(Inline, butNot = Method) =>
tree.tpe.widenTermRefExpr match
case ConstantType(c) => c.value.asInstanceOf[Object]
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably handle null here too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do not support inline val n = null. That should be added when we add support for it and can write a test case for that logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #12198

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@nicolasstucki nicolasstucki merged commit 49e5d78 into scala:master Apr 28, 2021
@nicolasstucki nicolasstucki deleted the fix-#12196 branch April 28, 2021 09:11
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
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 val/defs can't be used when calling a quotes fn
4 participants