Report an error while following a HID.
(vl-follow-hidexpr-error short ss &key (origx 'origx) (x 'x)) → msg
This is smart in a few ways: it distinguishes between ordinary identifiers and hierarchical identifiers in the error type, and avoids providing excessive context if we haven't gotten anywhere down into the HID yet.
Function:
(defun vl-follow-hidexpr-error-fn (short ss origx x) (declare (xargs :guard (and (vl-msg-p short) (vl-scopestack-p ss) (vl-scopeexpr-p origx) (vl-hidexpr-p x)))) (let ((__function__ 'vl-follow-hidexpr-error)) (declare (ignorable __function__)) (b* ((x (vl-hidexpr-fix x)) (origx (vl-scopeexpr-fix origx)) (short (vl-msg-fix short)) (endp (vl-scopeexpr-case origx :end)) ((when (and endp (equal x (vl-scopeexpr-end->hid origx)))) (vmsg "error resolving ~a1: ~@2." nil origx short))) (vmsg "error resolving ~a1: ~@2.~%~ (Failed to resolve ~a3 in ~s4)." nil origx short x (vl-scopestack->path ss)))))
Theorem:
(defthm vl-msg-p-of-vl-follow-hidexpr-error (b* ((msg (vl-follow-hidexpr-error-fn short ss origx x))) (vl-msg-p msg)) :rule-classes :rewrite)
Theorem:
(defthm vl-follow-hidexpr-error-fn-of-vl-msg-fix-short (equal (vl-follow-hidexpr-error-fn (vl-msg-fix short) ss origx x) (vl-follow-hidexpr-error-fn short ss origx x)))
Theorem:
(defthm vl-follow-hidexpr-error-fn-vl-msg-equiv-congruence-on-short (implies (vl-msg-equiv short short-equiv) (equal (vl-follow-hidexpr-error-fn short ss origx x) (vl-follow-hidexpr-error-fn short-equiv ss origx x))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-error-fn-of-vl-scopestack-fix-ss (equal (vl-follow-hidexpr-error-fn short (vl-scopestack-fix ss) origx x) (vl-follow-hidexpr-error-fn short ss origx x)))
Theorem:
(defthm vl-follow-hidexpr-error-fn-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-follow-hidexpr-error-fn short ss origx x) (vl-follow-hidexpr-error-fn short ss-equiv origx x))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-error-fn-of-vl-scopeexpr-fix-origx (equal (vl-follow-hidexpr-error-fn short ss (vl-scopeexpr-fix origx) x) (vl-follow-hidexpr-error-fn short ss origx x)))
Theorem:
(defthm vl-follow-hidexpr-error-fn-vl-scopeexpr-equiv-congruence-on-origx (implies (vl-scopeexpr-equiv origx origx-equiv) (equal (vl-follow-hidexpr-error-fn short ss origx x) (vl-follow-hidexpr-error-fn short ss origx-equiv x))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-error-fn-of-vl-hidexpr-fix-x (equal (vl-follow-hidexpr-error-fn short ss origx (vl-hidexpr-fix x)) (vl-follow-hidexpr-error-fn short ss origx x)))
Theorem:
(defthm vl-follow-hidexpr-error-fn-vl-hidexpr-equiv-congruence-on-x (implies (vl-hidexpr-equiv x x-equiv) (equal (vl-follow-hidexpr-error-fn short ss origx x) (vl-follow-hidexpr-error-fn short ss origx x-equiv))) :rule-classes :congruence)