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

unchecked TypeRef match in interpreter/TypeStrings #6338

Closed
scabug opened this issue Sep 7, 2012 · 11 comments
Closed

unchecked TypeRef match in interpreter/TypeStrings #6338

scabug opened this issue Sep 7, 2012 · 11 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Sep 7, 2012

The following warning is generated during compilation of scalac (locker and quick):

src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala:215: warning: abstract type reflect.runtime.universe.TypeRef in type pattern reflect.runtime.universe.TypeRef is unchecked since it is eliminated by erasure
    def typeArguments: List[ru.Type] = ru.typeOf[T] match { case ru.TypeRef(_, _, args) => args; case _ => Nil }
                                                                           ^

It is likely a valid warning that results from ru.TypeRefTag not being visible for the pattern match. It should be straightforward to fix this particular warning, but in general, this is a problem with selective imports from Universe in reflection. I remember this general problem being discussed elsewhere (and Eugene wanting to be able to have XXTag imported whenever XX is imported), but I couldn't find an internals thread or bug report to link to.

@scabug
Copy link
Author

scabug commented Sep 7, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6338?orig=1
Reporter: @harrah
Affected Versions: 2.10.0-RC3

@scabug
Copy link
Author

scabug commented Sep 7, 2012

@paulp said:
I'm not really working on 2.10 anymore, but if anyone wants it, this warning and other issues are handled here: https://github.com/paulp/scala/tree/topic/210-quieter-warnings

@scabug
Copy link
Author

scabug commented Sep 7, 2012

@harrah said:
This warning is the valid one. The spurious warning is #6275. I've copied the comment there.

@scabug
Copy link
Author

scabug commented Sep 7, 2012

@paulp said:
Pretty sure this warning is eliminated in that patch (by importing ru._.)

@scabug
Copy link
Author

scabug commented Sep 7, 2012

@paulp said:
... and I haven't fixed 6275 yet.

@scabug
Copy link
Author

scabug commented Sep 7, 2012

@harrah said:
I see. Sorry about that.

@scabug
Copy link
Author

scabug commented Sep 7, 2012

@paulp said:
That's okay, it's refreshing to see you blunder once in a while.

@scabug
Copy link
Author

scabug commented Sep 25, 2012

@paulp said:
Apparently this will be the world's most exciting trivial fix, because attempting to include it with two of my pull requests caused both to fail. You can suppress the warning with import ru._, and then the rangepos test blows up on an unpositioned tree. https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/582/console

@scabug
Copy link
Author

scabug commented Dec 2, 2012

@xeno-by said:
#6754

@scabug
Copy link
Author

scabug commented Dec 13, 2012

@adriaanm said:
(Pushing reflection bugs to 2.11 to aid scheduling -- as it's experimental in 2.10.x, it shouldn't influence 2.10's schedule. They may be fixed earlier, of course.)

@scabug
Copy link
Author

scabug commented Nov 21, 2013

@retronym said:
Appears we forgot to close this for 2.10.1

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

No branches or pull requests

2 participants