Skip to content

No warnings for union type test pattern #8742

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
liufengyun opened this issue Apr 17, 2020 · 2 comments · Fixed by #17483
Closed

No warnings for union type test pattern #8742

liufengyun opened this issue Apr 17, 2020 · 2 comments · Fixed by #17483

Comments

@liufengyun
Copy link
Contributor

Minimized code

class A
class B
class C

object Test {
  def bar(x: A) = x match {
    case x: (B | C) => x // no warning?
    case _ =>
  }
}

Output

No warnings

Expectation

The compiler should produce a warning, as the test is always false.

@Decel
Copy link
Contributor

Decel commented May 11, 2023

There is a warning message since 3.2.0, I think?

ckipp01 added a commit to ckipp01/dotty that referenced this issue May 12, 2023
There was also some other tests that were _very_ similar to this, so it
seemed like the logical place to also just include this one instead of
creating another file for it.

Closes scala#8742
@ckipp01
Copy link
Member

ckipp01 commented May 12, 2023

Thanks for pointing this out @Decel! Yes, it does seem to be fixed. I added this to a test case in #17483.

nicolasstucki added a commit that referenced this issue May 12, 2023
There was also some other tests that were _very_ similar to this, so it
seemed like the logical place to also just include this one instead of
creating another file for it.

Closes #8742
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants