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

Fix @experimental @main methods #13858

Merged
merged 1 commit into from Nov 18, 2021
Merged

Conversation

nicolasstucki
Copy link
Contributor

Fixes #13848

@nicolasstucki nicolasstucki marked this pull request as ready for review November 1, 2021 16:17
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Change looks good but I think it'd make sense to keep all annotations instead of special-casing just this one for simplicity of specification.

@odersky
Copy link
Contributor

odersky commented Nov 3, 2021

I am not sure about keeping all annotations. Some method annotations don't even make sense for classes. For now I'd keep it to @experimental. If we get customizable entry methods, we could define a meta annotation EntryPointWrapperAnnotation that annotations could inherit so that they get copied to the wrapper method.

@smarter
Copy link
Member

smarter commented Nov 3, 2021

OK, I think that's fine too and we can adjust based on usecases.

@nicolasstucki
Copy link
Contributor Author

Some method annotations don't even make sense for classes.

These annotations are added to the def main(args: Array[String]) method and not to the class that contains that method.

For example with

@main @foo @bar def entry() = ...

we generate

class foo:
  <java static> @foo @bar def main(args: Array[String]) = ... entry() ...

@odersky
Copy link
Contributor

odersky commented Nov 3, 2021 via email

Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM.

compiler/src/dotty/tools/dotc/ast/MainProxies.scala Outdated Show resolved Hide resolved
Co-authored-by: Guillaume Martres <smarter@ubuntu.com>
@nicolasstucki
Copy link
Contributor Author

@timotheeandres you will have to rebase on master once this branch is merged.

@nicolasstucki nicolasstucki merged commit 2b37257 into scala:master Nov 18, 2021
@nicolasstucki nicolasstucki deleted the fix-#13848 branch November 18, 2021 15:25
@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@main methods can't be experimental
4 participants