Skip to content
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

-Wconf:msg doesn't work as in scala2 #18804

Open
Daenyth opened this issue Oct 31, 2023 · 4 comments
Open

-Wconf:msg doesn't work as in scala2 #18804

Daenyth opened this issue Oct 31, 2023 · 4 comments
Assignees
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug

Comments

@Daenyth
Copy link

Daenyth commented Oct 31, 2023

Compiler version

3.3.1

Minimized code

Could be anything, but I was testing with the example code from scalatest:

https://scastie.scala-lang.org/MlixqluOSei8PhRAqT69aw

Output

It fails to compile with unused value of type org.scalatest.Assertion

Expectation

The same exact code+sbt configuration works in scala 2.13, compiling without error

https://scastie.scala-lang.org/Bdz9lvvrT6y84XverBCfCA

The output of -Wconf:help on scala 3.3.1 suggests that this should work:

<filter>

  • Message content: msg=regex
    The regex need only match some part of the message, not all of it.

<action>

  • silent / s
@Daenyth Daenyth added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 31, 2023
@som-snytt
Copy link
Contributor

Probably related to #18829

A simple example works, so probably a combination of macro expansion and premature erroring. It should emit configured messaging at the end of the run.

"Simple example":

➜  ~/projects/dotty/bin/scalac '-Wconf:msg=unused value of type C:s' -Wunused:all -Wnonunit-statement -d /tmp/sandbox simple-unused.scala
➜  cat simple-unused.scala

case class C(c: Int)

object X:
  C(79)

@nicolasstucki nicolasstucki added area:linting Linting warnings enabled with -W or -Xlint and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 9, 2024
@caoilte
Copy link

caoilte commented Apr 16, 2024

The problem appears to be the "-Xfatal-warnings" flag rather than any problem with the -W:conf settings.

I was able to make the scastie work by removing fatal warnings. Conversely I wasn't able to find any -W:conf setting that worked (including -Wconf:any:s) with fatal warnings turned on.

@som-snytt
Copy link
Contributor

@caoilte the PR I linked above now links to the fix for #18634 on 3.4.1

@Daenyth
Copy link
Author

Daenyth commented May 2, 2024

Can this be backported to 3.3.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug
Projects
None yet
Development

No branches or pull requests

5 participants