-
Notifications
You must be signed in to change notification settings - Fork 53
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
Extension copy #262
Extension copy #262
Conversation
I am familiarizing myself with the |
First test passed: extension is found in a companion object of a plain class. This needed some adjustments in how is |
5f33083
to
0ba4cf8
Compare
More progress: I can use extensions to read source values as well. There are few things I was struggling with. Most of them are related to the fact the functions are operating on symbols ( The last step is to support opaque types. In first attempts I get assertions in the compiler when using them, hopefully I will be able to work through this somehow. |
I have hit a kind of obstacle: scala/scala3#22143 I am able to access the fields using extension methods, but if the underlying type already has fields with corresponding names, The whole |
d839147
to
1cdfa2b
Compare
I think it should be done now. |
63f5866
to
c08a747
Compare
c08a747
to
baf9bcc
Compare
quicklens/src/test/scala-3/com/softwaremill/quicklens/test/ExtensionCopyTest.scala
Outdated
Show resolved
Hide resolved
@KacperFKorban maybe you could take a look as well? |
@adamw Sure, I'll review it it on Monday. |
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 figured that it would be faster to just push some changes directly to the branch, hope you don't mind @OndrejSpanel
Looks good overall!
@@ -351,6 +427,7 @@ object QuicklensMacros { | |||
def mapToCopy(owner: Symbol, mod: Expr[A => A], objTerm: Term, pathTree: PathTree): Term = pathTree match { | |||
case PathTree.Empty => | |||
val apply = termMethodByNameUnsafe(mod.asTerm, "apply") | |||
// TODO: calling extension may be necessary here |
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.
Is this still relevant? AFAIK this is just the modification function being called.
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.
@OndrejSpanel This comment might've slipped through. Do you remember the reasoning behind this?
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 think it was just a comment made during exploration and it should be removed.
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.
Ok, Thanks!
Sure, better than requesting me to do them. I will have some questions regarding some changes. |
quicklens/src/main/scala-3/com/softwaremill/quicklens/QuicklensMacros.scala
Show resolved
Hide resolved
quicklens/src/main/scala-3/com/softwaremill/quicklens/QuicklensMacros.scala
Show resolved
Hide resolved
quicklens/src/main/scala-3/com/softwaremill/quicklens/QuicklensMacros.scala
Outdated
Show resolved
Hide resolved
Great, thanks! :) |
Started work on #234 by creating target test.
At the moment the test is failing with:
I am not sure how far I will get, I never tried to access extensions from macros, but hopefully it should be possible.