Skip to content

unchecked TypeRef match in interpreter/TypeStrings #6338

Closed

Description

@scabug

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.

Activity

  1. scabug commented on Sep 7, 2012

    @scabug
    Author

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

  2. scabug commented on Sep 7, 2012

    @scabug
    Author

    @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

  3. scabug commented on Sep 7, 2012

    @scabug
    Author

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

  4. scabug commented on Sep 7, 2012

    @scabug
    Author

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

  5. scabug commented on Sep 7, 2012

    @scabug
    Author

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

  6. scabug commented on Sep 7, 2012

    @scabug
    Author

    @harrah said:
    I see. Sorry about that.

  7. scabug commented on Sep 7, 2012

    @scabug
    Author

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

  8. scabug commented on Sep 25, 2012

    @scabug
    Author

    @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

  9. scabug commented on Dec 2, 2012

    @scabug
    Author
  10. scabug commented on Dec 13, 2012

    @scabug
    Author

    @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.)

  11. scabug commented on Nov 21, 2013

    @scabug
    Author

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

  12. added this to the 2.10.1 milestone on Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions