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

Wrong reflect type of function #832

Closed
cpunion opened this issue Oct 15, 2024 · 0 comments · Fixed by #874
Closed

Wrong reflect type of function #832

cpunion opened this issue Oct 15, 2024 · 0 comments · Fixed by #874

Comments

@cpunion
Copy link
Contributor

cpunion commented Oct 15, 2024

package main

import (
	"fmt"
	"reflect"
)

func add(a, b int) int {
	return a + b
}

func main() {
	fn := func(a, b int) int {
		return a + b
	}

	v := reflect.ValueOf(fn)
	fmt.Println(v.Type())
	fmt.Println(v.Kind())

	v = reflect.ValueOf(add)
	fmt.Println(v.Type())
	fmt.Println(v.Kind())
}
(base) ➜  llgo git:(py-dev) ✗ go run ./cmd/llgo run ./_demo/reflect
struct {...}
struct
struct {...}
struct
(base) ➜  llgo git:(py-dev) ✗ go run ./_demo/reflect
func(int, int) int
func
func(int, int) int
func
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 a pull request may close this issue.

1 participant