Scala Programming Language
  1. Scala Programming Language
  2. SI-6338

unchecked TypeRef match in interpreter/TypeStrings

    Details

      Description

      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.

        Issue Links

          Activity

          Hide
          Paul Phillips added a comment -

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

          Show
          Paul Phillips added a comment - That's okay, it's refreshing to see you blunder once in a while.
          Hide
          Paul Phillips added a comment -

          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

          Show
          Paul Phillips added a comment - 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
          Show
          Eugene Burmako added a comment - https://issues.scala-lang.org/browse/SI-6754
          Hide
          Adriaan Moors added a comment -

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

          Show
          Adriaan Moors added a comment - (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.)
          Hide
          Jason Zaugg added a comment -

          Appears we forgot to close this for 2.10.1

          Show
          Jason Zaugg added a comment - Appears we forgot to close this for 2.10.1

            People

            • Assignee:
              Eugene Burmako
              Reporter:
              Mark Harrah
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development