You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Taking a step back, it's not obvious that the expectation is correct. @nowarn is for "local warning suppression".
Inlining checks the "call site", so that inlining a deprecated method will warn.
CrossVersionChecks checks the expansion; the diagnostic is issued at the inlined position, which under separate compilation is not a current source. It would be more natural to see the warning at the non-inlined position, with an explanation that inlined code was involved. This may depend on a hypothetical option that selects how warnings and lints are applied to expanded code.
Apparently, it currently does not respect:
//>usingoption"-Werror"
Please note the correct spelling of the option to turn warnings into errors without using -Wconf:any:e.
$ scala-cli compile --server=false -S 3.6.3 -d ~/sandbox -cp ~/sandbox tests/warn/i22672/usage_2.scala
-- Deprecation Warning: lib_1.scala:11:2 ---------------------------------------
11 | g
| ^
| method g in package p is deprecated since 1.0: old api
1 warning found
after adding a noninlined deprecation, it works (fails the compilation)
-- Deprecation Warning: /home/amarki/projects/dotty/tests/warn/i22672/usage_2.scala:11:14
11 |def failing = huh
| ^^^
|method huh in package q is deprecated since 0.1: do I even know how it works
No warnings can be incurred under -Werror (or -Xfatal-warnings)
-- Deprecation Warning: lib_1.scala:11:2 ---------------------------------------
11 | g
| ^
| method g in package p is deprecated since 1.0: old api
2 warnings found
1 error found
Compilation failed
To satisfy the expectation, inlining should inline the symbol's @nowarn at the inlined body. That sounds reasonable and doable.
But currently, annotating the inlined expression doesn't work (the annotations are collected in typer on a per-file basis).
-- Deprecation Warning: lib_1.scala:11:2 ---------------------------------------
11 | g: @nowarn
| ^
| method g in package p is deprecated since 1.0: old api
I haven't checked yet if transparent inline conforms to expectations. (Edit: It correctly warns posttyper.)
Compiler version
3.6.3, 3.3.5 (and many others)
Minimized code
A minimal library (use
scala publish local <first_filename>
to publish it locally):Then a usage of that library:
Use
scala compile <second_filename>
to compile itOutput
Expectation
No deprecation warning is emitted (as it is the case if
dooFoo
is not declaredinline
).The text was updated successfully, but these errors were encountered: