Use new extension syntax in scala.tasty.Reflection#9311
Merged
nicolasstucki merged 2 commits intoscala:masterfrom Jul 8, 2020
Merged
Use new extension syntax in scala.tasty.Reflection#9311nicolasstucki merged 2 commits intoscala:masterfrom
nicolasstucki merged 2 commits intoscala:masterfrom
Conversation
36887b9 to
ea13bbc
Compare
liufengyun
approved these changes
Jul 7, 2020
Contributor
liufengyun
left a comment
There was a problem hiding this comment.
LGTM
Community build failed.
| extension ContextOps on (self: Context) { | ||
| /** Returns the owner of the context */ | ||
| def owner: Symbol = internal.Context_owner(self) | ||
| given ContextOps as Context.type = Context |
Contributor
There was a problem hiding this comment.
This seems to suggest something is wrong with the language design.
Contributor
Author
There was a problem hiding this comment.
It is more about the automatically imported scopes for abstract types. With opaque types we look into the module but for these ones we are missing it. I plan on minimizing this limitation and ideally remove those givens later
| object Context: | ||
| extension (self: Context): | ||
| /** Returns the owner of the context */ | ||
| def owner: Symbol = internal.Context_owner(self) |
Contributor
There was a problem hiding this comment.
The previous extension methods syntax seems much better for this use case.
dd81139 to
43bbbdd
Compare
Extension are placed within the module of the type. For example, the extension `Tree.pos` will be available explicitly and in the documentation as `Tree.extension_pos`. We still need to add an `given XYZOps as XYZ.type = XYZ` to make the extension methods available.
43bbbdd to
df07233
Compare
Contributor
Author
|
@anatoliykmetyuk could you should review the changes in the community build. I removed the |
odersky
approved these changes
Jul 8, 2020
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extension are placed within the module of the type. For example, the extension
Tree.poswill be available explicitly and in the documentation as
Tree.extension_pos.We still need to add an
given XYZOps as XYZ.type = XYZto make the extension methods available.