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

no unchecked warnings when unchecked portion is applied type #5762

Closed
scabug opened this issue May 4, 2012 · 2 comments
Closed

no unchecked warnings when unchecked portion is applied type #5762

scabug opened this issue May 4, 2012 · 2 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented May 4, 2012

Presumably it has even less chance of guessing the right type in f2 than it does in f1.

class D[-A]

object Test {
  def f1(x: D[Int with String]) = x match {
    case _: D[Int]    => 1
    case _: D[String] => 2
  }
  // Correctly warns:
  //
  // a.scala:5: warning: non variable type-argument Int in type pattern D[Int] is unchecked since it is eliminated by erasure
  //     case _: D[Int]    => 1
  //             ^
  // a.scala:6: warning: non variable type-argument String in type pattern D[String] is unchecked since it is eliminated by erasure
  //     case _: D[String] => 2
  //             ^
  // two warnings found

  def f2(x: D[D[Int] with D[String]]) = x match {
    case _: D[D[Int]]    => 1
    case _: D[D[String]] => 2
  }
  // No warnings!
}
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 4, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5762?orig=1
Reporter: @paulp
Affected Versions: 2.9.2, 2.10.0-M3

@scabug scabug closed this Oct 11, 2012
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 11, 2012

@paulp said:
I fixed, test in 9904301752 .

@scabug scabug added the patmat label Apr 7, 2017
@scabug scabug added this to the 2.10.0 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.