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