-
Notifications
You must be signed in to change notification settings - Fork 21
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
ClassTag-based type pattern matching hides unchecked-ness #9565
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9565?orig=1 |
@milessabin said: |
Stephen Compall (s11001001) said: |
@adriaanm said: |
@milessabin said: |
@adriaanm Add a type UECT ("unerased ClassTag") such that UECT Second, emit a deprecation warning when using a So there are two warnings:
|
UECT is interesting. Some ideas in that gist were collected from Gitter discussion. Regarding shapeless EDIT: and should people do my same search, the current behavior is unsound (by the Java rules for unchecked warnings). |
A type pattern with erased components triggers an unchecked warning regarding those erased components.
With the addition of
ClassTag
and its use to make type patterns of abstract types actually check something again, these warnings are not emitted. Which is fine for some types, but not allClassTag
s are created equal.This creates a working
unsafeCoerce
with nounchecked
warning. The argument toitsa
passes the pattern because it is aFunction1[_,_]
.A warning when producing a
ClassTag
for partially-erased types would be spurious for theArray
creation use case. But a warning flag for those uninterested in creatingArray
, or requirement of a more specific type of tag (that warns for tag creation on partially-erased types) for type-pattern matching, might be nice.The text was updated successfully, but these errors were encountered: