Adds a FIXME for accessing non-struct members

This commit is contained in:
Johan B.W. de Vries 2025-05-05 12:35:49 +02:00
parent 45c38d5f88
commit f6cb1a8c1d
2 changed files with 13 additions and 1 deletions

View File

@ -115,7 +115,7 @@ def expression(ctx: Context, inp: ourlang.Expression) -> ConstraintGenerator:
if isinstance(inp, ourlang.AccessStructMember):
assert isinstance(inp.struct_type3, type3types.Type3) # When does this happen?
st_args = prelude.struct.did_construct(inp.struct_type3)
assert st_args is not None # When does this happen?
assert st_args is not None # FIXME: See test_struct.py::test_struct_not_accessible
yield from expression(ctx, inp.varref)
yield SameTypeConstraint(st_args[inp.member], inp.type3,

View File

@ -100,3 +100,15 @@ class f32:
with pytest.raises(StaticError, match='f32 already defined as type'):
Suite(code_py).run_code()
@pytest.mark.integration_test
@pytest.mark.skip(reason='FIXME: See constraintgenerator.py for AccessStructMember')
def test_struct_not_accessible():
code_py = """
@exported
def testEntry(x: u8) -> u8:
return x.y
"""
with pytest.raises(Type3Exception, match='u8 is not struct'):
Suite(code_py).run_code()