Skip to content

Typer cycles #1422

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 3 commits into from
Oct 10, 2012
Merged

Typer cycles #1422

merged 3 commits into from
Oct 10, 2012

Conversation

paulp
Copy link
Contributor

@paulp paulp commented Sep 29, 2012

No description provided.

@paulp
Copy link
Contributor Author

paulp commented Sep 29, 2012

Review by @retronym or @adriaanm. If you're thinking I should have asked for the "cycles guy", let me post a news item. There is no cycles guy.

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/651/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1359/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1359/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/651/

@@ -1357,6 +1357,10 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
if (!isInitialized) info
this
}
def maybeInitialize = {
try { initialize ; true }
catch { case _: CyclicReference => debuglog("Hit cycle in maybeInitialize of $this") ; false }
Copy link
Member

Choose a reason for hiding this comment

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

Would it be useful to also log CyclicReference#{sym, info} here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was logging more, and I reduced it to where it is; I forget what I found out, but I remember it wasn't being useful.

@paulp
Copy link
Contributor Author

paulp commented Oct 4, 2012

I incorporated the modest feedback, modestly. Review bump bump for @adriaanm.

@paulp
Copy link
Contributor Author

paulp commented Oct 7, 2012

Something to keep in mind - this for any rubber-stamping LGTMers in the neighborhood - is that all of this commit is hidden behind -Ybreak-cycles, so it is not especially threatening.

@adriaanm
Copy link
Contributor

adriaanm commented Oct 8, 2012

sorry I've been staring at this but was distracted by changing continents
looking at it again now with foggy jetlag brain

else {
//Console.println("computing base classes of " + typeSymbol + " at phase " + phase);//DEBUG
// optimized, since this seems to be performance critical
val superclazz = tpe.firstParent
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer tpe.parents.head since it makes clear no parents are lost. It's equivalent because we know tpe.parents.nonEmpty

Copy link
Contributor

Choose a reason for hiding this comment

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

also, since parents actually does some work for existentials, maybe it would be cleaner to compute tpe.parents only once

@adriaanm
Copy link
Contributor

adriaanm commented Oct 8, 2012

LGTM irrespective of my nitpick comments

for the record, github gets first prize on confusing diff display (middle-weight category)

paulp added 3 commits October 9, 2012 14:17
Overcomes cycles encountered during classfile parsing
in possibly sketchy fashion.

  "illegal cyclic reference involving class Foo"

is the watchword.  See SI-3809.
I threw this in with the previous commit behind -Ybreak-cycles, but
this one is much less sketchy. Explanation: have to handle f-bounds
more deftly. Namers forces lower bounds to prevent recursion in
that direction, but a light touch is required to handle these two
situations differently:

  // This is a cyclic type parameter - an error is correct
  class A[T <: Comparable[_ <: T]]

  // This is not cyclic - it flips the arrow
  class B[T <: Comparable[_ >: T]]

Long have I been haunted by the knowledge that you can
write class B in java, but not in scala:

  public class B<T extends Comparable<? super T>> {}

It's over! We've achieved parity with java.
@paulp
Copy link
Contributor Author

paulp commented Oct 9, 2012

PLS REBUILD ALL

@paulp
Copy link
Contributor Author

paulp commented Oct 9, 2012

I rebased and incorporated your nitpicky comments.

@paulp
Copy link
Contributor Author

paulp commented Oct 9, 2012

(Of course I studiously ignored your substantive comments.)

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/724/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1434/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1434/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/724/

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.

4 participants