compiler: Type Check All Binary Operators

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-22 20:42:35 -04:00
parent bc51b4e280
commit 97a672bd6d
4 changed files with 57 additions and 111 deletions
+7 -9
View File
@@ -318,17 +318,15 @@ import TreeSitterP4
}
};
"""
let program = try #UseOkResult(Program.Compile(simple_parser_declaration))
let runtime = try #UseOkResult(
P4Runtime.Runtime<InstantiatedParserState, P4Lang.Parser>.create(program: program))
let (state_result, _) = try! #UseOkResult(runtime.run())
// TODO: This test should throw an error.
#expect(
#RequireErrorResult(
Error(
withMessage:
"{49, 35}: Failed to parse a statement element: Types of values used with binary expression are not the same"
),
Program.Compile(simple_parser_declaration)))
// false == 5 == true
// false == true
// false
#expect(AsInstantiatedParserState(state_result) == P4Lang.reject)
}
@Test func test_expression_in_declaration_initializer_invalid_types2() async throws {