-
-
Couldn't load subscription status.
- Fork 463
-
Compilation of quite simple expression raises the following error:
invalid operation: / (mismatched types time.Time and interface {}) (1:13)
| (a - b + c) / d
| ............^
It happens because the binary minus processing has the following check:
https://github.com/antonmedv/expr/blob/2eb6a03aacf9ca8a87685a6f3b1adc3e8473b295/checker/checker.go#L262
And function isTime ends with the following:
https://github.com/antonmedv/expr/blob/2eb6a03aacf9ca8a87685a6f3b1adc3e8473b295/checker/types.go#L101
Changing of return isAny(t) to return false solves this problem.
BTW Compilation of (a + -b + c) / d and (a + c - b) / d expressions are ok w/o above change.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 1 reply
-
Please, provide full example.
Beta Was this translation helpful? Give feedback.
All reactions
-
Here you are
main.txt
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes, looks like a problem with isTime() function.
Fixed and added regression test in 23efe7b
Thanks for reporting.
Beta Was this translation helpful? Give feedback.