test/wasmexport.go
raw| 1 | // errorcheck |
| 2 | |
| 3 | // Copyright 2024 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | // Verify that misplaced directives are diagnosed. |
| 8 | |
| 9 | //go:build wasm |
| 10 | |
| 11 | package p |
| 12 | |
| 13 | //go:wasmexport F |
| 14 | func F() {} // OK |
| 15 | |
| 16 | type S int32 |
| 17 | |
| 18 | //go:wasmexport M |
| 19 | func (S) M() {} // ERROR "cannot use //go:wasmexport on a method" |