scalamacros / paradise

(No longer actively maintained.)
http://scalamacros.org/
BSD 3-Clause "New" or "Revised" License
158 stars 53 forks source link

paradise crashes when compiling annotations on classes/traits that have eponymous vals/defs #64

Closed xeno-by closed 9 years ago

xeno-by commented 9 years ago
object Test extends App {
  class ann extends scala.annotation.StaticAnnotation
  @ann trait Foo[T]
  def Foo = ???
}
20:17 ~/Projects/Paradise211x/sandbox/src/main/scala (2.11.x)$ s
error: java.lang.AssertionError: assertion failed:
  module Foo#7934 with maybeExpandeeCompanionCompleter for Foo#7934
     while compiling: Test.scala
        during phase: globalPhase=typer, enteringPhase=namer
     library version: version 2.11.5-20150109-132948-05612399f7
    compiler version: version 2.11.5-20150109-132948-05612399f7
  reconstructed args: -Xplugin-require:macroparadise -Xplugin:/Users/xeno_by/Projects/Paradise211x/plugin/target/scala-2.11/paradise_2.11.6-SNAPSHOT-2.1.0-SNAPSHOT.jar -classpath .:/Users/xeno_by/Projects/simulacrum/target/scala-2.11/simulacrum_2.11-0.2.0-SNAPSHOT.jar

  last tree to typer: TypeTree(class Nothing)
       tree position: line 4 of Test.scala
            tree tpe: Nothing
              symbol: (final abstract) class Nothing in package scala
   symbol definition: final abstract class Nothing extends Any (a NothingClass$)
      symbol package: scala
       symbol owners: class Nothing
           call site: method Foo in object Test in package <empty>

== Source file context for tree position ==

     1   class ann extends scala.annotation.StaticAnnotation
     2   @ann trait Foo[T]
     3   def Foo = ???
     4 }
    at scala.tools.nsc.Global.assert(Global.scala:262)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.completeImpl(Namers.scala:323)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.completeImpl(Namers.scala:317)
    at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1692)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.complete(Namers.scala:299)
    at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1483)
    at scala.reflect.internal.Symbols$Symbol.tpe_$times(Symbols.scala:1447)
    at scala.reflect.internal.Symbols$Symbol.tpe(Symbols.scala:1412)
    at scala.tools.nsc.typechecker.Typers$Typer.checkNoDoubleDefs$1(Typers.scala:3060)
    at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3138)
    at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1903)
    at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1790)
    at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5287)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5336)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5373)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5400)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5347)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5351)
    at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5429)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:3028)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3132)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3132)
    at scala.collection.immutable.List.loop$1(List.scala:173)
    at scala.collection.immutable.List.mapConserve(List.scala:189)
    at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3132)
    at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:4989)
    at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5289)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5336)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5373)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5400)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5347)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5351)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5425)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:441)
    at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:432)
    at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:441)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:94)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:93)
    at scala.collection.Iterator$class.foreach(Iterator.scala:750)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1500)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1487)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1482)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1580)
    at scala.tools.nsc.Driver.doCompile(Driver.scala:32)
    at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
    at scala.tools.nsc.Driver.process(Driver.scala:51)
    at scala.tools.nsc.Driver.main(Driver.scala:64)
    at scala.tools.nsc.Main.main(Main.scala)
Exception in thread "main" java.lang.AssertionError: assertion failed:
  module Foo#7934 with maybeExpandeeCompanionCompleter for Foo#7934
     while compiling: Test.scala
        during phase: globalPhase=typer, enteringPhase=namer
     library version: version 2.11.5-20150109-132948-05612399f7
    compiler version: version 2.11.5-20150109-132948-05612399f7
  reconstructed args: -Xplugin-require:macroparadise -Xplugin:/Users/xeno_by/Projects/Paradise211x/plugin/target/scala-2.11/paradise_2.11.6-SNAPSHOT-2.1.0-SNAPSHOT.jar -classpath .:/Users/xeno_by/Projects/simulacrum/target/scala-2.11/simulacrum_2.11-0.2.0-SNAPSHOT.jar

  last tree to typer: TypeTree(class Nothing)
       tree position: line 4 of Test.scala
            tree tpe: Nothing
              symbol: (final abstract) class Nothing in package scala
   symbol definition: final abstract class Nothing extends Any (a NothingClass$)
      symbol package: scala
       symbol owners: class Nothing
           call site: method Foo in object Test in package <empty>

== Source file context for tree position ==

     1   class ann extends scala.annotation.StaticAnnotation
     2   @ann trait Foo[T]
     3   def Foo = ???
     4 }
    at scala.tools.nsc.Global.assert(Global.scala:262)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.completeImpl(Namers.scala:323)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.completeImpl(Namers.scala:317)
    at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1692)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.complete(Namers.scala:299)
    at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1483)
    at scala.reflect.internal.Symbols$Symbol.tpe_$times(Symbols.scala:1447)
    at scala.reflect.internal.Symbols$Symbol.tpe(Symbols.scala:1412)
    at scala.tools.nsc.typechecker.Typers$Typer.checkNoDoubleDefs$1(Typers.scala:3060)
    at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3138)
    at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1903)
    at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1790)
    at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5287)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5336)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5373)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5400)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5347)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5351)
    at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5429)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:3028)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3132)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3132)
    at scala.collection.immutable.List.loop$1(List.scala:173)
    at scala.collection.immutable.List.mapConserve(List.scala:189)
    at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3132)
    at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:4989)
    at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5289)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5336)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5373)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5400)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5347)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5351)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5425)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:441)
    at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:432)
    at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:441)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:94)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:93)
    at scala.collection.Iterator$class.foreach(Iterator.scala:750)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1500)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1487)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1482)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1580)
    at scala.tools.nsc.Driver.doCompile(Driver.scala:32)
    at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
    at scala.tools.nsc.Driver.process(Driver.scala:51)
    at scala.tools.nsc.Driver.main(Driver.scala:64)
    at scala.tools.nsc.Main.main(Main.scala)
mpilquist commented 9 years ago

Wonderful, thanks! Coincidentally, we decided to rename the Adapter stuff while you were looking in to this. I just tried specialization against master and all is working. Thanks again!