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

Case class typeOf not working: bad reference while unpickling $line3.$read: type AnyRef not found in scala.type

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0-M5
    • Fix Version/s: Scala 2.10.0-M5
    • Component/s: Reflection
    • Labels:
      None

      Description

      It seems getting the typeOf a case class doesn't work:

      scala> import scala.reflect.runtime.universe._
      import scala.reflect.runtime.universe._
      
      scala> case class X(s: String)
      defined class X
      
      scala> typeOf[X]
      scala.reflect.internal.Types$TypeError: bad reference while unpickling $line11.$read: type AnyRef not found in scala.type
              at scala.reflect.internal.pickling.UnPickler$Scan.toTypeError(UnPickler.scala:832)
              at scala.reflect.internal.pickling.UnPickler$Scan$LazyTypeRef.complete(UnPickler.scala:846)
              at scala.reflect.internal.pickling.UnPickler$Scan$LazyTypeRef.load(UnPickler.scala:848)
              at scala.reflect.internal.Symbols$Symbol$$anonfun$typeParams$1.apply$mcV$sp(Symbols.scala:1625)
              at scala.reflect.internal.Symbols$Symbol$$anonfun$typeParams$1.apply(Symbols.scala:1625)
              at scala.reflect.internal.Symbols$Symbol$$anonfun$typeParams$1.apply(Symbols.scala:1625)
              at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:195)
              at scala.reflect.internal.Symbols$Symbol.typeParams(Symbols.scala:1625)
              at scala.reflect.internal.Types$NoArgsTypeRef.typeParams(Types.scala:2021)
              at scala.reflect.internal.Types$NoArgsTypeRef.isHigherKinded(Types.scala:2020)
              at scala.reflect.internal.Types$NoArgsTypeRef.normalizeImpl(Types.scala:2054)
              at scala.reflect.internal.Types$TypeRef.normalize(Types.scala:2235)
              at scala.reflect.internal.Definitions$DefinitionsClass.isFunctionType(Definitions.scala:648)
              at scala.reflect.internal.Types$TypeRef.customToString(Types.scala:2340)
              at scala.reflect.internal.Types$TypeRef.safeToString(Types.scala:2362)
              at scala.reflect.internal.Types$class.typeToString(Types.scala:6877)
              at scala.reflect.runtime.JavaUniverse.scala$reflect$runtime$SynchronizedTypes$$super$typeToString(JavaUniverse.scala:9)
              at scala.reflect.runtime.SynchronizedTypes$class.typeToString(SynchronizedTypes.scala:61)
              at scala.reflect.runtime.JavaUniverse.typeToString(JavaUniverse.scala:9)
              at scala.reflect.internal.Types$Type.toString(Types.scala:969)
              at scala.runtime.ScalaRunTime$.scala$runtime$ScalaRunTime$$inner$1(ScalaRunTime.scala:354)
              at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:359)
              at scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:367)
              at .<init>(<console>:10)
              at .<clinit>(<console>)
              at $print(<console>)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:736)
              at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:991)
              at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:579)
              at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:610)
              at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:574)
              at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:742)
              at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:787)
              at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:699)
              at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:563)
              at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:570)
              at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:573)
              at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:864)
              at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:819)
              at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:819)
              at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
              at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:819)
              at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:79)
              at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:92)
              at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101)
              at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
      

        Activity

        Show
        Adriaan Moors added a comment - https://github.com/scala/scala/pull/919

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development