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

return value of Type.String() for function type doesn't match Go's reflect pkg #4458

Open
fxamacker opened this issue Sep 7, 2024 · 1 comment
Labels
bug Something isn't working reflection Needs further work on reflection

Comments

@fxamacker
Copy link

Return value of Type.String() for function type doesn't match equivalent call using Go's reflect package.

The code snippet below produces:

  • tinygo: func
  • go1.22: func(int, string) (bool, error)
f := func(int, string) (bool, error) {
	return false, nil
}
rt := reflect.TypeOf(f)
fmt.Println(rt.String()) 
@soypat soypat added the bug Something isn't working label Sep 8, 2024
@soypat
Copy link
Contributor

soypat commented Sep 8, 2024

This happens using latest tinygo release

$ tinygo run ./local/
func
[pato@entente tinygo]$ go run ./local/
func(int, string) (bool, error)
[pato@entente tinygo]$ go version
go version go1.23.0 linux/amd64
[pato@entente tinygo]$ tinygo version
tinygo version 0.33.0 linux/amd64 (using go version go1.23.0 and LLVM version 18.1.2)

@deadprogram deadprogram added the reflection Needs further work on reflection label Sep 8, 2024
fxamacker added a commit to fxamacker/cbor that referenced this issue Sep 8, 2024
Return value of tinygo's Type.String() for function type doesn't
match equivalent call using Go's reflect package.

More details at tinygo-org/tinygo#4458

This commit modifies tests to handle function type string being
different for tinygo and Go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reflection Needs further work on reflection
Projects
None yet
Development

No branches or pull requests

3 participants