-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Some warnings in inlined code show up at the callsite #22790
Comments
cc @jchyb |
Sometimes it makes sense to have them, especially if we consider macros (where warnings can be dynamically created, either by directly reporting a warning, or creating a specific tree, and we only get those at the inline call site). It could be argued that the deprecation warning could be useful if we are using an inlined method from another library, where we would also only get that warning at a call site (but I don't know if that's a good argument). I agree it's probably currently a bit arbitrary which ones are supported, but there were certain checks/warnings already that were turned off for inline methods. Somewhat amusingly, I wanted to show how useful a deprecation warning could be in the context of a macro, but I ended up with an issue ticket: #22795 I don't see the point of configuring that with a flag, especially that the way the reporter works now, duplicate warnings are not reported (so outside of repl, we would not see that second one). |
Scala 2 has, for unused warnings:
If we have two files and compile the definition and the usage separately, the deprecation shows when compiling the usage. The warning position could actually be pretty confusing for users. They will see a warning pointing to a source file that they don't actually have if the inline definition is in a dependency. |
Porting My example for warning at call site is that implicit search can induce a warning. (The warning is context-dependent.) I observed the "foreign position" problem but haven't given it thought. |
Some warnings in inlined code show up at the callsite, some don't. It depends on the compiler phase in which the warning is issued. That seems arbitrary.
For example, this definition triggers two warnings:
One of them shows up when using the inline method:
The recent #22682 makes sure that messages filtered by
@nowarn
in the inline def don't leak to the callsite.But does it ever make sense to see warnings in inlined code? Should that be configurable with a flag?
The text was updated successfully, but these errors were encountered: