Details

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

      Description

      import scala.reflect.mirror._
      
      object Test extends App {
        def f[T](a: T, b: T) = {
          reify(a.toString + b)
          reify(a + b.toString)
        }
      }
      
      reifying = 
      a.toString().+(b)
      Apply(Select(Apply(Select(Ident(newTermName("a")), newTermName("toString")), List()), newTermName("$plus")), List(Ident(newTermName("b"))))
      reifee is located at: source-C:\Projects\Kepler\sandbox\Test.scala,line-5,offset=105
      prefix = scala.reflect.`package`.mirror
      [calculate phase]
      [reshape phase]
      [metalevels phase]
      [interlude]
      symbol table = <empty>
      reifee = 
      a.toString().+(b)
      Apply(Select(Apply(Select(Ident(newTermName("a")), newTermName("toString")), List()), newTermName("$plus")), List(Ident(newTermName("b"))))
      [reify phase]
      Free term: value a(value)
      splicing T
      launching implicit search for scala.reflect.`package`.mirror.TypeTag[T]
      reifying = T
      prefix = scala.reflect.`package`.mirror
      splicing T
      splicing has been cancelled: spliceTypesEnabled = false
      Free type: type T (type)
      Filling in: type T (type)
      reified = {
        val $mr: scala.reflect.`package`.mirror.type = scala.reflect.`package`.mirror;
        val free$T1 = $mr.newFreeType("T", $mr.TypeBounds($mr.staticClass("scala.Nothing").asTypeConstructor, $mr.staticClass("scala.Any").asTypeConstructor), $mr.TypeTag[T](null, null), 8208L, "defined by f in Test.scala:4:9");
        $mr.TypeTag[T]($mr.TypeRef($mr.NoPrefix, free$T1, scala.collection.immutable.List.apply()), Predef.this.classOf[Object])
      }
      implicit search has produced a result: {
        val $mr: reflect.mirror.type = scala.reflect.`package`.mirror;
        val free$T1: $mr.Symbol = $mr.newFreeType("T", $mr.TypeBounds.apply($mr.staticClass("scala.Nothing").asTypeConstructor, $mr.staticClass("scala.Any").asTypeConstructor), $mr.TypeTag.apply[T](null, null), 8208L, "defined by f in Test.scala:4:9");
        $mr.TypeTag.apply[T]($mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil), classOf[java.lang.Object])
      }
      inlined the splicee: $mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil)
      Free term: value b(value)
      splicing T
      cache hit: $mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil)
      Filling in: type T (type)
      Filling in: value a (value)
      Filling in: value b (value)
      reified = {
        val $mr: scala.reflect.`package`.mirror.type = scala.reflect.`package`.mirror;
        val free$T1: $mr.Symbol = $mr.newFreeType("T", $mr.TypeBounds.apply($mr.staticClass("scala.Nothing").asTypeConstructor, $mr.staticClass("scala.Any").asTypeConstructor), $mr.TypeTag.apply[T](null, null), 8208L, "defined by f in Test.scala:4:9");
        val free$a1 = $mr.newFreeTerm("a", $mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil), a, 17592186052608L, "defined by f in Test.scala:4:12");
        val free$b1 = $mr.newFreeTerm("b", $mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil), b, 17592186052608L, "defined by f in Test.scala:4:18");
        $mr.Expr[String]($mr.Apply($mr.Select($mr.Apply($mr.Select($mr.Ident(free$a1), $mr.newTermName("toString")), scala.collection.immutable.List.apply()), $mr.newTermName("$plus")), scala.collection.immutable.List.apply($mr.Ident(free$b1))))($mr.TypeTag[String]($mr.staticClass("java.lang.String").asTypeConstructor, Predef.this.classOf[String]))
      }
      reifying = 
      scala.this.Predef.any2stringadd(a).+(b.toString())
      Apply(Select(Apply(Select(Select(This(newTypeName("scala")), newTermName("Predef")), newTermName("any2stringadd")), List(Ident(newTermName("a")))), newTermName("$plus")), List(Apply(Select(Ident(newTermName("b")), newTermName("toString")), List())))
      reifee is located at: source-C:\Projects\Kepler\sandbox\Test.scala,line-6,offset=122
      prefix = scala.reflect.`package`.mirror
      [calculate phase]
      [reshape phase]
      [metalevels phase]
      [interlude]
      symbol table = <empty>
      reifee = 
      scala.this.Predef.any2stringadd(a).+(b.toString())
      Apply(Select(Apply(Select(Select(This(newTypeName("scala")), newTermName("Predef")), newTermName("any2stringadd")), List(Ident(newTermName("a")))), newTermName("$plus")), List(Apply(Select(Ident(newTermName("b")), newTermName("toString")), List())))
      [reify phase]
      This for package scala, reified as This
      Free term: value a(value)
      splicing T
      cache hit: $mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil)
      Free term: value b(value)
      splicing T
      cache hit: $mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil)
      Filling in: value a (value)
      Filling in: value b (value)
      reified = {
        val $mr: scala.reflect.`package`.mirror.type = scala.reflect.`package`.mirror;
        val free$a2 = $mr.newFreeTerm("a", $mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil), a, 17592186052608L, "defined by f in Test.scala:4:12");
        val free$b2 = $mr.newFreeTerm("b", $mr.TypeRef.apply($mr.NoPrefix, free$T1, immutable.this.Nil), b, 17592186052608L, "defined by f in Test.scala:4:18");
        $mr.Expr[String]($mr.Apply($mr.Select($mr.Apply($mr.Select($mr.Select($mr.This($mr.staticModule("scala").moduleClass), $mr.newTermName("Predef")), $mr.newTermName("any2stringadd")), scala.collection.immutable.List.apply($mr.Ident(free$a2))), $mr.newTermName("$plus")), scala.collection.immutable.List.apply($mr.Apply($mr.Select($mr.Ident(free$b2), $mr.newTermName("toString")), scala.collection.immutable.List.apply()))))($mr.ConcreteTypeTag[String]($mr.staticClass("java.lang.String").asTypeConstructor, Predef.this.classOf[String]))
      }
      
      Test.scala:6: error: Cannot materialize Expr because:
      scala.reflect.internal.Types$TypeError: not found: value free$T1
          reify(a + b.toString)
               ^
      one error found
      

        Activity

        Show
        Eugene Burmako added a comment - Fixed in https://github.com/scala/scala/commit/6355d1a0b825c99560d4ccec1a8769f7421b1a71

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development