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

Quasiquotes emit wrong trees for secondary constructors #8451

Closed
scabug opened this issue Mar 27, 2014 · 2 comments
Closed

Quasiquotes emit wrong trees for secondary constructors #8451

scabug opened this issue Mar 27, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Mar 27, 2014

import scala.reflect.macros.whitebox._
import scala.language.experimental.macros

object Macros {
  def impl(c: Context) = {
    import c.universe._
    q"""
      class C(x: Int) {
        def this() = this(0)
      }
      ()
    """
  }

  def foo: Any = macro impl
}

object Test extends App {
  Macros.foo
}
scala.MatchError: MyID4.this.<init>(0) (of class scala.reflect.internal.Trees$Apply)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer$$anonfun$6$$anonfun$apply$5.apply(UnCurry.scala:436)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer$$anonfun$6$$anonfun$apply$5.apply(UnCurry.scala:435)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.mainTransform(UnCurry.scala:433)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:94)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:65)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2589)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2587)
        at scala.collection.immutable.List.loop$1(List.scala:172)
        at scala.collection.immutable.List.mapConserve(List.scala:188)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2587)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1397)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:40)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:40)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:40)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:40)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.scala$tools$nsc$transform$UnCurry$UnCurryTransformer$$super$transform(UnCurry.scala:451)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.mainTransform(UnCurry.scala:507)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:94)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:65)
        at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
        at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1401)
        at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1400)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1399)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.mainTransform(UnCurry.scala:510)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:94)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:65)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2589)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2587)
        at scala.collection.immutable.List.loop$1(List.scala:172)
        at scala.collection.immutable.List.mapConserve(List.scala:188)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2587)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1397)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:40)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:40)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:40)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:40)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.scala$tools$nsc$transform$UnCurry$UnCurryTransformer$$super$transform(UnCurry.scala:451)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.mainTransform(UnCurry.scala:507)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:94)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:65)
        at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
        at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1401)
        at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1400)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1399)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.mainTransform(UnCurry.scala:510)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:94)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:65)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2589)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2587)
        at scala.collection.immutable.List.loop$1(List.scala:172)
        at scala.collection.immutable.List.mapConserve(List.scala:188)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2587)
        at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1419)
        at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1419)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
        at scala.reflect.internal.Trees$class.itransform(Trees.scala:1418)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:40)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:42)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:42)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:42)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.mainTransform(UnCurry.scala:510)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:94)
        at scala.tools.nsc.transform.UnCurry$UnCurryTransformer.transform(UnCurry.scala:65)
        at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:147)
        at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:430)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:397)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:397)
        at scala.collection.Iterator$class.foreach(Iterator.scala:743)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1174)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:397)
        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 xsbt.CachedCompiler0.run(CompilerInterface.scala:123)
        at xsbt.CachedCompiler0.run(CompilerInterface.scala:99)
        at xsbt.CompilerInterface.run(CompilerInterface.scala:27)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:102)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
        at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:98)
        at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
        at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
        at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159)
        at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:97)
        at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142)
        at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36)
        at sbt.inc.Incremental$.cycle(Incremental.scala:73)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:33)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:32)
        at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:41)
        at sbt.inc.Incremental$.compile(Incremental.scala:32)
        at sbt.inc.IncrementalCompile$.apply(Compile.scala:26)
        at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150)
        at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
        at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45)
        at sbt.Compiler$.apply(Compiler.scala:70)
        at sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:736)
        at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:730)
        at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:730)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
        at sbt.std.Transform$$anon$4.work(System.scala:64)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
        at sbt.Execute.work(Execute.scala:244)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:744)
@scabug
Copy link
Author

@scabug scabug commented Mar 27, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8451?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.4, 2.11.0-RC3

@scabug
Copy link
Author

@scabug scabug commented Mar 27, 2014

@xeno-by said:
Fixes an overeager shape check in UnCurry: scala/scala#3659

@scabug scabug closed this Mar 27, 2014
@scabug scabug added the has PR label Apr 7, 2017
@scabug scabug added this to the 2.11.0-RC4 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants