-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Unused local from HasNoScope macro #9690
Labels
bug
Something isn't working
Comments
JFYI @987Nabil |
I'll take a look |
I tried inlining the code of the macro and using the return value of the macro //> using dep "dev.zio::zio-http:3.1.0"
//> using options "-Wunused:locals" "-Xfatal-warnings"
import zio.*
val x: HasNoScope[Any] = HasNoScope.hasNoScope[Any] //Works
val z: HasNoScope[Any] = {
val x = HasNoScope.hasNoScope[Any]
println(x)
x
} //Warning
val x1: HasNoScope[Any] = HasNoScope.instance.asInstanceOf[HasNoScope[Any]] //Works
val z1: HasNoScope[Any] = {
val x = HasNoScope.instance.asInstanceOf[HasNoScope[Any]]
println(x)
x
} //Warning
@main def test = println("Hello World") It seems to me like a Scala bug. Any other oppinion? |
z1 does not give a warning for me |
@amumurst exactly. It is only the expended macro. This leads me to the assumption, that this is a bug in the compiler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The HasNoScope type added in #9604 triggered some unused local warnings when I tried to update zio-http to 3.1.0
I managed to minimize the issue from originally being a part of a for-comprehension over ZIO using the zio-http server https://github.com/zio/zio-http/pull/3276/files#diff-15253ca7746d023f47e1c8c4c34e48cbfcd752426fac4b0f9536279e9a7c4b7bR37 down to the value being a part of any local scope (not only map/flatMap)
main.sc
output
The text was updated successfully, but these errors were encountered: