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