Skip to content
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

Can we support inline vals? #128

Closed
davesmith00000 opened this issue Dec 8, 2024 · 2 comments
Closed

Can we support inline vals? #128

davesmith00000 opened this issue Dec 8, 2024 · 2 comments
Labels
question Further information is requested

Comments

@davesmith00000
Copy link
Member

There was some reason I didn't do this the first time around... but maybe I know enough now to make them work?

@davesmith00000 davesmith00000 added the question Further information is requested label Dec 8, 2024
@davesmith00000
Copy link
Member Author

👀
scala/scala3#22165 (comment)

@davesmith00000
Copy link
Member Author

The problem is that vals are inlined at a later stage of compilation, so the macros can't see them / they haven't been inlined when the macros are run.

You can however put final on your val (without inline) and it will be inlined correctly, if you want that.

On the compiler phases:

scalac -Xshow-phases

...
               inlining  inline and execute macros
           postInlining  add mirror support for inlined code
checkUnusedPostInlining  check for unused elements

... loads of stuff ... oh look!

             inlineVals  check right hand-sides of an `inline val`s
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant