Skip to content

@main methods can't be experimental #13848

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
prolativ opened this issue Oct 29, 2021 · 1 comment · Fixed by #13858
Closed

@main methods can't be experimental #13848

prolativ opened this issue Oct 29, 2021 · 1 comment · Fixed by #13858

Comments

@prolativ
Copy link
Contributor

Compiler version

3.1.1-RC1

Minimized code

import annotation.experimental

@main
@experimental
def run(): Unit = {}

Output

[error] method run is marked @experimental and therefore may only be used in an experimental scope.
[error] @main
[error] ^

Expectation

As the code below compiles successfully

import annotation.experimental

object Main:
  @experimental
  def main(args: Array[String]): Unit = {}

I would expect the variant with @main @experimental to work as well unless for some reason we decide it would be better not to have experimental main methods at all, in which case we should disallow marking main methods in objects as @experimental.

@odersky @smarter what do you think?

@smarter
Copy link
Member

smarter commented Oct 29, 2021

Sounds like @experimental isn't copied to the method on the generated class.

@nicolasstucki nicolasstucki self-assigned this Nov 1, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 1, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 2, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 5, 2021
@Kordyjan Kordyjan added this to the 3.1.2 milestone Aug 2, 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