From c5c170bac070c1bbc0e008e05783109c2e49afab Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 25 Jan 2025 22:44:59 -0700 Subject: lib9p: idl.gen: Detect when we try to import a sym that doesn't exist --- lib9p/idl/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib9p/idl/__init__.py') diff --git a/lib9p/idl/__init__.py b/lib9p/idl/__init__.py index fec6c41..41664f1 100644 --- a/lib9p/idl/__init__.py +++ b/lib9p/idl/__init__.py @@ -449,8 +449,10 @@ def parse_file( other_version, other_typs = get_include(m.group("file")) for symname in m.group("syms").split(sep=","): symname = symname.strip() + found = False for typ in other_typs: if typ.name == symname or symname == "*": + found = True match typ: case Primitive(): pass @@ -467,6 +469,10 @@ def parse_file( if other_version in member.in_versions: member.in_versions.add(version) env[typ.name] = typ + if symname != "*" and not found: + raise ValueError( + f"import: {m.group('file')}: no symbol {repr(symname)}" + ) elif m := re.fullmatch(re_line_num, line): num = Number() num.name = m.group("name") -- cgit v1.2.3-2-g168b