1(module $m
2  (global (export "g i32") i32 (i32.const 0))
3  (global (export "g mut i32") (mut i32)  (i32.const 0))
4
5  (table (export "t funcref") 0 funcref)
6  (memory (export "mem") 0)
7
8  (func (export "f"))
9  (func (export "f p1r2") (param f32) (result i32 i64) unreachable)
10)
11
12;; make sure the name of the import is in the message
13(assert_unlinkable
14  (module (import "m" "g i32" (global i64)))
15  "incompatible import type for `m::g i32`")
16
17;; errors on globals
18(assert_unlinkable
19  (module (import "m" "g i32" (global i64)))
20  "expected global of type `i64`, found global of type `i32`")
21
22(assert_unlinkable
23  (module (import "m" "g i32" (global (mut i32))))
24  "expected mutable global, found immutable global")
25
26(assert_unlinkable
27  (module (import "m" "g mut i32" (global i32)))
28  "expected immutable global, found mutable global")
29
30;; errors on tables
31(assert_unlinkable
32  (module (import "m" "t funcref" (table 1 funcref)))
33  "expected table limits (min: 1, max: none) doesn't match provided table limits (min: 0, max: none)")
34
35;; errors on memories
36(assert_unlinkable
37  (module (import "m" "mem" (memory 1)))
38  "expected memory limits (min: 1, max: none) doesn't match provided memory limits (min: 0, max: none)")
39
40;; errors on functions
41(assert_unlinkable
42  (module (import "m" "f" (func (param i32))))
43  "expected func of type `(i32) -> ()`, found func of type `() -> ()`")
44
45(assert_unlinkable
46  (module (import "m" "f p1r2" (func (param i32 i32) (result f64))))
47  "expected func of type `(i32, i32) -> (f64)`, found func of type `(f32) -> (i32, i64)`")
48