-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use context for buffering errors that cannot/shouldn't be reported in…
… the given moment (instead of throwing type errors). This avoids previous problems where we were creating fake error trees in some incorrect places like in type completers in Namers etc. Implicits relied heavily on type errors being thrown but performance should stay the same due to some explicit checks/returns. Some of the problems involved how ambiguous error messages were collected/reported because it was very random (similarly for divergent implicits). This should be more explicit now. Reduced the number of unnecessary cyclic references being thrown (apart from those in Symbols/Types which don't have a context and need to stay for now as is). Review by @paulp, @odersky.
- Loading branch information
Showing
34 changed files
with
2,149 additions
and
1,198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
c800d1f
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.
I'd recommend turning the asserts you've added in this commit into debug log statements with meaningful output.
I already tripped on one of them ("try typed args is ok" -- but what does it meeeeaaaan!?) -- see
scala/src/compiler/scala/tools/nsc/typechecker/Typers.scala
Line 3483 in c800d1f
I tried to extract a reproducable snippet, but couldn't trigger the condition outside of the context of PatMatVirtualizer.scala
the typo (casesDefs) in the following snippet triggered it the first time:
c800d1f
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.
That must have slipped through my cleaning process.
I put asserts as a way of failing quickly because test suite for sure wouldn't catch every corner case (and recent sbt bug was an example of that). On the other hand bugs will be bugs and they will be discovered by users eventually (just might be a bit harder to locate).
I will fix it soon.
c800d1f
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.
Indeed, we shouldn't hide bugs. We should fail more gracefully and more descriptively, though.
c800d1f
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.
Yeah, I've fixed too many of our crashes over the years simply by removing overreaching asserts. If it isn't certain to catastrophically fail in a confusing fashion further down the line, an assert is probably the wrong tool for the job.
BTW I have a method called "debugwarn" which is intended for things which happen which you as a developer want to see, but normal users of the compiler shouldn't. Unfortunately -Ydebug is way too noisy for this to serve its intended purpose, because I want it to be on all the time for me. All part of the long-needed gigantic output control overhaul.
c800d1f
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.
debugwarn is definitely what I would be looking for.
btw your old friend 'events' is on one of my branches (merged with a pretty recent trunk) so if you are looking for some fine grained debugging, be my guest.