Skip to content

Commit fc35d2b

Browse files
authored
Improve error message in case of unsupported PBC (#482)
2 parents ae51219 + fb1ddb5 commit fc35d2b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

spy/backend/c/cwriter.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from spy import ast
55
from spy.backend.c import c_ast as C
66
from spy.backend.c.context import C_Ident, Context
7+
from spy.errors import SPyError
78
from spy.fqn import FQN
89
from spy.location import Loc
910
from spy.textbuilder import TextBuilder
@@ -309,7 +310,14 @@ def fmt_expr_FQNConst(self, const: ast.FQNConst) -> C.Expr:
309310
assert w_obj.h == 0, "only NULL _FILE can be a constant"
310311
return C.Literal("NULL")
311312
else:
312-
assert False
313+
w_T = self.ctx.vm.dynamic_type(w_obj)
314+
t = w_T.fqn.human_name
315+
raise SPyError.simple(
316+
"W_WIP",
317+
f"Prebuilt constant of type `{t}` are not supported by the C backend",
318+
f"This is `{t}`",
319+
const.loc,
320+
)
313321

314322
def fmt_expr_Name(self, name: ast.Name) -> C.Expr:
315323
assert False, "ast.Name nodes should not survive redshifting"

0 commit comments

Comments
 (0)