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

unchecked warnings from invisible type parameters #4911

Closed
scabug opened this Issue Aug 13, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@scabug
Copy link

scabug commented Aug 13, 2011

f2 below issues unchecked warnings, none of the others do. Notice the warning is about T, but doesn't materialize unless the type constructor is parameterized (and not if the case class synthesizes it.)

object Test {
  class Foo[T](val x: T) ; object Foo { def unapply[T](x: Foo[T]) = Some(x.x) }
  def f1[T](x: Foo[T]) = x match { case Foo(y) => y }
  def f2[M[_], T](x: M[T]) = x match { case Foo(y) => y }

  case class Bar[T](x: T)
  def f3[T](x: Bar[T]) = x match { case Bar(y) => y }
  def f4[M[_], T](x: M[T]) = x match { case Bar(y) => y }
}
// 
// ./b.scala:4: warning: non variable type-argument T in type pattern Test.Foo[T] is unchecked since it is eliminated by erasure
//   def f2[M[_], T](x: M[T]) = x match { case Foo(y) => y }
//                                                ^
// one warning found
@scabug

This comment has been minimized.

Copy link
Author

scabug commented Aug 13, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4911?orig=1
Reporter: @paulp
Other Milestones: 2.10.0

@scabug

This comment has been minimized.

Copy link
Author

scabug commented May 26, 2012

@retronym said:
Works now:

scala/scala#629

@scabug scabug closed this May 26, 2012

@scabug scabug added the patmat label Apr 7, 2017

@scabug scabug added this to the 2.10.0-M3 milestone Apr 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment