-
Notifications
You must be signed in to change notification settings - Fork 64
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
Added Avram::Join::Raw. #1050
base: main
Are you sure you want to change the base?
Added Avram::Join::Raw. #1050
Conversation
self | ||
end | ||
|
||
def joins : Array(Avram::Join::Raw) |
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 method would override the methods on 318 of the same name
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 method would override the methods on 318 of the same name
I thought override
is not so accurately, because the return value of both method is different, the issue is, when joins_sql
invoke joins
metrhod, it can't distinguish the difference between the two method.
I have no idea about how to fix this, could you please give me a little clue?
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.
Crystal does not factor in return type when determining a method's signature, at least for overrides. There is no way during method call to determine which of the variants to dispatch to if they only differ in return types. So in this case, yes, the second method will override the first.
How about renaming the method to #raw_joins
?
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.
Crystal does not factor in return type when determining a method's signature, at least for overrides. There is no way during method call to determine which of the variants to dispatch to if they only differ in return types.
I guess it's can?
def hello : String
"hello"
end
def hello : Int32
100
end
def say_hello : Int32
hello
end
p! say_hello # => 100
How about renaming the method to #raw_joins?
I remember i tried it like this, but that #raw_joins method never by invoked some where, there are some(probably macro?) magic happen some where, i didn't found it.
It's a good start! Thanks for taking this on. You're definitely going to need to add a bunch of specs for this. I would suggest to start working through some of those specs to make sure all of the SQL being generated is correct. That may help get through these CI errors. |
Yes, I am trying to see if it is possible to add this new feature but without need change the existing spec. (only add more) |
Fix #1048