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

Prefer scala-cli pragmas [ci: last-only] #10757

Open
wants to merge 8 commits into
base: 2.13.x
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Apr 16, 2024

Goal is to remove the old header parsing.

Global replace changes range positions in output. (Which also change in a recent PR.)

Conversion of java: and javaVersion: to follow. Edit: uses javaOpt, javacOpt. Edit: also jvm for javaVersion.

Edit: remove old header parsing. Remove one usage of hide: in favor of DirectTest. filter must be quoted if it has embedded spaces.

Follow-up to #10756

@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Apr 16, 2024
@som-snytt som-snytt added the internal not resulting in user-visible changes (build changes, tests, internal cleanups) label Apr 16, 2024
@som-snytt
Copy link
Contributor Author

Missed a few pragmas that were slightly irregular.

One test failure confused me. It's actually testing that multiple pragmas (on different lines) are picked up, but that was broken. However, it happened to exercise the ambiguity between inherited member and def in scope. I guess it's a warning (2.13.14) that is promoted to error if -Xsource;3, but the message text is the same. But the reference is not ambiguous in the sense of erroneous; it's merely confusing.

I'm not sure what I was testing: maybe documenting status quo that "last pragma wins". The companion test shows both options in one pragma (with comma separation). scala-cli appears to accumulate and keep both pragmas, as it errors irrespective of the order of the two pragmas.

➜  scala git:(tweak/test-flags) ✗ skalac -d /tmp/sandbox test/files/neg/using-source3.scala
test/files/neg/using-source3.scala:14: warning: reference to f is ambiguous;
it is both defined in the enclosing class D and inherited in the enclosing class E as method f (defined in class C)
In Scala 2, symbols inherited from a superclass shadow symbols defined in an outer scope.
Such references are ambiguous in Scala 3. To continue using the inherited symbol, write `this.f`.
Or use `-Wconf:msg=legacy-binding:s` to silence this warning. [quickfixable]
    def g = f
            ^
1 warning
➜  scala git:(tweak/test-flags) ✗ skalac -Xsource:3 -d /tmp/sandbox test/files/neg/using-source3.scala
test/files/neg/using-source3.scala:14: error: reference to f is ambiguous;
it is both defined in the enclosing class D and inherited in the enclosing class E as method f (defined in class C)
In Scala 2, symbols inherited from a superclass shadow symbols defined in an outer scope.
Such references are ambiguous in Scala 3. To continue using the inherited symbol, write `this.f`.
Or use `-Wconf:msg=legacy-binding:s` to silence this warning. [quickfixable]
Scala 3 migration messages are issued as errors under -Xsource:3. Use -Wconf or @nowarn to demote them to warnings or suppress.
Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration, site=D.E.g
    def g = f
            ^
1 error

@som-snytt som-snytt marked this pull request as ready for review April 17, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal not resulting in user-visible changes (build changes, tests, internal cleanups)
Projects
None yet
2 participants