scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

StackOverflow exception during compilation of non-trivial macro (writeAll inside async) #9002

Open scabug opened 9 years ago

scabug commented 9 years ago

When trying to compile project, attached to issue:

object Main
{

  def process(in: IOChannel[Int], regex: Regex, maxPages:Int): Future[Unit] =
  {
       async {
           in.writeAll(List(1,2,3))
       }
  }

  val actorSystem = ActorSystem.create("actorSystem")
  val gopherApi = Gopher(actorSystem)

}

receive StackOverflowError (listed below) If enable Ymacro-debug-lite, than we can see how typer attempt to expand in.write forever.

receive:java.lang.StackOverflowError
    at java.io.InputStream.<init>(InputStream.java:45)
    at java.util.zip.ZipFile$ZipFileInputStream.<init>(ZipFile.java:695)
    at java.util.zip.ZipFile.getInputStream(ZipFile.java:361)
    at java.util.jar.JarFile.getInputStream(JarFile.java:447)
    at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:776)
    at sun.misc.Resource.cachedInputStream(Resource.java:77)
    at sun.misc.Resource.getByteBuffer(Resource.java:160)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at scala.tools.nsc.typechecker.Typers$Typer.TyperErrorGen$lzycompute(Typers.scala:107)
    at scala.tools.nsc.typechecker.Typers$Typer.TyperErrorGen(Typers.scala:107)
    at scala.tools.nsc.typechecker.Macros$MacroExpander$$anonfun$expand$1.apply(Macros.scala:591)
    at scala.tools.nsc.typechecker.Macros$MacroExpander$$anonfun$expand$1.apply(Macros.scala:565)
    at scala.tools.nsc.Global.withInfoLevel(Global.scala:199)
    at scala.tools.nsc.typechecker.Macros$MacroExpander.expand(Macros.scala:564)
    at scala.tools.nsc.typechecker.Macros$MacroExpander.apply(Macros.scala:552)
    at scala.tools.nsc.typechecker.Macros$class.standardMacroExpand(Macros.scala:716)
    at scala.tools.nsc.Global$$anon$1.standardMacroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:400)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:397)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:369)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsMacroExpand(AnalyzerPlugins.scala:397)
    at scala.tools.nsc.Global$$anon$1.pluginsMacroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.Macros$class.macroExpand(Macros.scala:709)
    at scala.tools.nsc.Global$$anon$1.macroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1077)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1132)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5309)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:3094)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedArgToPoly$1(Typers.scala:3429)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$68.apply(Typers.scala:3437)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$68.apply(Typers.scala:3437)
    at scala.reflect.internal.util.Collections$class.map2(Collections.scala:79)
    at scala.reflect.internal.SymbolTable.map2(SymbolTable.scala:16)
    at scala.tools.nsc.typechecker.Typers$Typer.handlePolymorphicCall$1(Typers.scala:3437)
    at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3448)
    at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4451)
    at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4484)
    at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5242)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Typers$Typer.typedTyped$1(Typers.scala:5014)
    at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5245)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Macros$DefMacroExpander.typecheck$1(Macros.scala:627)
    at scala.tools.nsc.typechecker.Macros$DefMacroExpander.onSuccess(Macros.scala:635)
    at scala.tools.nsc.typechecker.Macros$MacroExpander$$anonfun$expand$1.apply(Macros.scala:578)
    at scala.tools.nsc.typechecker.Macros$MacroExpander$$anonfun$expand$1.apply(Macros.scala:565)
    at scala.tools.nsc.Global.withInfoLevel(Global.scala:199)
    at scala.tools.nsc.typechecker.Macros$MacroExpander.expand(Macros.scala:564)
    at scala.tools.nsc.typechecker.Macros$MacroExpander.apply(Macros.scala:552)
    at scala.tools.nsc.typechecker.Macros$class.standardMacroExpand(Macros.scala:716)
    at scala.tools.nsc.Global$$anon$1.standardMacroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:400)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:397)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:369)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsMacroExpand(AnalyzerPlugins.scala:397)
    at scala.tools.nsc.Global$$anon$1.pluginsMacroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.Macros$class.macroExpand(Macros.scala:709)
    at scala.tools.nsc.Global$$anon$1.macroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1077)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1132)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5309)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:3094)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedArgToPoly$1(Typers.scala:3429)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$68.apply(Typers.scala:3437)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$68.apply(Typers.scala:3437)
    at scala.reflect.internal.util.Collections$class.map2(Collections.scala:79)
    at scala.reflect.internal.SymbolTable.map2(SymbolTable.scala:16)
    at scala.tools.nsc.typechecker.Typers$Typer.handlePolymorphicCall$1(Typers.scala:3437)
    at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3448)
    at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4451)
    at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4484)
    at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5242)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Typers$Typer.typedTyped$1(Typers.scala:5014)
    at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5245)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Macros$DefMacroExpander.typecheck$1(Macros.scala:627)
    at scala.tools.nsc.typechecker.Macros$DefMacroExpander.onSuccess(Macros.scala:635)
    at scala.tools.nsc.typechecker.Macros$MacroExpander$$anonfun$expand$1.apply(Macros.scala:578)
    at scala.tools.nsc.typechecker.Macros$MacroExpander$$anonfun$expand$1.apply(Macros.scala:565)
    at scala.tools.nsc.Global.withInfoLevel(Global.scala:199)
    at scala.tools.nsc.typechecker.Macros$MacroExpander.expand(Macros.scala:564)
    at scala.tools.nsc.typechecker.Macros$MacroExpander.apply(Macros.scala:552)
    at scala.tools.nsc.typechecker.Macros$class.standardMacroExpand(Macros.scala:716)
    at scala.tools.nsc.Global$$anon$1.standardMacroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:400)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:397)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:369)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsMacroExpand(AnalyzerPlugins.scala:397)
    at scala.tools.nsc.Global$$anon$1.pluginsMacroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.Macros$class.macroExpand(Macros.scala:709)
    at scala.tools.nsc.Global$$anon$1.macroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1077)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1132)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5309)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:3094)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedArgToPoly$1(Typers.scala:3429)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$68.apply(Typers.scala:3437)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$68.apply(Typers.scala:3437)
    at scala.reflect.internal.util.Collections$class.map2(Collections.scala:79)
    at scala.reflect.internal.SymbolTable.map2(SymbolTable.scala:16)
    at scala.tools.nsc.typechecker.Typers$Typer.handlePolymorphicCall$1(Typers.scala:3437)
    at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3448)
    at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4451)
    at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4484)
    at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5242)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Typers$Typer.typedTyped$1(Typers.scala:5014)
    at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5245)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Macros$DefMacroExpander.typecheck$1(Macros.scala:627)
    at scala.tools.nsc.typechecker.Macros$DefMacroExpander.onSuccess(Macros.scala:635)
    at scala.tools.nsc.typechecker.Macros$MacroExpander$$anonfun$expand$1.apply(Macros.scala:578)
    at scala.tools.nsc.typechecker.Macros$MacroExpander$$anonfun$expand$1.apply(Macros.scala:565)
    at scala.tools.nsc.Global.withInfoLevel(Global.scala:199)
    at scala.tools.nsc.typechecker.Macros$MacroExpander.expand(Macros.scala:564)
    at scala.tools.nsc.typechecker.Macros$MacroExpander.apply(Macros.scala:552)
    at scala.tools.nsc.typechecker.Macros$class.standardMacroExpand(Macros.scala:716)
    at scala.tools.nsc.Global$$anon$1.standardMacroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:400)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:397)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.invoke(AnalyzerPlugins.scala:369)
    at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsMacroExpand(AnalyzerPlugins.scala:397)
    at scala.tools.nsc.Global$$anon$1.pluginsMacroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.Macros$class.macroExpand(Macros.scala:709)
    at scala.tools.nsc.Global$$anon$1.macroExpand(Global.scala:450)
    at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1077)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1132)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5309)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273)
    at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:3094)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedArgToPoly$1(Typers.scala:3429)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$68.apply(Typers.scala:3437)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$68.apply(Typers.scala:3437)
    at scala.reflect.internal.util.Collections$class.map2(Collections.scala:79)
    at scala.reflect.internal.SymbolTable.map2(SymbolTable.scala:16)
    at scala.tools.nsc.typechecker.Typers$Typer.handlePolymorphicCall$1(Typers.scala:3437)
    at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3448)
    at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4451)
    at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4484)
    at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5242)
    at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269)
scabug commented 9 years ago

Imported From: https://issues.scala-lang.org/browse/SI-9002?orig=1 Reporter: ruslan shevchenko (rssh) Affected Versions: 2.11.4 Attachments: