Looks up x in the scopestack to see if it looks like an interface or type name. Warns if the result was ambiguous.
(vl-name-is-interface-or-type x ss) → (mv warnings looks-like-interface looks-like-type)
Function:
(defun vl-name-is-interface-or-type (x ss) (declare (xargs :guard (and (stringp x) (vl-scopestack-p ss)))) (let ((__function__ 'vl-name-is-interface-or-type)) (declare (ignorable __function__)) (b* ((x (string-fix x)) (type-lookup (vl-scopestack-find-item x ss)) (iface-lookup (vl-scopestack-find-definition x ss)) (warnings nil) ((wmv warnings) (vl-interface/type-warn-about-unexpected-lookup x type-lookup '(:vl-typedef :vl-paramdecl))) ((wmv warnings) (vl-interface/type-warn-about-unexpected-lookup x iface-lookup '(:vl-interface))) ((when (and type-lookup (or (eq (tag type-lookup) :vl-typedef) (eq (tag type-lookup) :vl-paramdecl)))) (if (and iface-lookup (eq (tag iface-lookup) :vl-interface)) (mv (warn :type :vl-ambiguous-type-or-interface :msg "Identifier ~a0 refers to an interface but also to ~ a typedef, ~a1." :args (list x type-lookup)) t t) (mv warnings nil t))) ((when (and iface-lookup (eq (tag iface-lookup) :vl-interface))) (mv warnings t nil))) (mv (warn :type :vl-ambiguous-type-or-interface :msg "Didn't find either an interface or typedef for identifier ~ ~a0." :args (list x)) nil nil))))
Theorem:
(defthm vl-warninglist-p-of-vl-name-is-interface-or-type.warnings (b* (((mv ?warnings ?looks-like-interface ?looks-like-type) (vl-name-is-interface-or-type x ss))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-name-is-interface-or-type-of-str-fix-x (equal (vl-name-is-interface-or-type (str-fix x) ss) (vl-name-is-interface-or-type x ss)))
Theorem:
(defthm vl-name-is-interface-or-type-streqv-congruence-on-x (implies (streqv x x-equiv) (equal (vl-name-is-interface-or-type x ss) (vl-name-is-interface-or-type x-equiv ss))) :rule-classes :congruence)
Theorem:
(defthm vl-name-is-interface-or-type-of-vl-scopestack-fix-ss (equal (vl-name-is-interface-or-type x (vl-scopestack-fix ss)) (vl-name-is-interface-or-type x ss)))
Theorem:
(defthm vl-name-is-interface-or-type-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-name-is-interface-or-type x ss) (vl-name-is-interface-or-type x ss-equiv))) :rule-classes :congruence)