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

Invalid number of arguments to an applyDynamicNamed method results in StackOverflowError #8006

Closed
scabug opened this issue Nov 23, 2013 · 2 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Nov 23, 2013

When one tries to compile some code with an applyDynamicNamed method call, that has an invalid number of arguments, a StackOverflowError occurs:

object X {
  val d = new D
  d.meth(value1 = 10, value2 = 100) // two arguments here, but only one is allowed
}
import language.dynamics
class D extends Dynamic {
  def applyDynamicNamed(name: String)(value: (String, Any)) = name
}

Compiled with scalac x.scala:

uncaught exception during compilation: java.lang.StackOverflowError
error: java.lang.StackOverflowError
	at scala.tools.nsc.typechecker.AnalyzerPlugins$AnalyzerPlugin$class.isActive(AnalyzerPlugins.scala:31)
	at scala.tools.selectivecps.CPSAnnotationChecker$plugin$.isActive(CPSAnnotationChecker.scala:122)
	at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$pluginsPt$1.apply(AnalyzerPlugins.scala:175)
	at scala.tools.nsc.typechecker.AnalyzerPlugins$$anonfun$pluginsPt$1.apply(AnalyzerPlugins.scala:174)
	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
	at scala.collection.immutable.List.foldLeft(List.scala:84)
	at scala.tools.nsc.typechecker.AnalyzerPlugins$class.pluginsPt(AnalyzerPlugins.scala:174)
	at scala.tools.nsc.Global$$anon$1.pluginsPt(Global.scala:492)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5607)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$95.apply(Typers.scala:4615)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$95.apply(Typers.scala:4615)
	at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:726)
	at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4615)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4666)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5552)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5630)
	at scala.tools.nsc.typechecker.Typers$Typer$dyna$$anonfun$typedNamedApply$1.apply(Typers.scala:4060)
	at scala.tools.nsc.typechecker.Typers$Typer$dyna$$anonfun$typedNamedApply$1.apply(Typers.scala:4060)
	at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:744)
	at scala.tools.nsc.typechecker.Typers$Typer$dyna$.wrapErrors(Typers.scala:4125)
	at scala.tools.nsc.typechecker.Typers$Typer$dyna$.typedNamedApply(Typers.scala:4060)
	at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3304)
	at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4634)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4666)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5552)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5630)
	at scala.tools.nsc.typechecker.Typers$Typer$dyna$$anonfun$typedNamedApply$1.apply(Typers.scala:4060)
	at scala.tools.nsc.typechecker.Typers$Typer$dyna$$anonfun$typedNamedApply$1.apply(Typers.scala:4060)
	at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:744)
	at scala.tools.nsc.typechecker.Typers$Typer$dyna$.wrapErrors(Typers.scala:4125)
	at scala.tools.nsc.typechecker.Typers$Typer$dyna$.typedNamedApply(Typers.scala:4060)
	at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3304)
	at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4634)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4666)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5552)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5630)
<repeat until death>
@scabug
Copy link
Author

@scabug scabug commented Nov 23, 2013

Imported From: https://issues.scala-lang.org/browse/SI-8006?orig=1
Reporter: @sschaef
Affected Versions: 2.11.0

@scabug
Copy link
Author

@scabug scabug commented Dec 27, 2013

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