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

Consecutive -language:... Compiler flags in using options are ignored #2549

Closed
crater2150 opened this issue Nov 15, 2023 · 0 comments · Fixed by #2667
Closed

Consecutive -language:... Compiler flags in using options are ignored #2549

crater2150 opened this issue Nov 15, 2023 · 0 comments · Fixed by #2667
Assignees
Labels
bug Something isn't working
Projects

Comments

@crater2150
Copy link
Contributor

Version(s)
1.0.6

Describe the bug
If two -language: flags appear next to each other in a //> using options directive, the second one is ignored. The different behaviour is not reproducible by calling the Scala 3 compiler directly.

To Reproduce

I stumbled upon this while encountering a bug where strictEquality breaks if -Yexplicit-nulls is enabled, so that is what the examples use:

def repro[A](as: List[A]): List[A] =
  as match
    case Nil => Nil
    case _ => ???

This code causes a compile error, if compiled with scala3-compiler (version 3.3.1) and any of the following flag orders:

-Yexplicit-nulls -language:strictEquality
-language:strictEquality -Yexplicit-nulls -language:fewerBraces
-Yexplicit-nulls -nowarn -language:strictEquality
-language:strictEquality -language:higherKindedTypes -Yexplicit-nulls 
-language:strictEquality -Yexplicit-nulls -language:higherKindedTypes 
-Yexplicit-nulls -language:higherKindedTypes -language:strictEquality
-language:higherKindedTypes -language:strictEquality -Yexplicit-nulls 
-Yexplicit-nulls -language:fewerBraces -language:strictEquality

Compiling with scala-cli compile, the behavior is the same for the first five, but the last three compile without error, e.g.

//> using scala 3.3.1
//> using options -Yexplicit-nulls -language:fewerBraces -language:strictEquality
def repro[A](as: List[A]): List[A] =
  as match
    case Nil => Nil
    case _ => ???

To run all of the above compilations of flags, I used this script: https://gist.github.com/crater2150/4950128bbde80437d0ba6077fd94f805

Expected behaviour

-language:... flags should work without other flags between them.

@crater2150 crater2150 added the bug Something isn't working label Nov 15, 2023
@crater2150 crater2150 changed the title Compiler flags to using options are order-dependent Consecutive -language:... Compiler flags in using options are ignored Nov 15, 2023
@Gedochao Gedochao self-assigned this Nov 20, 2023
@Gedochao Gedochao added this to To do in Issue Board via automation Nov 20, 2023
Issue Board automation moved this from To do to Done Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

2 participants