Skip to content

Fix interface conversion from int types to float64#741

Closed
shrdlu68 wants to merge 1 commit into
google:masterfrom
shrdlu68:master
Closed

Fix interface conversion from int types to float64#741
shrdlu68 wants to merge 1 commit into
google:masterfrom
shrdlu68:master

Conversation

@shrdlu68
Copy link
Copy Markdown

No description provided.

@google-cla
Copy link
Copy Markdown

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
Copy Markdown
Contributor

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

Comment thread interpreter.go
return makeValueBoolean(v), nil
case int, int8, int16, int32, int64:
return makeDoubleCheck(i, v.(float64))
val, _ := v.(int64)
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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