You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.)
objectTest {
classFoo[T](valx:T) ; objectFoo { defunapply[T](x: Foo[T]) =Some(x.x) }
deff1[T](x: Foo[T]) = x match { caseFoo(y) => y }
deff2[M[_], T](x: M[T]) = x match { caseFoo(y) => y }
caseclassBar[T](x: T)
deff3[T](x: Bar[T]) = x match { caseBar(y) => y }
deff4[M[_], T](x: M[T]) = x match { caseBar(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
The text was updated successfully, but these errors were encountered:
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.)
The text was updated successfully, but these errors were encountered: