mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
compiler: report error instead of crashing on missing function body
This can happen with generic functions, see: https://github.com/tinygo-org/tinygo/issues/4486
This commit is contained in:
committed by
Ron Evans
parent
ec3f387f21
commit
f246599253
Vendored
+11
@@ -7,6 +7,17 @@ func foo() {
|
||||
//go:align 7
|
||||
var global int
|
||||
|
||||
// Test for https://github.com/tinygo-org/tinygo/issues/4486
|
||||
type genericType[T any] struct{}
|
||||
|
||||
func (genericType[T]) methodWithoutBody()
|
||||
|
||||
func callMethodWithoutBody() {
|
||||
msg := &genericType[int]{}
|
||||
msg.methodWithoutBody()
|
||||
}
|
||||
|
||||
// ERROR: # command-line-arguments
|
||||
// ERROR: compiler.go:4:6: can only use //go:wasmimport on declarations
|
||||
// ERROR: compiler.go:8:5: global variable alignment must be a positive power of two
|
||||
// ERROR: compiler.go:13:23: missing function body
|
||||
|
||||
Reference in New Issue
Block a user