-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
feat: Operator overload from Function #408
feat: Operator overload from Function #408
Conversation
expr.go
Outdated
@@ -127,6 +127,10 @@ func Function(name string, fn func(params ...interface{}) (interface{}, error), | |||
Func: fn, | |||
Types: ts, | |||
} | |||
c.Types[name] = conf.Tag{ |
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.
@antonmedv You said that functions can come from two places: TypesTable and Function.
So here I made the wrong decision, putting delegate from Function
to the TypesTable
? Instead, I should use config.Functions
map in the config.Check
function, and where we are searching for suitable operator overload, right?
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.
Sounds right.
71e88c2
to
7094458
Compare
I have entirely rewritten the PR. I do not no more mix Unfortunately, I can not figure out how to make work Function with the same name as Type but a different signature. I still don't know if it is a valid scenario, so I pushed my solution, missing this piece. |
|
||
} | ||
|
||
func TestOperator_FunctionOverTypesPrecedence(t *testing.T) { |
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.
As you suggested I also added test on precedence order.
Ok, looks good. Please rebase. |
In recent versions, this issue does not seem to have been solved, and it is very important for rewriting operations with functions |
Will take a look. |
4b677b2
to
d9b833c
Compare
I have rebased on the latest master. |
Closes #362