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

Reflection does not work with compound types

    Details

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

      Description

      import scala.reflect.mirror._
      
      object Test extends App {
        val mutant = new { val x = 2 }
        classToType(mutant.getClass)
      }
      
      
      scala.reflect.internal.FatalError: EmptyScope.enter
        at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:36)
        at scala.reflect.internal.Scopes$EmptyScope$.enter(Scopes.scala:346)
        at scala.reflect.internal.Scopes$Scope.enter(Scopes.scala:116)
        at scala.reflect.runtime.Loaders$class.createClassModule(Loaders.scala:68)
        at scala.reflect.runtime.Universe.createClassModule(Universe.scala:11)
        at scala.reflect.runtime.JavaToScala$class.scala$reflect$runtime$JavaToScala$$jclassAsScala(JavaToScala.scala:514)
        at scala.reflect.runtime.JavaToScala$class.scala$reflect$runtime$JavaToScala$$jclassAsScala(JavaToScala.scala:509)
        at scala.reflect.runtime.JavaToScala$$anonfun$classToScala$1.apply(JavaToScala.scala:414)
        at scala.reflect.runtime.JavaToScala$$anonfun$classToScala$1.apply(JavaToScala.scala:384)
        at scala.reflect.runtime.ConversionUtil$TwoWayCache.toScala(ConversionUtil.scala:31)
        at scala.reflect.runtime.JavaToScala$class.classToScala(JavaToScala.scala:384)
        at scala.reflect.runtime.Universe.classToScala(Universe.scala:11)
        at scala.reflect.runtime.JavaToScala$class.typeToScala(JavaToScala.scala:485)
        at scala.reflect.runtime.Universe.typeToScala(Universe.scala:11)
        at scala.reflect.runtime.Mirror.classToType(Mirror.scala:49)
        at scala.reflect.runtime.Mirror.classToType(Mirror.scala:9)
        at Test$delayedInit$body.apply(t5256h.scala:5)
        at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App$$anonfun$main$1.apply(App.scala:61)
        at scala.App$$anonfun$main$1.apply(App.scala:61)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:77)
        at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:31)
        at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
        at scala.App$class.main(App.scala:61)
        at Test$.main(t5256h.scala:3)
        at Test.main(t5256h.scala)
        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.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:90)
        at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:38)
        at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:159)
        at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:90)
        at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:159)
        at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
        at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
        at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
        at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
        at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:70)
        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
        Eugene Burmako added a comment - Fixed in https://github.com/scala/scala/commit/6bb5975289c5b11cb8c88dd4629286956b5d3d27

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development