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
Stack overflow regression in typer #7126
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7126?orig=1
|
@retronym said: |
@JamesIry said: |
@paulp said: This line suggests that normalize should indeed be called, and it also doesn't look at all sensible to me that super.dealias when the condition is hit (which is not often, apparently.) By inspection, it looks like it will only mask bugs. override def dealias = if (typeParamsMatchArgs) betaReduce.dealias else super.dealias |
@paulp said: val args1 = if (sameLength(args, tparams)) {
//@M: in case TypeApply we can't check the kind-arities of the type arguments,
// as we don't know which alternative to choose... here we do
map2Conserve(args, tparams) {
//@M! the polytype denotes the expected kind
(arg, tparam) => typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyClass.tpe))
}
} else // @M: there's probably something wrong when args.length != tparams.length... (triggered by bug #320)
// Martin, I'm using fake trees, because, if you use args or arg.map(typedType),
// inferPolyAlternatives loops... -- I have no idea why :-(
// ...actually this was looping anyway, see bug #278.
return TypedApplyWrongNumberOfTpeParametersError(fun, fun) One of those old beloved comments, "there's probably something wrong when args.length != tparams.length", yeah. Notice the usage of Any, which is kind-polymorphic, a code phrase which means "there will be bugs" in the mother tongue. We shouldn't have to work so hard to prevent type constructors which are being checked for well-kindedness from being confused with applied types and/or types undergoing other checks like bounds conformance. Aka explicit kinds. |
@retronym said: type T = Any
boom(???): Option[T] // SOE
def boom[CC[U]](t : CC[T]): Option[CC[T]] = None
// okay
foo(???): Option[Any]
def foo[CC[U]](t : CC[Any]): Option[CC[Any]] = None Is there an in-flight patch for this? If not I can submit one. |
@paulp said: |
@retronym said: |
Tony Sloane (asloane) said: I'm curious the fix version is now Scala 2.11.0-M2. Since this is a regression from 2.10.0 I was hoping to see a fix in 2.10.1. |
@retronym said (edited on Feb 26, 2013 6:05:24 PM UTC):
What happens is that we have a higher kinded type ref encoded (again) as an For example: type L[X] = Any
// <L>.dealias eq <L>
// <L>.etaExpand == <[X]Any> I'm not sure what conclusions to draw from all of this. Maybe a split I'm running a test now to see with: final def typeParamsMatchArgs = if (typeParamsMatchArgs0) true
else if (isHigherKinded && args.isEmpty) false
else { debugwarn(s"$this.typeParamsMatchArgs = false for non-higher-kinded type"); false} to see if there are any ground type refs that that get into this spot. |
@adriaanm said: |
@paulp said: |
@retronym said: |
@gkossakowski said: |
@adriaanm said: |
Tony Sloane (asloane) said: |
@gkossakowski said: |
I changed my Kiama library's sbt build scalaVersion from 2.10.0 to 2.10.1-RC1 and now when I compile I get a stack overflow in the typer. All was fine with 2.10.0.
I'm still narrowing the code down but I wanted to report it quickly since this is an RC.
The attached file Rewriter.scala contains the childSeq method in which the crash occurs (line 438). I've attached the crash report and the top of the stack trace is:
[error] uncaught exception during compilation: java.lang.StackOverflowError
java.lang.StackOverflowError
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1239)
at scala.reflect.internal.Types$TypeRef.initializedTypeParams(Types.scala:2400)
at scala.reflect.internal.Types$TypeRef.typeParamsMatchArgs(Types.scala:2401)
at scala.reflect.internal.Types$AliasTypeRef$class.dealias(Types.scala:2224)
at scala.reflect.internal.Types$TypeRef$$anon$1.dealias(Types.scala:2526)
at scala.tools.nsc.typechecker.Typers$Typer.dropExistential(Typers.scala:224)
at scala.tools.nsc.typechecker.Typers$Typer.dropExistential(Typers.scala:225)
at scala.tools.nsc.typechecker.Typers$Typer.dropExistential(Typers.scala:225)
at scala.tools.nsc.typechecker.Typers$Typer.dropExistential(Typers.scala:225)
at scala.tools.nsc.typechecker.Typers$Typer.dropExistential(Typers.scala:225)
The text was updated successfully, but these errors were encountered: