diff --git a/phasm/type3/constraintsgenerator.py b/phasm/type3/constraintsgenerator.py index 217bec3..ba95a86 100644 --- a/phasm/type3/constraintsgenerator.py +++ b/phasm/type3/constraintsgenerator.py @@ -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, diff --git a/tests/integration/test_lang/test_struct.py b/tests/integration/test_lang/test_struct.py index 98020c6..bf9f2b2 100644 --- a/tests/integration/test_lang/test_struct.py +++ b/tests/integration/test_lang/test_struct.py @@ -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()