Skip to content

Fix #1795: Avoid infinite recursion between member and asSeenFrom #1848

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

Merged
merged 2 commits into from
Dec 21, 2016

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 21, 2016

Review by @smarter ?

@odersky odersky mentioned this pull request Dec 21, 2016
@@ -67,7 +68,10 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
if (thiscls.derivesFrom(cls) && pre.baseTypeRef(thiscls).exists) {
if (theMap != null && theMap.currentVariance <= 0 && !isLegalPrefix(pre)) {
ctx.base.unsafeNonvariant = ctx.runId
AnnotatedType(pre, Annotation(defn.UnsafeNonvariantAnnot, Nil))
pre match {
case AnnotatedType(_, ann) if ann.symbol == defn.UnsafeNonvariantAnnot => pre
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's related. Before we were running into the member/asSeenFrom mutual recursion we stackoverflowed here. Avoiding this by not piling up the same annotation makes sense independently.

* of recursive member searches. If the limit is reached, findMember returns
* NoDenotation.
*/
val findMemberLimit = new Property.Key[Int]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since PendingFindMemberLimit is a constant I would just make this a boolean

@smarter
Copy link
Member

smarter commented Dec 21, 2016

LGTM

@smarter smarter merged commit f3bf225 into scala:master Dec 21, 2016
@allanrenucci allanrenucci deleted the fix-#1795 branch December 14, 2017 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants