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: fix conversion from int to float64 #753

Merged
merged 2 commits into from
Jun 9, 2024
Merged

fix: fix conversion from int to float64 #753

merged 2 commits into from
Jun 9, 2024

Conversation

suzuki-shunsuke
Copy link
Contributor

Close #752

This pull request is similar to #741 , but this pull request fixes a bug of #741 .

```
cannot convert v (variable of type interface{}) to type float64: need type assertion
```
@suzuki-shunsuke suzuki-shunsuke marked this pull request as ready for review June 3, 2024 04:03
Comment on lines +952 to +961
case int:
return makeDoubleCheck(i, float64(v))
case int8:
return makeDoubleCheck(i, float64(v))
case int16:
return makeDoubleCheck(i, float64(v))
case int32:
return makeDoubleCheck(i, float64(v))
case int64:
return makeDoubleCheck(i, float64(v))
Copy link
Contributor Author

@suzuki-shunsuke suzuki-shunsuke Jun 3, 2024

Choose a reason for hiding this comment

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

We can't merge these case for type assertion.
If these case are merged, the type of v becomes interface{} so we can't convert the value to float64.

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

@sbarzowski sbarzowski merged commit 4324105 into google:master Jun 9, 2024
4 of 9 checks passed
@sbarzowski
Copy link
Collaborator

Thank you!

@suzuki-shunsuke suzuki-shunsuke deleted the fix-convert-int-to-float64 branch June 9, 2024 20:34
vhata pushed a commit to discord/go-jsonnet that referenced this pull request Aug 30, 2024
* fix: fix conversion from int to float64

* fix: fix a compile error

```
cannot convert v (variable of type interface{}) to type float64: need type assertion
```
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.

INTERNAL ERROR: (CRASH) interface conversion: interface {} is int, not float64
2 participants