Skip to content

reflect package from Go 1.11.1 doesn't build with GopherJS 1.11-1. #862

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

Closed
dmitshur opened this issue Oct 2, 2018 · 0 comments
Closed
Assignees
Labels

Comments

@dmitshur
Copy link
Member

dmitshur commented Oct 2, 2018

Go 1.11.1 has been released today. It includes some changes to the reflect package. The overrides that GopherJS 1.11-1 makes to the reflect package are no longer compatible, causing it to not build:

$ go version
go version go1.11.1 darwin/amd64
$ gopherjs version
GopherJS 1.11-1
$ gopherjs build reflect
/usr/local/go/src/reflect/value.go:673:60: cannot use t (variable of type *rtype) as *funcType value in argument to funcLayout
/usr/local/go/src/reflect/value.go:336:21: cannot use methodReceiver(op, v, int(v.flag) >> flagMethodShift) (value of type *rtype) as *funcType value in assignment
@dmitshur dmitshur self-assigned this Oct 3, 2018
dmitshur added a commit that referenced this issue Oct 3, 2018
Go 1.11.1 has been released recently. It includes some changes to the
reflect package, including:

-	golang/go@a2f1c8e
-	golang/go@3afa9df
-	golang/go@58c9bd9

The second commit makes some changes to internal reflect code that
makes GopherJS reflect overrides no longer compatible, causing the
package to no longer build:

	$ gopherjs build reflect
	/usr/local/go/src/reflect/value.go:673:60: cannot use t (variable of type *rtype) as *funcType value in argument to funcLayout
	/usr/local/go/src/reflect/value.go:336:21: cannot use methodReceiver(op, v, int(v.flag) >> flagMethodShift) (value of type *rtype) as *funcType value in assignment

Specifically, the type of return value t of function methodReceiver
was changed from *rtype to *funcType in commit golang/go@3afa9df.

This change updates the native reflect override for methodReceiver
function and Value.call method accordingly.

Regenerate natives with:

	go generate ./compiler/natives

Use Go 1.11.1 in CI.

Bump GopherJS version to GopherJS 1.11-2.

Fixes #862.
dmitshur added a commit that referenced this issue Oct 4, 2018
Go 1.11.1 has been released recently. It includes some changes to the
reflect package, including:

-	golang/go@a2f1c8e
-	golang/go@3afa9df
-	golang/go@58c9bd9

The second commit makes some changes to internal reflect code that
makes GopherJS reflect overrides no longer compatible, causing the
package to no longer build:

	$ gopherjs build reflect
	/usr/local/go/src/reflect/value.go:673:60: cannot use t (variable of type *rtype) as *funcType value in argument to funcLayout
	/usr/local/go/src/reflect/value.go:336:21: cannot use methodReceiver(op, v, int(v.flag) >> flagMethodShift) (value of type *rtype) as *funcType value in assignment

Specifically, the type of return value t of function methodReceiver
was changed from *rtype to *funcType in commit golang/go@3afa9df.

This change updates the native reflect override for methodReceiver
function and Value.call method accordingly.

Maintain backwards compatibility with Go 1.11(.0) by creating
a custom go1.11.1 release tag (to be applied whenever Go version
is 1.11.1 or greater) and using it to select the appropriate overrides
for the reflect package for Go 1.11.1 and Go 1.11(.0).

This way, GopherJS 1.11-2 will function with Go 1.11.1 and Go 1.11(.0)
versions, rather than only with Go 1.11.1.

Regenerate natives with:

	go generate ./compiler/natives

Use Go 1.11.1 in CI.

Bump GopherJS version to GopherJS 1.11-2.

Fixes #862.
dmitshur added a commit that referenced this issue Aug 11, 2019
GopherJS 1.12 is out by now, so it's safe to remove this code that
was added to deal with differences between Go 1.11.0 and Go 1.11.1.

There should not be any change in behavior, except the internal and
temporary go1.11.1 build tag will no longer be set by GopherJS.
It was never intended to be used externally, so hopefully nobody did.

Regenerate ./compiler/natives.

Updates #862.
dmitshur added a commit that referenced this issue Aug 12, 2019
GopherJS 1.12 is out by now, so it's safe to remove this code that
was added to deal with differences between Go 1.11.0 and Go 1.11.1.

Do so by moving the actively used code from reflect_go1111.go back
into reflect.go as it was before PR #865, and delete reflect_go111.go.

There should not be any change in behavior.

Regenerate ./compiler/natives.

Updates #862.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant