Interpreter crash with function name reference
With this code
f(x) = 2*x
print(f)
both texts script
and texts session
crash with this error:
Traceback (most recent call last):
File "vre-language/src/virtmat/language/utilities/errors.py", line 278, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/cli/run_model.py", line 67, in run_instant_deferred
return meta.model_from_file(clargs.model_file, deferred_mode=deferred,
File "python-3.10.12/lib/python3.10/site-packages/textx/metamodel.py", line 715, in model_from_file
return self.internal_model_from_file(
File "python-3.10.12/lib/python3.10/site-packages/textx/metamodel.py", line 771, in internal_model_from_file
model = self._parser_blueprint.clone().get_model_from_str(
File "python-3.10.12/lib/python3.10/site-packages/textx/model.py", line 406, in get_model_from_str
model = parse_tree_to_objgraph(
File "python-3.10.12/lib/python3.10/site-packages/textx/model.py", line 964, in parse_tree_to_objgraph
call_obj_processors(m._tx_metamodel, m)
File "python-3.10.12/lib/python3.10/site-packages/textx/model.py", line 808, in call_obj_processors
result = call_obj_processors(
File "python-3.10.12/lib/python3.10/site-packages/textx/model.py", line 808, in call_obj_processors
result = call_obj_processors(
File "python-3.10.12/lib/python3.10/site-packages/textx/model.py", line 814, in call_obj_processors
result = call_obj_processors(metamodel, attr, metaattr.cls)
File "python-3.10.12/lib/python3.10/site-packages/textx/model.py", line 824, in call_obj_processors
return_value_current = metamodel.process(
File "python-3.10.12/lib/python3.10/site-packages/textx/metamodel.py", line 566, in process
return self._obj_processors.get(_type, lambda x: x)(value)
File "vre-language/src/virtmat/language/metamodel/processors.py", line 70, in general_reference_processor
assert isinstance_m(obj.ref, classes)
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "python-3.10.12/bin/texts", line 8, in <module>
sys.exit(texts())
File "vre-language/src/virtmat/language/cli/__init__.py", line 25, in texts
clargs.func(clargs)
File "vre-language/src/virtmat/language/cli/run_model.py", line 122, in main
prog = run_instant_deferred(clargs, deferred=False)
File "vre-language/src/virtmat/language/utilities/errors.py", line 304, in wrapper
raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception
The same happens if the function is used like a = f
, a = 2*f
etc. There should be syntax error or at least some constraints must be applied and the error should be domain-specific.