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

Reflection API: Type.typeSymbol dealiases the underlying symbol

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Reflection
    • Labels:
      None

      Description

      scala> showRaw(typeOf[String])
      res0: String = TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())
      
      scala> typeOf[String].typeSymbol
      res1: reflect.runtime.universe.Symbol = class String
      
      scala> typeOf[String].typeSymbol.asType.isAliasType
      res2: Boolean = false
      
      scala> val TypeRef(_, sym, _) = typeOf[String]
      sym: reflect.runtime.universe.Symbol = type String
      
      scala> sym.asType.isAliasType
      res3: Boolean = true
      

        Activity

        Hide
        Paul Phillips added a comment -

        What makes you open this as a bug? This is by design. You can't change it, that's for sure. The non-dealiasing method (in the compiler) is typeSymbolDirect.

        Show
        Paul Phillips added a comment - What makes you open this as a bug? This is by design. You can't change it, that's for sure. The non-dealiasing method (in the compiler) is typeSymbolDirect.
        Hide
        Eugene Burmako added a comment -

        Yeah I know about typeSymbolDirect. Wanted to start a discussion about the matter to find out the reasons why typeSymbol dealiases stuff. If that can't be changed, maybe it'd be a good idea to expose typeSymbolDirect in the API in point one.

        Show
        Eugene Burmako added a comment - Yeah I know about typeSymbolDirect. Wanted to start a discussion about the matter to find out the reasons why typeSymbol dealiases stuff. If that can't be changed, maybe it'd be a good idea to expose typeSymbolDirect in the API in point one.

          People

          • Assignee:
            Eugene Burmako
            Reporter:
            Eugene Burmako
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development