-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #3703: Various fixes to make printing more robust in face of errors #3705
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@odersky Both added test cases now compile on master without the changes in this PR. Do you still want to merge the changes?
@allanrenucci Yes, these were some random problems encountered when playing with diagnostics while trying to understand previous bugs. |
if (ctx.settings.uniqid.value) "#" + pt.hashCode else "" | ||
if (ctx.settings.uniqid.value) | ||
try "#" + pt.hashCode | ||
catch { case ex: NullPointerException => "" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we do a null check first instead of catching NullPointerException ? This is fishy in general and is also not something that can be done on Scala.js by default (https://www.scala-js.org/doc/semantics.html)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, hashCode is computed, the null could be in a referenced type.
def refTxt = | ||
try toTextGlobal(tp.ref) | ||
catch { | ||
case ex: Throwable => Str("...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just to catch infinite loops in LazyRefs? If so I'd just catch StackOverflowException, though I think it'd be cleaner to do loop detection in LazyRef#ref
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's to detect stack overflows. Evaluation of LazyRefs is not tail-recursive, so we will always get a stack overflow. Maybe we can do a better job in loop detection but I believe the two issues are separate.
It succeeds now, still worth keeping.
No description provided.