1*60fc557cSAlex Crichton;;! reference_types = true 2*60fc557cSAlex Crichton 39db418cfSAlex Crichton(module $m 49db418cfSAlex Crichton (global (export "g i32") i32 (i32.const 0)) 59db418cfSAlex Crichton (global (export "g mut i32") (mut i32) (i32.const 0)) 69db418cfSAlex Crichton 79db418cfSAlex Crichton (table (export "t funcref") 0 funcref) 89c6884e2SAlex Crichton (table (export "t externref") 0 externref) 99db418cfSAlex Crichton (memory (export "mem") 0) 109db418cfSAlex Crichton 119db418cfSAlex Crichton (func (export "f")) 129db418cfSAlex Crichton (func (export "f p1r2") (param f32) (result i32 i64) unreachable) 139db418cfSAlex Crichton) 149db418cfSAlex Crichton 159db418cfSAlex Crichton;; make sure the name of the import is in the message 169db418cfSAlex Crichton(assert_unlinkable 179db418cfSAlex Crichton (module (import "m" "g i32" (global i64))) 189db418cfSAlex Crichton "incompatible import type for `m::g i32`") 199db418cfSAlex Crichton 209db418cfSAlex Crichton;; errors on globals 219db418cfSAlex Crichton(assert_unlinkable 229db418cfSAlex Crichton (module (import "m" "g i32" (global i64))) 239db418cfSAlex Crichton "expected global of type `i64`, found global of type `i32`") 249db418cfSAlex Crichton 259db418cfSAlex Crichton(assert_unlinkable 269db418cfSAlex Crichton (module (import "m" "g i32" (global (mut i32)))) 279db418cfSAlex Crichton "expected mutable global, found immutable global") 289db418cfSAlex Crichton 299db418cfSAlex Crichton(assert_unlinkable 309db418cfSAlex Crichton (module (import "m" "g mut i32" (global i32))) 319db418cfSAlex Crichton "expected immutable global, found mutable global") 329db418cfSAlex Crichton 339db418cfSAlex Crichton;; errors on tables 349db418cfSAlex Crichton(assert_unlinkable 359db418cfSAlex Crichton (module (import "m" "t funcref" (table 1 funcref))) 369db418cfSAlex Crichton "expected table limits (min: 1, max: none) doesn't match provided table limits (min: 0, max: none)") 379db418cfSAlex Crichton 389c6884e2SAlex Crichton(assert_unlinkable 399c6884e2SAlex Crichton (module (import "m" "t externref" (table 0 funcref))) 409c6884e2SAlex Crichton "expected table of type `funcref`, found table of type `externref`") 419c6884e2SAlex Crichton 429db418cfSAlex Crichton;; errors on memories 439db418cfSAlex Crichton(assert_unlinkable 449db418cfSAlex Crichton (module (import "m" "mem" (memory 1))) 459db418cfSAlex Crichton "expected memory limits (min: 1, max: none) doesn't match provided memory limits (min: 0, max: none)") 469db418cfSAlex Crichton 479db418cfSAlex Crichton;; errors on functions 489db418cfSAlex Crichton(assert_unlinkable 499db418cfSAlex Crichton (module (import "m" "f" (func (param i32)))) 50dd70e31dSNick Fitzgerald "expected type `(func (param i32))`, found type `(func)`") 519db418cfSAlex Crichton 529db418cfSAlex Crichton(assert_unlinkable 539db418cfSAlex Crichton (module (import "m" "f p1r2" (func (param i32 i32) (result f64)))) 54dd70e31dSNick Fitzgerald "expected type `(func (param i32 i32) (result f64))`, found type `(func (param f32) (result i32 i64))`") 55