Skip to content

Conversation

@jakebailey
Copy link

This function was missing, leading to:

# github.com/go-json-experiment/json
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_funcs.go:181:20: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_funcs.go:227:20: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_funcs.go:275:20: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_funcs.go:314:20: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_inlined.go:54:19: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_inlined.go:177:19: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_methods.go:133:28: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_methods.go:159:27: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_methods.go:182:28: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_methods.go:216:28: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_methods.go:256:30: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_methods.go:283:30: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_methods.go:310:30: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_time.go:60:22: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_time.go:87:21: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_time.go:131:22: undefined: reflect.TypeAssert
../../go/pkg/mod/github.com/go-json-experiment/[email protected]/arshal_time.go:157:21: undefined: reflect.TypeAssert

I ported the (theoreticlaly faster) reflectlite version of this, rather than just doing v.Interface().(T), and copied the tests. I am not sure what's typical for this.

@jakebailey
Copy link
Author

Hm, make test doesn't complain about this; I'll have to figure out how to run these tests myself.

I can always flip it to the less optimal version if I don't figure out the deal here; perhaps the pointer arithmetic done in big Go does not apply to tinygo

Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just needs to skip the panic test on wasi.

@jakebailey jakebailey force-pushed the reflect-type-assert branch from 0a69cba to 77bb092 Compare January 8, 2026 04:21
@jakebailey jakebailey force-pushed the reflect-type-assert branch from 77bb092 to 67b8d02 Compare January 8, 2026 20:04
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jakebailey
Copy link
Author

--- FAIL: TestTypeAssertPanic (0.00s)
    recover not supported
    SkipNow is incomplete, requires runtime.Goexit()

I guess I should just log and return instead.

@jakebailey jakebailey force-pushed the reflect-type-assert branch from 67b8d02 to 9290ab5 Compare January 8, 2026 20:37
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@deadprogram
Copy link
Member

Thanks for the addition @jakebailey and to @dgryski for doing the reviewing. Now merging.

@deadprogram deadprogram merged commit 068d7c1 into tinygo-org:dev Jan 8, 2026
19 checks passed
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 this pull request may close these issues.

3 participants