Skip to content
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

Fix interface conversion from int types to float64 #741

Closed
wants to merge 1 commit into from

Conversation

shrdlu68
Copy link

No description provided.

Copy link

google-cla bot commented Jan 11, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@shrdlu68 shrdlu68 force-pushed the master branch 2 times, most recently from 4803df9 to 92a842f Compare January 11, 2024 17:07
@suzuki-shunsuke
Copy link
Contributor

Can we get a chance to review this pull request?
I wrote an issue about this pull request.

@@ -950,7 +950,8 @@ func jsonToValue(i *interpreter, v interface{}) (value, error) {
case bool:
return makeValueBoolean(v), nil
case int, int8, int16, int32, int64:
return makeDoubleCheck(i, v.(float64))
val, _ := v.(int64)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we need to convert the value to int64.

Is the following code wrong?

return makeDoubleCheck(i, float64(v))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

makeDoubleCheck(i, float64(v)) causes a compile error.

cannot convert v (variable of type interface{}) to type float64: need type assertion

@suzuki-shunsuke
Copy link
Contributor

suzuki-shunsuke commented Jun 3, 2024

I'm trying this pull request, but this doesn't work as expected.
panic doesn't occur but the return value is always 0.

@sbarzowski
Copy link
Collaborator

Closing in favour of #753

@sbarzowski sbarzowski closed this Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants