loader: report all type and syntax errors possible

Previously the loader would only report the first error. With this
change, all syntax and type errors will be reported.
This commit is contained in:
Ayke van Laethem
2024-07-12 15:07:24 +02:00
parent a6602dc708
commit 587ad68bd9
6 changed files with 68 additions and 5 deletions
+3
View File
@@ -0,0 +1,3 @@
package typesmulti3
var _ int = 3.14
+4
View File
@@ -0,0 +1,4 @@
package syntaxmulti2
func Foo2(type) {
}
+4
View File
@@ -0,0 +1,4 @@
package syntaxmulti1
func Foo1(import) {
}
+17
View File
@@ -0,0 +1,17 @@
package main
import (
_ "github.com/tinygo-org/tinygo/testdata/errors/multi-1"
_ "github.com/tinygo-org/tinygo/testdata/errors/multi-2"
_ "github.com/tinygo-org/tinygo/testdata/errors/multi-3"
)
func main() {
}
// ERROR: # github.com/tinygo-org/tinygo/testdata/errors/multi-2
// ERROR: multi-2/syntax.go:3:11: expected ')', found 'type'
// ERROR: # github.com/tinygo-org/tinygo/testdata/errors/multi-3
// ERROR: multi-3/syntax.go:3:11: expected ')', found 'import'
// ERROR: # github.com/tinygo-org/tinygo/testdata/errors/multi-1
// ERROR: multi-1/types.go:3:13: cannot use 3.14 (untyped float constant) as int value in variable declaration (truncated)