compiler, runtime: Make Default Values Optional

For types, make it optional to return a default value. While default
values for some types are meaningful, they are not meaningful for all
types (e.g., Action, Control, Parser, Parser state, etc.).

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-04 08:35:33 -04:00
parent 5cfe5532a2
commit b49ec104e9
8 changed files with 55 additions and 44 deletions
+3 -3
View File
@@ -103,7 +103,7 @@ import TreeSitterP4
#RequireErrorResult(
Error(
withMessage:
"{86, 27}: Failed to parse a statement element: Cannot initialize where_to (with type Boolean) from rvalue with type String"
"{86, 27}: Failed to parse a statement element: Cannot initialize where_to (with type Boolean) from expression with type String"
),
Program.Compile(simple_parser_declaration)))
}
@@ -123,7 +123,7 @@ import TreeSitterP4
#RequireErrorResult(
Error(
withMessage:
"{77, 29}: Failed to parse a statement element: Cannot initialize where_from (with type String) from rvalue with type Boolean"
"{77, 29}: Failed to parse a statement element: Cannot initialize where_from (with type String) from expression with type Boolean"
),
Program.Compile(simple_parser_declaration)))
}
@@ -258,7 +258,7 @@ import TreeSitterP4
#RequireErrorResult(
Error(
withMessage:
"{49, 22}: Failed to parse a statement element: Cannot initialize where_to (with type Boolean) from rvalue with type Int"
"{49, 22}: Failed to parse a statement element: Cannot initialize where_to (with type Boolean) from expression with type Int"
),
Program.Compile(simple_parser_declaration, withGlobalInstances: test_types)))
}