Skip to content

Conversation

@nevkontakte
Copy link
Member

Because certain built-in function may not be translated into callable
expressions, GopherJS wraps them into a proxy lambda function when
necessary. Prior to this change it was incorrectly inferring argument
types for this proxy function, which led to a possible double implicit
type conversion and a runtime error in the generated code.

With this change, the types are assigned in accordance with what the
deferred function expects, and therefore no double conversion will
happen.

This change allows TesSliceNoCycle in encoding/json to pass under
Go 1.16.

Updates #989.

Because certain built-in function may not be translated into callable
expressions, GopherJS wraps them into a proxy lambda function when
necessary. Prior to this change it was incorrectly inferring argument
types for this proxy function, which led to a possible double implicit
type conversion and a runtime error in the generated code.

With this change, the types are assigned in accordance with what the
deferred function expects, and therefore no double conversion will
happen.

This change allows TesSliceNoCycle in `encoding/json` to pass under
Go 1.16.
@nevkontakte nevkontakte requested a review from flimzy March 17, 2021 18:14
@nevkontakte nevkontakte merged commit 163a579 into gopherjs:go1.16-stdlib Mar 18, 2021
nevkontakte added a commit to nevkontakte/gopherjs that referenced this pull request Nov 21, 2021
Built-ins and `js.Object` methods are represented by JS expressions that
may not be straightforward function calls, or reference functions
defined in the prelude. In such cases, the callable expression must be
wrapped in a lambda.

gopherjs#998 has fixed a similar issue
for the `defer` keyword, and this change generalizes the same fix for
the `go` keyword.

Fixes gopherjs#547.
nevkontakte added a commit to nevkontakte/gopherjs that referenced this pull request Nov 21, 2021
Built-ins and `js.Object` methods are represented by JS expressions that
may not be straightforward function calls, or reference functions
defined in the prelude. In such cases, the callable expression must be
wrapped in a lambda.

gopherjs#998 has fixed a similar issue
for the `defer` keyword, and this change generalizes the same fix for
the `go` keyword.

Fixes gopherjs#547.
nevkontakte added a commit to nevkontakte/gopherjs that referenced this pull request Nov 21, 2021
Built-ins and `js.Object` methods are represented by JS expressions that
may not be straightforward function calls, or reference functions
defined in the prelude. In such cases, the callable expression must be
wrapped in a lambda.

gopherjs#998 has fixed a similar issue
for the `defer` keyword, and this change generalizes the same fix for
the `go` keyword.

Fixes gopherjs#547.
nevkontakte added a commit to nevkontakte/gopherjs that referenced this pull request Dec 19, 2021
Built-ins and `js.Object` methods are represented by JS expressions that
may not be straightforward function calls, or reference functions
defined in the prelude. In such cases, the callable expression must be
wrapped in a lambda.

gopherjs#998 has fixed a similar issue
for the `defer` keyword, and this change generalizes the same fix for
the `go` keyword.

Fixes gopherjs#547.
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