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

No synthetics for method PimpedFoo: synthetics contains

    Details

      Description

      package foo {
        class Foo
      }
      
      package object foo {
        implicit class PimpedFoo(foo: Foo) {
          def bar = ???
        }
      }
      
      error: No synthetics for method PimpedFoo: synthetics contains 
      error: 
           while compiling: Test.scala
              during phase: typer
           library version: version 2.10.0-20120603-142856-83434f60c4
          compiler version: version 2.10.0-20120603-142856-83434f60c4
        reconstructed args: -language:experimental.macros
      
        last tree to typer: Literal(Constant(()))
                    symbol: null
         symbol definition: null
                       tpe: Unit
             symbol owners: 
            context owners: package package -> package foo
      
      == Enclosing template or block ==
      
      Template( // val <local package>: <notype> in package foo
        "java.lang.Object" // parents
        ValDef(
          private
          "_"
          <tpt>
          <empty>
        )
        // 2 statements
        DefDef( // def <init>: <?> in package foo
          <method>
          "<init>"
          []
          List(Nil)
          <tpt>
          Block(
            Apply(
              super."<init>"
              Nil
            )
            ()
          )
        )
        ClassDef( // implicit class PimpedFoo extends Object in package foo
          implicit
          "PimpedFoo"
          []
          Template(
            "java.lang.Object" // parents
            ValDef(
              private
              "_"
              <tpt>
              <empty>
            )
            // 3 statements
            ValDef( // private[this] val foo: <?> in class PimpedFoo
              private <local> <paramaccessor>
              "foo"
              "Foo"
              <empty>
            )
            DefDef( // def <init>(foo: foo.Foo): foo.package.PimpedFoo in class PimpedFoo
              <method> <triedcooking>
              "<init>"
              []
              // 1 parameter list
              ValDef( // foo: foo.Foo
                <param> <paramaccessor>
                "foo"
                "Foo" // class Foo extends Object in package foo, tree.tpe=foo.Foo
                <empty>
              )
              <tpt> // tree.tpe=foo.package.PimpedFoo
              Block(
                Apply(
                  super."<init>"
                  Nil
                )
                ()
              )
            )
            DefDef( // def bar: <?> in class PimpedFoo
              <method>
              "bar"
              []
              Nil
              <tpt>
              "$qmark$qmark$qmark"
            )
          )
        )
      )
      
      == Expanded type of tree ==
      
      TypeRef(TypeSymbol(final class Unit extends AnyVal))
      
      uncaught exception during compilation: scala.reflect.internal.FatalError
      error: scala.reflect.internal.FatalError: 
           while compiling: Test.scala
              during phase: typer
           library version: version 2.10.0-20120603-142856-83434f60c4
          compiler version: version 2.10.0-20120603-142856-83434f60c4
        reconstructed args: -language:experimental.macros
      
        last tree to typer: Literal(Constant(()))
                    symbol: null
         symbol definition: null
                       tpe: Unit
             symbol owners: 
            context owners: package package -> package foo
      
      == Enclosing template or block ==
      
      Template( // val <local package>: <notype> in package foo
        "java.lang.Object" // parents
        ValDef(
          private
          "_"
          <tpt>
          <empty>
        )
        // 2 statements
        DefDef( // def <init>: <?> in package foo
          <method>
          "<init>"
          []
          List(Nil)
          <tpt>
          Block(
            Apply(
              super."<init>"
              Nil
            )
            ()
          )
        )
        ClassDef( // implicit class PimpedFoo extends Object in package foo
          implicit
          "PimpedFoo"
          []
          Template(
            "java.lang.Object" // parents
            ValDef(
              private
              "_"
              <tpt>
              <empty>
            )
            // 3 statements
            ValDef( // private[this] val foo: <?> in class PimpedFoo
              private <local> <paramaccessor>
              "foo"
              "Foo"
              <empty>
            )
            DefDef( // def <init>(foo: foo.Foo): foo.package.PimpedFoo in class PimpedFoo
              <method> <triedcooking>
              "<init>"
              []
              // 1 parameter list
              ValDef( // foo: foo.Foo
                <param> <paramaccessor>
                "foo"
                "Foo" // class Foo extends Object in package foo, tree.tpe=foo.Foo
                <empty>
              )
              <tpt> // tree.tpe=foo.package.PimpedFoo
              Block(
                Apply(
                  super."<init>"
                  Nil
                )
                ()
              )
            )
            DefDef( // def bar: <?> in class PimpedFoo
              <method>
              "bar"
              []
              Nil
              <tpt>
              "$qmark$qmark$qmark"
            )
          )
        )
      )
      
      == Expanded type of tree ==
      
      TypeRef(TypeSymbol(final class Unit extends AnyVal))
      
      No synthetics for method PimpedFoo: synthetics contains 
        at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:47)
        at scala.tools.nsc.Global.abort(Global.scala:249)
        at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$class.addDerivedTrees(MethodSynthesis.scala:253)
        at scala.tools.nsc.typechecker.Namers$Namer.addDerivedTrees(Namers.scala:76)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$41.apply(Typers.scala:1734)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$41.apply(Typers.scala:1734)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1672)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1669)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:245)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:77)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:245)
        at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1734)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$40.apply(Typers.scala:1644)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$40.apply(Typers.scala:1644)
        at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:515)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1643)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4672)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5033)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2585)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60$$anonfun$61.apply(Typers.scala:2681)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60$$anonfun$61.apply(Typers.scala:2681)
        at scala.collection.immutable.List.loop$1(List.scala:163)
        at scala.collection.immutable.List.mapConserve(List.scala:179)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60.apply(Typers.scala:2681)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60.apply(Typers.scala:2680)
        at scala.tools.nsc.typechecker.Typers$Typer.withSavedContext(Typers.scala:524)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2680)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4665)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5033)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2585)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60$$anonfun$61.apply(Typers.scala:2681)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60$$anonfun$61.apply(Typers.scala:2681)
        at scala.collection.immutable.List.loop$1(List.scala:163)
        at scala.collection.immutable.List.mapConserve(List.scala:179)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60.apply(Typers.scala:2681)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60.apply(Typers.scala:2680)
        at scala.tools.nsc.typechecker.Typers$Typer.withSavedContext(Typers.scala:524)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2680)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4665)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5033)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5091)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:97)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:458)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:89)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:89)
        at scala.collection.Iterator$class.foreach(Iterator.scala:724)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1152)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:89)
        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1573)
        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1547)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1543)
        at scala.tools.nsc.Global$Run.compile(Global.scala:1653)
        at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
        at scala.tools.nsc.Main$.doCompile(Main.scala:81)
        at scala.tools.nsc.Driver.process(Driver.scala:52)
        at scala.tools.nsc.Driver.main(Driver.scala:65)
        at scala.tools.nsc.Main.main(Main.scala)
      
      error: fatal error: 
           while compiling: Test.scala
              during phase: typer
           library version: version 2.10.0-20120603-142856-83434f60c4
          compiler version: version 2.10.0-20120603-142856-83434f60c4
        reconstructed args: -language:experimental.macros
      
        last tree to typer: Literal(Constant(()))
                    symbol: null
         symbol definition: null
                       tpe: Unit
             symbol owners: 
            context owners: package package -> package foo
      
      == Enclosing template or block ==
      
      Template( // val <local package>: <notype> in package foo
        "java.lang.Object" // parents
        ValDef(
          private
          "_"
          <tpt>
          <empty>
        )
        // 2 statements
        DefDef( // def <init>: <?> in package foo
          <method>
          "<init>"
          []
          List(Nil)
          <tpt>
          Block(
            Apply(
              super."<init>"
              Nil
            )
            ()
          )
        )
        ClassDef( // implicit class PimpedFoo extends Object in package foo
          implicit
          "PimpedFoo"
          []
          Template(
            "java.lang.Object" // parents
            ValDef(
              private
              "_"
              <tpt>
              <empty>
            )
            // 3 statements
            ValDef( // private[this] val foo: <?> in class PimpedFoo
              private <local> <paramaccessor>
              "foo"
              "Foo"
              <empty>
            )
            DefDef( // def <init>(foo: foo.Foo): foo.package.PimpedFoo in class PimpedFoo
              <method> <triedcooking>
              "<init>"
              []
              // 1 parameter list
              ValDef( // foo: foo.Foo
                <param> <paramaccessor>
                "foo"
                "Foo" // class Foo extends Object in package foo, tree.tpe=foo.Foo
                <empty>
              )
              <tpt> // tree.tpe=foo.package.PimpedFoo
              Block(
                Apply(
                  super."<init>"
                  Nil
                )
                ()
              )
            )
            DefDef( // def bar: <?> in class PimpedFoo
              <method>
              "bar"
              []
              Nil
              <tpt>
              "$qmark$qmark$qmark"
            )
          )
        )
      )
      
      == Expanded type of tree ==
      
      TypeRef(TypeSymbol(final class Unit extends AnyVal))
      
      No synthetics for method PimpedFoo: synthetics contains 
      

        Activity

        Hide
        Paul Phillips added a comment -

        Even this is enough (since I just came to report this and have it handy...)

        package foo { }
        
        package object foo {
          implicit class Foo(val s: String) { }
        }
        
        Show
        Paul Phillips added a comment - Even this is enough (since I just came to report this and have it handy...) package foo { } package object foo { implicit class Foo(val s: String) { } }
        Hide
        Paul Phillips added a comment -

        Raising priority; sick of running into it already.

        Show
        Paul Phillips added a comment - Raising priority; sick of running into it already.
        Hide
        Jason Zaugg added a comment -

        A workaround seems to be to use object `package`. What does that tell us about the bug?

        package foo {
          class Foo
        
          // okay
          //
          // object `package` {
          //   implicit class PimpedFoo1(value: Foo)
          // }
        }
        
        package object foo {
          // No synthetics for method PimpedFoo2: synthetics contains 
          implicit class PimpedFoo2(value: Foo)
        }
        
        
        Show
        Jason Zaugg added a comment - A workaround seems to be to use object `package`. What does that tell us about the bug? package foo { class Foo // okay // // object `package` { // implicit class PimpedFoo1(value: Foo) // } } package object foo { // No synthetics for method PimpedFoo2: synthetics contains implicit class PimpedFoo2(value: Foo) }
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/1701
        Show
        Adriaan Moors added a comment - https://github.com/scala/scala/pull/1701

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Eugene Burmako
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development