-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use new extension syntax in scala.tasty.Reflection #9311
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
Use new extension syntax in scala.tasty.Reflection #9311
Conversation
36887b9
to
ea13bbc
Compare
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.
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 |
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.
This seems to suggest something is wrong with the language design.
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.
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) |
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.
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
@anatoliykmetyuk could you should review the changes in the community build. I removed the |
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.
utest LGTM
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.