Skip to content

Report error when language feature is invalid in -language #9901

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

Open
adpi2 opened this issue Sep 28, 2020 · 4 comments
Open

Report error when language feature is invalid in -language #9901

adpi2 opened this issue Sep 28, 2020 · 4 comments

Comments

@adpi2
Copy link
Member

adpi2 commented Sep 28, 2020

Minimized code

dotc -language:foo Hello.scala

Output

Compile successfuly

Expectation

Under the same circumstances, scalac fails with the following error:

'foo' is not a valid choice for '-language'

dotc should have the same behavior or it should at least report a warning.

@som-snytt
Copy link
Contributor

Scala 2 has a MultiChoiceSetting for this purpose, where multiple choices from an enum can be selected.

@odersky
Copy link
Contributor

odersky commented Sep 29, 2020

That's going to be quite messy to keep in lockstep with language imports.

@sjrd
Copy link
Member

sjrd commented Sep 30, 2020

@odersky It seems @som-snytt found a way to derive them automatically from available language imports, so that there will be no problem keeping them in sync.

@som-snytt
Copy link
Contributor

It's pretty messy. There is a similar TODO in Scala 2. For the chicken/egg issue, an alternative would be to verify settings after the compiler is constructed. As a random example, verifying a phase option names a phase from a plugin is possible only later.

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