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

Type.AssignableTo panics with "reflect: unimplemented: AssignableTo with interface" #4277

Open
fxamacker opened this issue May 28, 2024 · 0 comments

Comments

@fxamacker
Copy link

Some packages like fxamacker/cbor require Type.AssignableTo to support Interface.

There was some prior discussion at fxamacker/cbor#295 (comment).

Projects using packages that require Interface support can encounter panics from the following code.

tinygo/src/reflect/type.go

Lines 956 to 969 in 6384eca

func (t *rawType) AssignableTo(u Type) bool {
if t == u.(*rawType) {
return true
}
if u.Kind() == Interface && u.NumMethod() == 0 {
return true
}
if u.Kind() == Interface {
panic("reflect: unimplemented: AssignableTo with interface")
}
return false
}

If a solution becomes available, I can use some existing tests in fxamacker/cbor to help test it.

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

No branches or pull requests

1 participant