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

Type-checker crashes with StackOverflowError due to illegal cyclic type dependency #5093

Closed
scabug opened this issue Oct 19, 2011 · 2 comments
Closed
Assignees

Comments

@scabug
Copy link

@scabug scabug commented Oct 19, 2011

This one-liner

class T { def f[C[X] <: C[X]](l: C[_]) = l.x }

makes scalac crash with a StackOverflowError

error: java.lang.StackOverflowError
	at scala.reflect.internal.Symbols$Symbol.isDeferred(Symbols.scala:45)
	at scala.reflect.internal.Symbols$TypeSymbol.isAliasType(Symbols.scala:2088)
	at scala.reflect.internal.Types$TypeRef.thisInfo(Types.scala:1769)
	at scala.reflect.internal.Types$TypeRef.baseClasses(Types.scala:1987)
	at scala.reflect.internal.Types$SubType.baseClasses(Types.scala:1041)
	at scala.reflect.internal.Types$TypeRef.baseClasses(Types.scala:1987)
	at scala.reflect.internal.Types$SubType.baseClasses(Types.scala:1041)
	at scala.reflect.internal.Types$TypeRef.baseClasses(Types.scala:1987)
	at scala.reflect.internal.Types$SubType.baseClasses(Types.scala:1041)
	at scala.reflect.internal.Types$TypeRef.baseClasses(Types.scala:1987)
	at scala.reflect.internal.Types$SubType.baseClasses(Types.scala:1041)
	at scala.reflect.internal.Types$TypeRef.baseClasses(Types.scala:1987)
	at scala.reflect.internal.Types$SubType.baseClasses(Types.scala:1041)
	at scala.reflect.internal.Types$TypeRef.baseClasses(Types.scala:1987)
    ...
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 19, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5093?orig=1
Reporter: @szeiger
Affected Versions: 2.9.1, 2.9.2

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 19, 2011

Commit Message Bot (anonymous) said:
(extempore in r25852) Cycle defense.

Notice when a typeref's info creates an obvious cycle, so we can see an
error instead of a stack overflow. Closes #5093, review by moors.

@scabug scabug closed this Oct 19, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.