Skip to content

Add -Wimplausible-patterns option #177

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

Conversation

lenguyenthanh
Copy link
Member

I wonder should we include this to default options. It seems very useful but not sure how stable it is.

reference:

@lenguyenthanh lenguyenthanh requested a review from a team February 25, 2025 10:07
Copy link
Contributor

@joan38 joan38 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried on our 20k LOC project and it worked without warning or false positive. So I'd enable it by default too.
Is this enabled by -Wall too?

@lenguyenthanh
Copy link
Member Author

Is this enabled by -Wall too?

did a quick check, the answer is yes. The code below emit warnings.

//> using scala 3.nightly
//> using options -Wall

enum Foo:
  case Bar(i: Int)
case class Container(foo: Foo) 

@main def main = Container(Foo.Bar(1)) match {
  case Container(Foo.Bar) => println("yes")
  case _ => println("no")
}

@lenguyenthanh lenguyenthanh merged commit 29d1a35 into typelevel:main Mar 12, 2025
9 checks passed
@lenguyenthanh lenguyenthanh deleted the add-implausible-patterns-warning-option branch March 12, 2025 19:26
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

Successfully merging this pull request may close these issues.

2 participants