summaryrefslogtreecommitdiff
path: root/lib9p/idl/__init__.py
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-25 22:44:59 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-25 22:49:23 -0700
commitc5c170bac070c1bbc0e008e05783109c2e49afab (patch)
treec6c9d867e914afd934fe557dc37488368ba1ae4b /lib9p/idl/__init__.py
parent9a31f282ae39fa4be34cab5dec3474bb74b18c94 (diff)
lib9p: idl.gen: Detect when we try to import a sym that doesn't exist
Diffstat (limited to 'lib9p/idl/__init__.py')
-rw-r--r--lib9p/idl/__init__.py6
1 files changed, 6 insertions, 0 deletions
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")