diff options
-rw-r--r-- | loader/loader.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/loader/loader.go b/loader/loader.go index 6786ee533..f3ffa8614 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -432,7 +432,15 @@ func (p *Package) Check() error { if err, ok := err.(Errors); ok { return err } - return Errors{p, typeErrors} + if len(typeErrors) != 0 { + // Got type errors, so return them. + return Errors{p, typeErrors} + } + // This can happen in some weird cases. + // The only case I know is when compiling a Go 1.23 program, with a + // TinyGo version that supports Go 1.23 but is compiled using Go 1.22. + // So this should be pretty rare. + return Errors{p, []error{err}} } p.Pkg = typesPkg |