Skip to content

Cannot suppress warning on destructuring assignment #13104

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

Closed
mwisnicki opened this issue May 13, 2025 · 2 comments
Closed

Cannot suppress warning on destructuring assignment #13104

mwisnicki opened this issue May 13, 2025 · 2 comments

Comments

@mwisnicki
Copy link

mwisnicki commented May 13, 2025

Reproduction steps

Scala version: 2.13.16

@nowarn("cat=other-match-analysis")
val Seq(a, b) = Seq(1,2)

Problem

With -Xfatal-warnings this fails.

match may not be exhaustive.
[error] Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=other-match-analysis, site=Example
[error]       val Seq(a, b) = Seq(1,2)
[error]                          ^
@mwisnicki
Copy link
Author

It works when I put @nowarn on onclosing method or type.

@som-snytt
Copy link

This warns once:

//> using options -Xlint

import annotation._

class C {
  val Seq(x, y) = Seq(1, 2)
  val Seq(a, b) = Seq(1, 2): @nowarn("cat=other-match-analysis")

  def f(): Unit = {
    val Seq(a, b) = Seq(1, 2): @nowarn("cat=other-match-analysis")
    ()
  }
}

@som-snytt som-snytt closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants