Skip to content

Question on semantics of inlined parameters. #1570

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

Closed
nicolasstucki opened this issue Oct 8, 2016 · 1 comment
Closed

Question on semantics of inlined parameters. #1570

nicolasstucki opened this issue Oct 8, 2016 · 1 comment
Assignees

Comments

@nicolasstucki
Copy link
Contributor

inline def foo(inline n: Int) = bar(n)
inline def bar(inline n: Int) = n

currently has the following error

error: argument to inline parameter must be a constant expression or a function
  inline def foo(inline n: Int) = bar(n)
                                      ^

I would assume that n should be considered as a constant as at call site it will be a constant and foo is going to be inlined. Hence this should be allowed. Is this correct? Or, I'm missing something else?

@odersky
Copy link
Contributor

odersky commented Oct 8, 2016

Yes, I think that's correct. The argument should be legal.

On Sat, Oct 8, 2016 at 9:29 PM, Nicolas Stucki [email protected]
wrote:

inline def foo(inline n: Int) = bar(n)
inline def bar(inline n: Int) = n

currently has the following error

error: argument to inline parameter must be a constant expression or a function
inline def foo(inline n: Int) = bar(n)
^

I would assume that n should be considered as a constant as at call site
it will be a constant and foo is going to be inlined. Hence this should
be allowed. Is this correct? Or, I'm missing something else?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1570, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAwlVm60kSvBiD7fqXgT1GS7mSHpHioHks5qx-8KgaJpZM4KRzjT
.
{"api_version":"1.0","publisher":{"api_key":"
05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":
{"external_key":"github/lampepfl/dotty","title":"
lampepfl/dotty","subtitle":"GitHub repository","main_image_url":"
https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-
11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://
cloud.githubusercontent.com/assets/143418/15842166/
7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in
GitHub","url":"https://github.com/lampepfl/dotty"}},"
updates":{"snippets":[{"icon":"DESCRIPTION","message":"Question on
semantics of inlined parameters. (#1570)"}],"action":{"name":"View
Issue","url":"https://github.com/lampepfl/dotty/issues/1570"}}}

Prof. Martin Odersky
LAMP/IC, EPFL

odersky added a commit to dotty-staging/dotty that referenced this issue Oct 14, 2016
Inline parameters can always be passed to other
inline parameters.

Fixes scala#1570.
@odersky odersky self-assigned this Oct 14, 2016
smarter added a commit that referenced this issue Oct 25, 2016
Fix #1570: Allow inline parameters as inline args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants