Skip to content

@nowarn seems to use "OR" semantics for & #12026

@dwijnand

Description

@dwijnand

reproduction steps

Scala 2.13.2

Given a warning like:

$ scala -e 'def f: Unit = 1'
/tmp/scalacmd15643647702672000142.scala:1: warning: a pure expression does nothing in statement position
def f: Unit = 1
              ^

Using @nowarn("cat=other-pure-statement") will suppress it:

$ scala -e 'import scala.annotation.nowarn; @nowarn("cat=other-pure-statement") def f: Unit = 1'

problem

The problem is that it looks like only one filter need apply:

$ scala -e 'import scala.annotation.nowarn; @nowarn("cat=other-pure-statement&msg=bob") def f: Unit = 1'

$ scala -e 'import scala.annotation.nowarn; @nowarn("msg=bob&cat=other-pure-statement") def f: Unit = 1'

Compare to -Wconf where all filters must apply:

$ scala -e 'def f: Unit = 1' '-Wconf:cat=other-pure-statement:silent'

$ scala -e 'def f: Unit = 1' '-Wconf:cat=other-pure-statement&msg=bob:silent'
/tmp/scalacmd13462434343326996307.scala:1: warning: a pure expression does nothing in statement position
def f: Unit = 1
              ^

$ scala -e 'def f: Unit = 1' '-Wconf:msg=bob&cat=other-pure-statement:silent'
/tmp/scalacmd13326564175167716430.scala:1: warning: a pure expression does nothing in statement position
def f: Unit = 1
              ^

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions