Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unused warnings: for macros, by default, look for usages in expansion#10693

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@som-snytt
Copy link
Contributor

@som-snyttsom-snytt commentedFeb 18, 2024
edited
Loading

By default,-Wunused can be satisfied by a usage introduced by a macro expansion.

This is the revised behavior under-Wmacros:default. Previously, the default setting was-Wmacros:before, to lint only before any macros are expanded. The new behavior may reduce the need to suppress warnings.

Previously,-Wmacros:after could be used to lint only the expansion, but if the expansion introduces more unused definitions, then those will generate warnings under that mode.

Note that linting the macro expansion will also warn for-Xlint:missing-interpolator, since 2.13.14. Macros for test assertions that capture interpolations as regular string literals will warn. For example, if a macro transforms

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

into

assert(s"Hello, $world!".contains("Hell"), "Failed test: " + """s"Hello, $world!".contains("Hell")""")

Fixesscala/bug#12953

@scala-jenkinsscala-jenkins added this to the2.13.14 milestoneFeb 18, 2024
@som-snyttsom-snyttforce-pushed theissue/12953-unliftable-unapply branch fromc2a6c08 to4a77a23CompareFebruary 18, 2024 22:02
@som-snytt
Copy link
ContributorAuthor

The missing interpolator lint should be in refchecks. The new motivation is that it only warns when the literal is typechecked, not after macro expansion. Since refchecks can check the expandee, it can warn more consistently.

@som-snyttsom-snyttforce-pushed theissue/12953-unliftable-unapply branch from4a77a23 tob638a21CompareFebruary 21, 2024 22:25
@SethTisueSethTisue added the release-notesworth highlighting in next release notes labelMar 5, 2024
@SethTisue
Copy link
Member

SethTisue commentedMar 5, 2024
edited
Loading

@som-snytt (now that we have an approval from Lukas, let's turn to the matter of documentation)

is there migration advice that could be in the PR description? as in, I am a Scala user, what do I do now?

@som-snyttsom-snytt merged commit34d3c51 intoscala:2.13.xMar 5, 2024
@som-snyttsom-snytt deleted the issue/12953-unliftable-unapply branchMarch 5, 2024 18:37
@som-snytt
Copy link
ContributorAuthor

what do I do now?

That is what everyone is asking themselves. Let me know the results of the next community build.

@SethTisueSethTisue changed the titleFor macros look for usages in expansion by defaultUnused warnings: for macros, look for usages in expansion by defaultApr 19, 2024
@SethTisueSethTisue changed the titleUnused warnings: for macros, look for usages in expansion by defaultUnused warnings: for macros, by default, look for usages in expansionApr 19, 2024
@som-snytt
Copy link
ContributorAuthor

I wonder if this PR ever saw that community build.

I updated the description to include the "missing interpolator" lint seen by some users of assert macros.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@lrytzlrytzlrytz approved these changes

Assignees

No one assigned

Labels

release-notesworth highlighting in next release notes

Projects

None yet

Milestone

2.13.14

Development

Successfully merging this pull request may close these issues.

false positive unused warning implicitUnliftable instance

4 participants

@som-snytt@SethTisue@lrytz@scala-jenkins

[8]ページ先頭

©2009-2025 Movatter.jp