Report an error while following a HID.
(vl-follow-hidexpr-error short ss &key (ctx 'ctx) (origx 'origx) (x 'x)) → warning
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 ctx origx x) (declare (xargs :guard (and (stringp short) (vl-scopestack-p ss) (acl2::any-p ctx) (vl-expr-p origx) (vl-expr-p x)))) (let ((__function__ 'vl-follow-hidexpr-error)) (declare (ignorable __function__)) (b* ((x (vl-expr-fix x)) (origx (vl-expr-fix origx)) (short (string-fix short)) (type (if (vl-idexpr-p origx) :vl-bad-identifier :vl-bad-hid)) ((when (equal x origx)) (make-vl-warning :type type :msg "~a0: error resolving ~a1: ~s2." :args (list ctx origx short) :fn __function__))) (make-vl-warning :type type :msg "~a0: error resolving ~a1: ~s2.~%~ (Failed to resolve ~a3 in ~s4)." :args (list ctx origx short x (vl-scopestack->path ss)) :fn __function__))))
Theorem:
(defthm vl-warning-p-of-vl-follow-hidexpr-error (b* ((warning (vl-follow-hidexpr-error-fn short ss ctx origx x))) (vl-warning-p warning)) :rule-classes :rewrite)
Theorem:
(defthm vl-follow-hidexpr-error-fn-of-str-fix-short (equal (vl-follow-hidexpr-error-fn (str-fix short) ss ctx origx x) (vl-follow-hidexpr-error-fn short ss ctx origx x)))
Theorem:
(defthm vl-follow-hidexpr-error-fn-streqv-congruence-on-short (implies (streqv short short-equiv) (equal (vl-follow-hidexpr-error-fn short ss ctx origx x) (vl-follow-hidexpr-error-fn short-equiv ss ctx 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) ctx origx x) (vl-follow-hidexpr-error-fn short ss ctx 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 ctx origx x) (vl-follow-hidexpr-error-fn short ss-equiv ctx origx x))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-error-fn-of-identity-ctx (equal (vl-follow-hidexpr-error-fn short ss (identity ctx) origx x) (vl-follow-hidexpr-error-fn short ss ctx origx x)))
Theorem:
(defthm vl-follow-hidexpr-error-fn-equal-congruence-on-ctx (implies (equal ctx ctx-equiv) (equal (vl-follow-hidexpr-error-fn short ss ctx origx x) (vl-follow-hidexpr-error-fn short ss ctx-equiv origx x))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-error-fn-of-vl-expr-fix-origx (equal (vl-follow-hidexpr-error-fn short ss ctx (vl-expr-fix origx) x) (vl-follow-hidexpr-error-fn short ss ctx origx x)))
Theorem:
(defthm vl-follow-hidexpr-error-fn-vl-expr-equiv-congruence-on-origx (implies (vl-expr-equiv origx origx-equiv) (equal (vl-follow-hidexpr-error-fn short ss ctx origx x) (vl-follow-hidexpr-error-fn short ss ctx origx-equiv x))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-error-fn-of-vl-expr-fix-x (equal (vl-follow-hidexpr-error-fn short ss ctx origx (vl-expr-fix x)) (vl-follow-hidexpr-error-fn short ss ctx origx x)))
Theorem:
(defthm vl-follow-hidexpr-error-fn-vl-expr-equiv-congruence-on-x (implies (vl-expr-equiv x x-equiv) (equal (vl-follow-hidexpr-error-fn short ss ctx origx x) (vl-follow-hidexpr-error-fn short ss ctx origx x-equiv))) :rule-classes :congruence)