Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix two bugs related to type conversion #1199

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

Merged
merged 2 commits into from
Jun 11, 2023

Conversation

nevkontakte
Copy link
Member

  • When converting between pointers to structs, gopherjs incorrectly used underlying type as a conversion target.
  • Assignment operator didn't handle implicit type conversion between named and anonymous types.

Consider types `type S struct{}` and `type SP *S`. Prior to this change,
converting a value of `*S` type to `SP` would actually result in a value
of `*S` type.

With this change, the resulting type would be correctly set to `SP`.
Go considers types T and V assignable to each other if both have the
same underlying type and at least one of them is not a named type.
However, those are still distinct types, for example for reflect
purposes.

Prior to this change gopherjs would simply assign the value of type T to
type V without converting its type, which is incorrect. This change
forces type conversion to happen in such cases in order to maintain the
correct runtime type.
@nevkontakte nevkontakte requested a review from flimzy June 11, 2023 00:12
@nevkontakte nevkontakte enabled auto-merge June 11, 2023 00:12
@nevkontakte nevkontakte merged commit ff35b15 into gopherjs:master Jun 11, 2023
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.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.