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

Expect macros don't work with string interpolation in Scala 2.13.14 #90

Closed
zainab-ali opened this issue Nov 7, 2024 · 5 comments
Closed

Comments

@zainab-ali
Copy link
Contributor

This issue was copied over from: disneystreaming/weaver-test#750
It was opened by: aragutskiy


After updating Scala from 2.13.13 to 2.13.14 I got compilation error: "possible missing interpolator: detected an interpolated expression".

Doesn't work:

val world = "World"
assert(s"Hello, $world!".contains("Hell"))

Works:

val world = "World"
val assertion = s"Hello, $world!".contains("Hell")
assert(assertion)
@zainab-ali
Copy link
Contributor Author

This comment was copied over from: disneystreaming/weaver-test#750 (comment)
It was written by: SethTisue


Curious what happened here — what Scala change was responsible. cc lrytz som-snytt

@zainab-ali
Copy link
Contributor Author

This comment was copied over from: disneystreaming/weaver-test#750 (comment)
It was written by: som-snytt


Probably the same as etorreborre/specs2#1237
or explanation on the forum
https://users.scala-lang.org/t/regression-with-macro-and-interpolation-linting/9986/2?u=som-snytt

where -Wmacros:after (or -Wmacros:both) enables linting (for this particular lint) the tree after expansion.

Note that the new default -Wmacros:default was improved to make it less likely that -Wmacros:after is intended.

(-Wmacros:none turns off linting of trees that are transformed by macros, either before or after expansion.)

SethTisue It ought to be mentioned in the release notes. It affects only those warning expanded trees, but that may not be a niche of the community.

@zainab-ali
Copy link
Contributor Author

This comment was copied over from: disneystreaming/weaver-test#750 (comment)
It was written by: som-snytt


I submitted a provisional PR with expecty, which I assume is used here. That would pass the lint irrespective of other settings.

@zainab-ali
Copy link
Contributor Author

This comment was copied over from: disneystreaming/weaver-test#750 (comment)
It was written by: SethTisue


It ought to be mentioned in the release notes

ah, indeed, https://github.com/scala/scala/releases/tag/v2.13.14 references scala/scala#10693

and the expecty PR Som mentions is eed3si9n/expecty#161

@zainab-ali
Copy link
Contributor Author

Closing as a duplicate.

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

No branches or pull requests

1 participant