Skip to content

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

Closed

Description

@fxamacker

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()) 

Activity

  1. added
    bug
    on Sep 8, 2024
  2. soypat commented on Sep 8, 2024

    @soypat
    Contributor

    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)
    
  3. added
    reflection
    on Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreflection

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions