Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No synthetics for method PimpedFoo: synthetics contains #5877

Closed
scabug opened this issue Jun 3, 2012 · 6 comments
Closed

No synthetics for method PimpedFoo: synthetics contains #5877

scabug opened this issue Jun 3, 2012 · 6 comments

Comments

@scabug
Copy link

scabug commented Jun 3, 2012

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 
@scabug
Copy link
Author

scabug commented Jun 3, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5877?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0

@scabug
Copy link
Author

scabug commented Jul 19, 2012

@paulp said:
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) { }
}

@scabug
Copy link
Author

scabug commented Nov 7, 2012

@paulp said:
Raising priority; sick of running into it already.

@scabug
Copy link
Author

scabug commented Dec 4, 2012

@retronym said:
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)
}

@scabug
Copy link
Author

scabug commented Dec 4, 2012

@retronym said:
scala/scala#1701

@scabug scabug closed this as completed Dec 10, 2012
@scabug
Copy link
Author

scabug commented Dec 10, 2012

@adriaanm said:
scala/scala#1701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants