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

double definitions might make paradise crash #43

Open
xeno-by opened this issue Apr 18, 2014 · 0 comments
Open

double definitions might make paradise crash #43

xeno-by opened this issue Apr 18, 2014 · 0 comments
Assignees

Comments

@xeno-by
Copy link
Member

xeno-by commented Apr 18, 2014

import scala.language.experimental.macros
import scala.annotation.StaticAnnotation
import scala.reflect.macros.whitebox.Context

class leaf extends StaticAnnotation {
  def macroTransform(annottees: Any*): Any = macro AdtMacros.leaf
}

class AdtMacros(val c: Context) {
  import c.universe._
  def leaf(annottees: Tree*) = q"{ ..$annottees; () }"
}

object M {
  object X

  @leaf class X
  object X
}
15:37 ~/Projects/Paradise2110/sandbox/src/main/scala (2.11.0)$ ss
Test.scala:5: error: X is already defined as object X
  object X
         ^
error: java.lang.AssertionError: assertion failed:
  module X#7915 with maybeExpandeeCompanionCompleter for X#7915
     while compiling: Test.scala
        during phase: globalPhase=typer, enteringPhase=namer
     library version: version 2.11.0-20140415-163722-cac6383e66
    compiler version: version 2.11.0-20140415-163722-cac6383e66
  reconstructed args: -Xplugin-require:macroparadise -Xplugin:/Users/xeno_by/Projects/Paradise2110/plugin/target/scala-2.11/paradise_2.11.0-2.1.0-SNAPSHOT.jar

  last tree to typer: Ident(scala)
       tree position: line 6 of Test.scala
            tree tpe: scala.type
              symbol: final package scala
   symbol definition: final package scala (a ModuleSymbol)
      symbol package: <none>
       symbol owners: package scala
           call site: object M in package <empty>

== Source file context for tree position ==

     3   @leaf class X
     4   object X
     5 }
    at scala.tools.nsc.Global.assert(Global.scala:252)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.completeImpl(Namers.scala:321)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.complete(Namers.scala:310)
    at org.scalamacros.paradise.typechecker.Namers$Namer$RichType.completeOnlyExpansions(Namers.scala:338)
    at org.scalamacros.paradise.typechecker.Expanders$Expander$$anonfun$expandMacroAnnotations$2.apply(Expanders.scala:133)
    at org.scalamacros.paradise.typechecker.Expanders$Expander$$anonfun$expandMacroAnnotations$2.apply(Expanders.scala:126)
    at scala.collection.immutable.List.flatMap(List.scala:329)
    at org.scalamacros.paradise.typechecker.Expanders$Expander$class.expandMacroAnnotations(Expanders.scala:126)
    at org.scalamacros.paradise.typechecker.Expanders$$anon$1.expandMacroAnnotations(Expanders.scala:14)
    at org.scalamacros.paradise.typechecker.AnalyzerPlugins$AnalyzerPlugin$.pluginsTypeSig(AnalyzerPlugins.scala:20)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$3$$anonfun$accumulate$3.apply(AnalyzerPlugins.scala:313)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$3$$anonfun$accumulate$3.apply(AnalyzerPlugins.scala:313)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$invoke$1.apply(AnalyzerPlugins.scala:288)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$invoke$1.apply(AnalyzerPlugins.scala:287)
    at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:110)
    at scala.collection.immutable.List.foldLeft(List.scala:83)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:287)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsTypeSig(AnalyzerPlugins.scala:311)
    at scala.tools.nsc.Global$$anon$1.pluginsTypeSig(Global.scala:459)
    at scala.tools.nsc.typechecker.Namers$Namer.templateSig(Namers.scala:961)
    at scala.tools.nsc.typechecker.Namers$Namer.moduleSig(Namers.scala:989)
    at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1522)
    at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1537)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply$mcV$sp(Namers.scala:781)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer$LogTransitions.apply(Namers.scala:1555)
    at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$logAndValidate(Namers.scala:1564)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:772)
    at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1679)
    at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1687)
    at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1677)
    at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1429)
    at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1576)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4919)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5303)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5330)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5277)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5281)
    at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5359)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2998)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3102)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3102)
    at scala.collection.immutable.List.loop$1(List.scala:172)
    at scala.collection.immutable.List.mapConserve(List.scala:188)
    at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3102)
    at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:4926)
    at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5219)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5266)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5303)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5330)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5277)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5281)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5355)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
    at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:430)
    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:743)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1174)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1625)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1610)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1605)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1703)
    at scala.tools.nsc.Driver.doCompile(Driver.scala:34)
    at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
    at scala.tools.nsc.Driver.process(Driver.scala:55)
    at scala.tools.nsc.Driver.main(Driver.scala:68)
    at scala.tools.nsc.Main.main(Main.scala)
Exception in thread "main" java.lang.AssertionError: assertion failed:
  module X#7915 with maybeExpandeeCompanionCompleter for X#7915
     while compiling: Test.scala
        during phase: globalPhase=typer, enteringPhase=namer
     library version: version 2.11.0-20140415-163722-cac6383e66
    compiler version: version 2.11.0-20140415-163722-cac6383e66
  reconstructed args: -Xplugin-require:macroparadise -Xplugin:/Users/xeno_by/Projects/Paradise2110/plugin/target/scala-2.11/paradise_2.11.0-2.1.0-SNAPSHOT.jar

  last tree to typer: Ident(scala)
       tree position: line 6 of Test.scala
            tree tpe: scala.type
              symbol: final package scala
   symbol definition: final package scala (a ModuleSymbol)
      symbol package: <none>
       symbol owners: package scala
           call site: object M in package <empty>

== Source file context for tree position ==

     3   @leaf class X
     4   object X
     5 }
    at scala.tools.nsc.Global.assert(Global.scala:252)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.completeImpl(Namers.scala:321)
    at org.scalamacros.paradise.typechecker.Namers$Namer$MaybeExpandeeCompleter.complete(Namers.scala:310)
    at org.scalamacros.paradise.typechecker.Namers$Namer$RichType.completeOnlyExpansions(Namers.scala:338)
    at org.scalamacros.paradise.typechecker.Expanders$Expander$$anonfun$expandMacroAnnotations$2.apply(Expanders.scala:133)
    at org.scalamacros.paradise.typechecker.Expanders$Expander$$anonfun$expandMacroAnnotations$2.apply(Expanders.scala:126)
    at scala.collection.immutable.List.flatMap(List.scala:329)
    at org.scalamacros.paradise.typechecker.Expanders$Expander$class.expandMacroAnnotations(Expanders.scala:126)
    at org.scalamacros.paradise.typechecker.Expanders$$anon$1.expandMacroAnnotations(Expanders.scala:14)
    at org.scalamacros.paradise.typechecker.AnalyzerPlugins$AnalyzerPlugin$.pluginsTypeSig(AnalyzerPlugins.scala:20)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$3$$anonfun$accumulate$3.apply(AnalyzerPlugins.scala:313)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$3$$anonfun$accumulate$3.apply(AnalyzerPlugins.scala:313)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$invoke$1.apply(AnalyzerPlugins.scala:288)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$invoke$1.apply(AnalyzerPlugins.scala:287)
    at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:110)
    at scala.collection.immutable.List.foldLeft(List.scala:83)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:287)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsTypeSig(AnalyzerPlugins.scala:311)
    at scala.tools.nsc.Global$$anon$1.pluginsTypeSig(Global.scala:459)
    at scala.tools.nsc.typechecker.Namers$Namer.templateSig(Namers.scala:961)
    at scala.tools.nsc.typechecker.Namers$Namer.moduleSig(Namers.scala:989)
    at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1522)
    at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1537)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply$mcV$sp(Namers.scala:781)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer$LogTransitions.apply(Namers.scala:1555)
    at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$logAndValidate(Namers.scala:1564)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:780)
    at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:772)
    at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1679)
    at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1687)
    at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1677)
    at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1429)
    at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1576)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4919)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5303)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5330)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5277)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5281)
    at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5359)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2998)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3102)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3102)
    at scala.collection.immutable.List.loop$1(List.scala:172)
    at scala.collection.immutable.List.mapConserve(List.scala:188)
    at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3102)
    at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:4926)
    at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5219)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5266)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5303)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5330)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5277)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5281)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5355)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
    at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:430)
    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:743)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1174)
    at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1625)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1610)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1605)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1703)
    at scala.tools.nsc.Driver.doCompile(Driver.scala:34)
    at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
    at scala.tools.nsc.Driver.process(Driver.scala:55)
    at scala.tools.nsc.Driver.main(Driver.scala:68)
    at scala.tools.nsc.Main.main(Main.scala)
@xeno-by xeno-by added this to the 2.1.0-final milestone Apr 18, 2014
@xeno-by xeno-by self-assigned this Apr 18, 2014
@xeno-by xeno-by removed this from the 2.2.0-final milestone Nov 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant