Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Bug
    • Affects Version/s: Scala 2.10.0-RC1, Scala 2.10.0-RC2
    • Fix Version/s: None
    • Labels:
      None

      Description

      In REPL:

      scala> import scala.reflect.runtime.universe._
      import scala.reflect.runtime.universe._
      
      scala> { class B(b:Int); typeTag[B] }
      <console>:11: error: No TypeTag available for B
                    { class B(b:Int); typeTag[B] }
                                             ^
      
      

      In 2.10.0-M7, this compiles fine.

        Activity

        Hide
        Eugene Burmako added a comment - - edited

        This is intentional. If you run scala with -Xlog-implicits, it will explain the reason:

        scala> { class B(b:Int); typeTag[B] }
        materializing requested reflect.runtime.universe.type.TypeTag[B] using `package`.this.materializeTypeTag[B](scala.reflect.runtime.`package`.universe)
        <console>:30: `package`.this.materializeTypeTag[B](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[B] because:
        failed to typecheck the materialized tag: 
        cannot create a TypeTag referring to local class B
                      { class B(b:Int); typeTag[B] }
                                               ^
        <console>:30: error: No TypeTag available for B
                      { class B(b:Int); typeTag[B] }
                                               ^
        
        scala> { class B(b:Int); weakTypeTag[B] }
        res0: reflect.runtime.universe.WeakTypeTag[_ <: Object] = WeakTypeTag[B]
        
        Show
        Eugene Burmako added a comment - - edited This is intentional. If you run scala with -Xlog-implicits, it will explain the reason: scala> { class B(b:Int); typeTag[B] } materializing requested reflect.runtime.universe.type.TypeTag[B] using `package`.this.materializeTypeTag[B](scala.reflect.runtime.`package`.universe) <console>:30: `package`.this.materializeTypeTag[B](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[B] because: failed to typecheck the materialized tag: cannot create a TypeTag referring to local class B { class B(b:Int); typeTag[B] } ^ <console>:30: error: No TypeTag available for B { class B(b:Int); typeTag[B] } ^ scala> { class B(b:Int); weakTypeTag[B] } res0: reflect.runtime.universe.WeakTypeTag[_ <: Object] = WeakTypeTag[B]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development