;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.

;; RUN: wasm-opt %s -all --closed-world --remove-unused-types -S -o - | filecheck %s

;; Test that a simple type rewrite handles exact references in heap type
;; definitions correctly. In particular, the function should continue returning
;; an exact reference and the call expression should have the same type.

(module
  ;; CHECK:      (rec
  ;; CHECK-NEXT:  (type $struct (struct))
  (type $struct (struct))
  ;; CHECK:      (func $return-exact (type $1) (result (ref null (exact $struct)))
  ;; CHECK-NEXT:  (call $return-exact)
  ;; CHECK-NEXT: )
  (func $return-exact (result (ref null (exact $struct)))
    (call $return-exact)
  )
)
