Skip to content

1.15.4 breaks function patcher, with error: expected float64, but got interface {} #473

Answered by antonmedv
tw1nk asked this question in Q&A
Discussion options

You must be logged in to vote

expected float64, but got interface {}

First about this issue. Before 1.15.4, AsFloat64() would accept float64 || any. Now it is more explicit, and accepts only float64.

You need to add AsAny():

	opts := []expr.Option{
		expr.AsFloat64(),
+		expr.AsAny(),
	}

More info in #347.

We have overriden the binary operators (&&, ||) in our code. For simple expression (Func1() || Func2()) it is working as expected, but when we introduce a complex(not so) expression (Func1() || Func2() || Func3()), it is erroring out.

Without code, it is unclear. I maybe some bug in your Patcher implementation. Tr to dump ast after patching.

Replies: 4 comments 11 replies

Comment options

You must be logged in to vote
1 reply
@antonmedv
Comment options

Comment options

You must be logged in to vote
4 replies
@rajagopal-chinnaraj
Comment options

@tw1nk
Comment options

@rajagopal-chinnaraj
Comment options

@antonmedv
Comment options

Answer selected by antonmedv
Comment options

You must be logged in to vote
4 replies
@antonmedv
Comment options

@tw1nk
Comment options

@tw1nk
Comment options

@antonmedv
Comment options

Comment options

You must be logged in to vote
2 replies
@tw1nk
Comment options

@antonmedv
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #472 on November 21, 2023 18:05.