import t import stdio import testcheck # Extern2Test - minimal repro: ExternalDecl/StateDecl redefinition # Three declarations plus main; each must emit exactly one declare. # Test 1: t.CExtern | t.CExport - external declaration (pass body) # Translator must emit declare, not define. def ExternalDecl(x: int) -> int | t.CExtern | t.CExport: pass # Test 2: t.State - state declaration (same as CExtern | CExport) def StateDecl(x: int) -> int | t.State: pass # Test 3: t.State returning void def StateVoidDecl() -> t.State: pass def test_extern_decl(): """Verify the three extern declarations emit declare only once.""" testcheck.section("Extern/State declarations (no duplicate)") # External declarations are not called; the linker resolves the symbols. testcheck.check(True, "ExternalDecl declared (not called)", "expect declared once") testcheck.check(True, "StateDecl declared (not called)", "expect declared once") testcheck.check(True, "StateVoidDecl declared (not called)", "expect declared once") def main() -> int: testcheck.begin("Extern2Test: minimal repro - extern redefinition") test_extern_decl() return testcheck.end()