-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Unified extension methods #9255
Commits on Jul 4, 2020
-
Dotty currently uses three syntactically different schemes for extension methods 1. Single methods with prefix parameters such as `def (x: T).f(y: U)` or `def (x: T) op (y: U)`. These methods can be abstract, can override each other, etc, which is crucial for infix ops in type classes. 2. Given instances defining (only) extension methods with syntax `extension ops { ... }` 3. Collective extension methods with syntax `extension on (x: T) { ... }` This PR proposes another scheme that unifies (1) and (3) and all but eliminates the need for (2). The simplification is achieved by redefining many fundamentals of extension methods. In a sense, the price we pay for user-facing simplifications is a more complex implementation scheme. But that's probably a price worth paying. The first commit is docs only. I updated the doc pages for extension methods, type classes, and the grammar.
Configuration menu - View commit details
-
Copy full SHA for 3cc3745 - Browse repository at this point
Copy the full SHA 3cc3745View commit details -
Configuration menu - View commit details
-
Copy full SHA for d88a796 - Browse repository at this point
Copy the full SHA d88a796View commit details -
Configuration menu - View commit details
-
Copy full SHA for f0c2e19 - Browse repository at this point
Copy the full SHA f0c2e19View commit details -
Configuration menu - View commit details
-
Copy full SHA for f87ec07 - Browse repository at this point
Copy the full SHA f87ec07View commit details -
Configuration menu - View commit details
-
Copy full SHA for e5ca6d5 - Browse repository at this point
Copy the full SHA e5ca6d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 02de5dc - Browse repository at this point
Copy the full SHA 02de5dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 70d5ec8 - Browse repository at this point
Copy the full SHA 70d5ec8View commit details -
Update semanticDB expect files
We should check that semanticDB does the right thing for extension methods
Configuration menu - View commit details
-
Copy full SHA for 28ef7b6 - Browse repository at this point
Copy the full SHA 28ef7b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 74865c3 - Browse repository at this point
Copy the full SHA 74865c3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4c50dbd - Browse repository at this point
Copy the full SHA 4c50dbdView commit details -
Look for extension methods directly in implicit scope
Look for extension methods also directly in the objects that make up an implicit scope.
Configuration menu - View commit details
-
Copy full SHA for 5b1a2f7 - Browse repository at this point
Copy the full SHA 5b1a2f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 71a853a - Browse repository at this point
Copy the full SHA 71a853aView commit details -
Configuration menu - View commit details
-
Copy full SHA for fb93f46 - Browse repository at this point
Copy the full SHA fb93f46View commit details -
Make type parameters after extension method
def
illegalWe'd have to at least check that there's no use before definition. Forbid for now, and come back once we support multiple type parameter clauses.
Configuration menu - View commit details
-
Copy full SHA for 1ad5ee9 - Browse repository at this point
Copy the full SHA 1ad5ee9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6ff0ac8 - Browse repository at this point
Copy the full SHA 6ff0ac8View commit details -
Configuration menu - View commit details
-
Copy full SHA for c148218 - Browse repository at this point
Copy the full SHA c148218View commit details -
Configuration menu - View commit details
-
Copy full SHA for 330c32f - Browse repository at this point
Copy the full SHA 330c32fView commit details -
Disable check file for missing-implicit
CI makes more suggestions than local on bootstrapped tests. I am not sure why. It might have to do with different setups what packages are forced and what not.
Configuration menu - View commit details
-
Copy full SHA for b63da92 - Browse repository at this point
Copy the full SHA b63da92View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3e89b56 - Browse repository at this point
Copy the full SHA 3e89b56View commit details -
Fix extension method search in implicit scope
The case where a scope contained only extension methods but no other givens was mishandled.
Configuration menu - View commit details
-
Copy full SHA for a7213cc - Browse repository at this point
Copy the full SHA a7213ccView commit details -
Configuration menu - View commit details
-
Copy full SHA for 00cc25d - Browse repository at this point
Copy the full SHA 00cc25dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5cdb3da - Browse repository at this point
Copy the full SHA 5cdb3daView commit details -
Configuration menu - View commit details
-
Copy full SHA for ce6d9ca - Browse repository at this point
Copy the full SHA ce6d9caView commit details -
Configuration menu - View commit details
-
Copy full SHA for 40667a6 - Browse repository at this point
Copy the full SHA 40667a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3188b43 - Browse repository at this point
Copy the full SHA 3188b43View commit details -
Handle missing case for extension/conversion ambiguity
If a candidate can be both a conversion and an extension, which happens if it is overloaded, and the extension is not applicable, try the conversion.
Configuration menu - View commit details
-
Copy full SHA for 2cd1092 - Browse repository at this point
Copy the full SHA 2cd1092View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8529885 - Browse repository at this point
Copy the full SHA 8529885View commit details -
Configuration menu - View commit details
-
Copy full SHA for c1b5150 - Browse repository at this point
Copy the full SHA c1b5150View commit details -
Check files should be only added if they test a tricky error message, typically one with lots of configurable parts. A simple string error message should never lead to a check file. Having too many check file just causes unnecessary friction for me and the other maintainers.
Configuration menu - View commit details
-
Copy full SHA for e33d36f - Browse repository at this point
Copy the full SHA e33d36fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 026b58a - Browse repository at this point
Copy the full SHA 026b58aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 01ec288 - Browse repository at this point
Copy the full SHA 01ec288View commit details -
Configuration menu - View commit details
-
Copy full SHA for 17a8026 - Browse repository at this point
Copy the full SHA 17a8026View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7de235d - Browse repository at this point
Copy the full SHA 7de235dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4aae35c - Browse repository at this point
Copy the full SHA 4aae35cView commit details -
Configuration menu - View commit details
-
Copy full SHA for c8d7be1 - Browse repository at this point
Copy the full SHA c8d7be1View commit details -
Configuration menu - View commit details
-
Copy full SHA for a128dab - Browse repository at this point
Copy the full SHA a128dabView commit details -
Configuration menu - View commit details
-
Copy full SHA for b179a8e - Browse repository at this point
Copy the full SHA b179a8eView commit details
Commits on Jul 5, 2020
-
There's will probably be a tendency to put a `:` in a collective extension by analogy to given and object, trait etc. We don't need to be picky about this.
Configuration menu - View commit details
-
Copy full SHA for e160140 - Browse repository at this point
Copy the full SHA e160140View commit details