Skip to content

Unused local definition warning for macro #22837

@987Nabil

Description

@987Nabil

Compiler version

Tested with 3.3.x and 3.6.x

Minimized code

Please take a look at this bug report in zio

zio/zio#9690

//> 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] = { HasNoScope.hasNoScope[Any] } //Warning

Output

[error] ./main.sc:6:49
[error] unused local definition
[error] val z: HasNoScope[Any] = { HasNoScope.hasNoScope[Any] } //Unused
[error]         

Expectation

No such unused warning.

If I inline the code of the macro manually, there is no warning. (See code in the zio issue)
That's why this smells like a compiler bug to me.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions