-
Notifications
You must be signed in to change notification settings - Fork 21
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
2.12.4 regression (?): Spurious unused warnings #10571
Comments
looks related to #6096. paging @som-snytt? (Lloyd has clarified that the remaining "2.11"s above should be "2.12"s) |
That is tweaked behavior due to scala/scala#5876 Linting can be done on the unexpanded and/or expanded tree (before/after). It defaults to before (as that represents what was coded directly, as it were).
|
Sorry to nitpick, but shouldn't it default to after, given that was the prior behaviour? As it stands, 2.11.4 breaks builds that compiled under 2.11.3. |
it's just a warning; we're free to change that stuff around in minor releases, and we routinely do. if you think the new default is poorly chosen, you need a better argument than “it was something else before” |
Nope, was just asking given there wasn't much of an argument for the current behaviour presented. Breaking builds when going up a patch version is generally surprising, but given it's partly caused by turning on fatal warnings, I suppose it's understandable :) |
(I guess #10296 was considered self-explanatory, but I haven’t thought about it too deeply) |
It's true that someone has to suffer in the name of progress. Compare the linked ticket. The motivation for not linting the expanded tree is that a macro can emit arbitrary cruft, but linting is to help people avoid mistakes. Some kinds of magic aren't lintable at all, for example generating different code depending on whether an implicit value is in scope (like language features). It's been suggested to let a macro tell the compiler, "I used this symbol." An improvement might be to look only for usages in the expanded tree, ignoring newly introduced cruft. That would be a different mode from "it passes lint before and after." |
Apologies in advance if this has already been filed.
In 2.12.3, private/local values that are used in macro expansions were considered to be used, but in 2.12.4, they trigger unused value warnings.
This is evident when using something like MacWire to wire up dependencies at compile time.
Repro: https://github.com/lloydmeta/scala-2.12.4-unused-test
Main.scala L6-L12, where
wire[T]
is used triggers the following compile warning/failures:Workarounds:
build.sbt
Config(host, port)
andnew Client(config)
)The text was updated successfully, but these errors were encountered: