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

`.isInstanceOf[GenericType[AnotherGenericType[...]]]` should give an unchecked warning

    Details

      Description

      The compiler/REPL normally give an unchecked warning with .isInstanceOf[GenericType[SomeType]], which makes sense since it gets type-erased to GenericType[Object].

      However, .isInstanceOf[GenericType[AnotherGenericType[...]]] does not give any warning, even though it is equally affected by type erasure.

      I asked about this on Stack Overflow (some more examples there): http://stackoverflow.com/questions/11554323/why-does-some123-isinstanceofoptionliststring-not-give-an-unchecked

      The answer http://stackoverflow.com/a/11555642/319931 shows where in the compiler code the issue is; in particular "[t]he check function returns unit without performing any test" for generic types.

        Activity

        Show
        Paul Phillips added a comment - https://github.com/scala/scala/pull/973
        Hide
        Paul Phillips added a comment -

        186f57ab4b

        Show
        Paul Phillips added a comment - 186f57ab4b

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Mechanical snail
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development