Open
Description
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:
scala> inline def foo = { 1; Stream(1).head }
2 warnings found
-- [E129] Potential Issue Warning: ---------------------------------------------
1 |inline def foo = { 1; Stream(1).head }
| ^
| A pure expression does nothing in statement position
|
| longer explanation available when compiling with `-explain`
-- Deprecation Warning: --------------------------------------------------------
1 |inline def foo = { 1; Stream(1).head }
| ^^^^^^
|value Stream in package scala is deprecated since 2.13.0: Use LazyList instead of Stream
def foo: Int
One of them shows up when using the inline method:
scala> foo
1 warning found
-- Deprecation Warning: --------------------------------------------------------
1 |inline def foo = { 1; Stream(1).head }
| ^^^^^^
|value Stream in package scala is deprecated since 2.13.0: Use LazyList instead of Stream
val res0: Int = 1
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?