-
Notifications
You must be signed in to change notification settings - Fork 21
A new contender for the title of Shortest Compiler Slayer #10731
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
Comments
That's a good one, but there are some caveats that figure into how the judges score the routine. The shortest crasher has to be a compilation unit, not a snippet. Yes, that's a high bar. Also, points are deducted for crashes landing in RefChecks, which are less highly esteemed than actual typechecking bugs. Leaking erroneous trees has a long and storied history, e.g., #4425, reported by propensive, who happens to hold the shortest crasher title. Just as they added ice dancing and synchronized swimming to the Olympics, scala center might be persuaded to award the fastest crasher, as measured by the new compiler statistics. That would probably happen in parser, however. Crashes in linting are strictly disallowed as they are not a true compiler sport, much like a gold medal in baseball or tennis. Error recovery is challenging for a compiler, but scalac feels so bad about telling you that your program can't work, it prefers to procrastinate about giving you the bad news. In some cases, the compiler will just go on compiling for hours rather than see the look on your face when it can't find an implicit and you have no idea what import is missing. |
I did just receive a certificate from scala center for shortest fix for a short compiler slayer. I was hoping for a coupon at the scala store... |
PR: scala/scala#6334 |
I've seen it asked several times now if this is valid syntax. it is; it's a pattern match. demonstration: Welcome to Scala 2.12.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_162).
Type in expressions for evaluation. Or try :help.
scala> object a { val b = 3 }
defined object a
scala> val a.b = 4
scala.MatchError: 4 (of class java.lang.Integer)
... 28 elided
scala> val a.b = 3 |
The result could never be stable... TODO: better error message Tests for scala/bug#10474, scala/bug#10731
A method is not a value, and thus must somehow be converted to an expression -- unless we're specifically looking for a method. We can either insert an application (to implicit args or empty arg list), or lift to a function by eta-expansion. If those are not possible, we report an error (unstable tree -- could be refined further). Tests for scala/bug#10474, scala/bug#10731
Fixed in scala/scala#6273 |
Found thanks to @emilypi (most credit goes to her)
Tested in 2.13.0-M3 REPL
The text was updated successfully, but these errors were encountered: