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 #750

Open
aragutskiy opened this issue May 15, 2024 · 4 comments
Open

Comments

@aragutskiy
Copy link

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)
@SethTisue
Copy link

SethTisue commented May 15, 2024

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

@som-snytt
Copy link

som-snytt commented May 15, 2024

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.

@som-snytt
Copy link

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

@SethTisue
Copy link

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

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

3 participants