Skip to content

Support //> options directive in compilation tests #18413

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

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Aug 16, 2023

This will make it simpler to copy code from issues into tests.

@nicolasstucki nicolasstucki marked this pull request as ready for review August 16, 2023 17:27
@nicolasstucki nicolasstucki force-pushed the support-options-directives-in-compilation-tests branch from 0106c21 to 7e2dd57 Compare August 17, 2023 07:12
@som-snytt
Copy link
Contributor

I gave it a half- ❤️ ed endorsement because it replaces the beloved syntax tout à fait. As a footnote, I once saw in the scala-cli docs that options is comma-separated, but I didn't verify the behavior and currently my local scala-cli doesn't start. Probably the doc is mistaken, but I haven't seen a live usage yet. Partest does something weird to remove commas:

val optionsPattern = raw"\s*//>\s*using\s+option(s)?\s+(.*)".r
              case optionsPattern(plural, rest) =>
                if (plural == null) List(rest.trim)
                else tokenize(rest).filter(_ != ",").map(_.stripSuffix(","))

grep shows one test with one-liner pragma, otherwise it's option singular in scala 2 partests.

test/files/pos/t12787.scala:// > using options -opt:inline:<sources>, -Wopt

Commas are significant in -Wconf, so quoting is required if options are comma-separated.

@nicolasstucki nicolasstucki merged commit 5690bbf into scala:main Aug 17, 2023
@nicolasstucki nicolasstucki deleted the support-options-directives-in-compilation-tests branch August 17, 2023 08:30
Kordyjan added a commit that referenced this pull request Dec 8, 2023
#19167)

Backports #18413 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
@Kordyjan Kordyjan added this to the 3.3.2 milestone Dec 14, 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.

4 participants