Skip to content

@experimental annotation doesn't work for inline functions #15133

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
gregghz opened this issue May 6, 2022 · 2 comments · Fixed by #15147
Closed

@experimental annotation doesn't work for inline functions #15133

gregghz opened this issue May 6, 2022 · 2 comments · Fixed by #15147

Comments

@gregghz
Copy link

gregghz commented May 6, 2022

Compiler version

3.1.3-RC2

Minimized code

https://scastie.scala-lang.org/CCUeignRSJOnYEBa8aJTWg

import scala.annotation.experimental

@experimental
inline def foo: Any = ???

@experimental
object Test {
  @experimental val x = foo
  
  @experimental
  def bar() = {
    foo
  }
  
  foo
}

Output

[E] [E3] Foo.scala:15:3
[E]      method foo is marked @experimental and therefore may only be used in an experimental scope.
[E]      L15:   foo
[E]             ^^^
[E] [E2] Foo.scala:12:5
[E]      method foo is marked @experimental and therefore may only be used in an experimental scope.
[E]      L12:     foo
[E]               ^^^
[E] [E1] Foo.scala:8:25
[E]      method foo is marked @experimental and therefore may only be used in an experimental scope.
[E]      L8:   @experimental val x = foo
[E]                                  ^^^

Expectation

I expect all foo calls to be recognized as in the experimental scope.

@gregghz gregghz added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 6, 2022
@gregghz gregghz changed the title @experimental annotation doesn't work for inline macros @experimental annotation doesn't work for inline functions May 6, 2022
@gregghz
Copy link
Author

gregghz commented May 6, 2022

https://github.com/lampepfl/dotty/blob/main/tests/neg-custom-args/no-experimental/experimentalInline.scala#L9:L9

I did just stumble across this test case which I think implies that this isn't a bug? If it's true that it's not a bug, I'm not sure these new experimental methods in Quotes.scala can really be used, right?

This is the one I was trying to use:
https://github.com/dotty-staging/dotty/blob/main/library/src/scala/quoted/Quotes.scala#L3645

@bishabosha

This comment was marked as outdated.

@bishabosha bishabosha added area:experimental and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 7, 2022
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 9, 2022
We where not checking if the current scope was an experimental scope

Fixes scala#15133
bishabosha pushed a commit to dotty-staging/dotty that referenced this issue Oct 18, 2022
We where not checking if the current scope was an experimental scope

Fixes scala#15133
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants