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

StackOverflow in the compiler #10228

Closed
scabug opened this issue Mar 15, 2017 · 4 comments
Closed

StackOverflow in the compiler #10228

scabug opened this issue Mar 15, 2017 · 4 comments

Comments

@scabug
Copy link

scabug commented Mar 15, 2017

trait Data { self =>
  type Type >: self.type <: Data
}
trait DataF[P <: Data, A <: DataF[P, A]] extends Data { type Type = P#Type }
type Some[A <: Data] = DataF[A, A]

def g[A <: Some[A]]: Unit = {
  implicitly[A <:< A#Type]
}
@scabug
Copy link
Author

scabug commented Mar 15, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10228?orig=1
Reporter: Alexander Konovalov (alexknvl)
Affected Versions: 2.12.1

@diesalbla
Copy link

I have just reproduced the error with Scala 2.12.7. The good news is that the recursion cycle causing it is quite short:

	at scala.reflect.internal.Types.appliedType(Types.scala:3726)
	at scala.reflect.internal.Types.appliedType$(Types.scala:3725)
	at scala.reflect.internal.SymbolTable.appliedType(SymbolTable.scala:18)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.correspondingTypeArgument(TypeMaps.scala:580)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.loop$3(TypeMaps.scala:612)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.classParameterAsSeen(TypeMaps.scala:617)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:492)
	at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:102)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:493)
	at scala.reflect.internal.Types$Type.asSeenFrom(Types.scala:695)
	at scala.reflect.internal.Types$TypeRef.relativize(Types.scala:2173)
	at scala.reflect.internal.Types$AliasTypeRef.betaReduce(Types.scala:2031)
	at scala.reflect.internal.Types$AliasTypeRef.betaReduce$(Types.scala:2031)
	at scala.reflect.internal.Types$AliasNoArgsTypeRef.betaReduce(Types.scala:2429)
 
        // The following four lines repeat continuously:  

	at scala.reflect.internal.Types$AliasTypeRef.normalizeImpl(Types.scala:2011)
	at scala.reflect.internal.Types$AliasTypeRef.normalizeImpl$(Types.scala:2010)
	at scala.reflect.internal.Types$AliasNoArgsTypeRef.normalizeImpl(Types.scala:2429)
	at scala.reflect.internal.Types$TypeRef.normalize(Types.scala:2250)

@SethTisue
Copy link
Member

what's the top of the stack trace look like? maybe not the absolute top, but the part near the top that would show what phase of compilation it's happening during

@SethTisue SethTisue added this to the Backlog milestone Nov 27, 2018
@diesalbla
Copy link

diesalbla commented Nov 27, 2018

That was the top of the stack trace, as I saw it on Scala 2.12.7. However, I have just tried this code on the 2.13 branch (the sbt scala command), and it seems that this, too, has already been fixed. This is the response it gets:

         implicitly[A <:< A#Type]
                            ^
<pastie>:8: error: malformed type: A#Type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants