Result: done Files: crates/nikaia-std/src/tools/ast.nika crates/nikaia-std/src/tools/check_core_pilot.nika crates/nikaia-std/src/tools/check_grammar.nika crates/nikaia-std/src/tools/check_imports.nika crates/nikaia-std/src/tools/emit_holes.nika crates/nikaia-std/src/tools/emit_pattern.nika crates/nikaia-std/src/tools/fold_bound.nika crates/nikaia-std/src/tools/grammar_types.nika crates/nikaia-std/src/tools/node_numbers.nika crates/nikaia-std/src/tools/lowered.rs crates/nikaia-std/src/tools/lowered/ast.rs crates/nikaia-std/src/tools/lowered/check_core_pilot.rs crates/nikaia-std/src/tools/lowered/check_grammar.rs crates/nikaia-std/src/tools/lowered/check_imports.rs crates/nikaia-std/src/tools/lowered/emit_holes.rs crates/nikaia-std/src/tools/lowered/emit_pattern.rs crates/nikaia-std/src/tools/lowered/fold_bound.rs crates/nikaia-std/src/tools/lowered/grammar_types.rs crates/nikaia-std/src/tools/lowered/node_numbers.rs crates/nikaia/src/parser/mod.rs tests/compiler/tests/grammar_a_type_parameter_in_an_action.nika tests/compiler/tests/grammar_a_type_parameter_in_an_action.stdout tests/compiler/tests/grammar_a_rule_bound_is_checked.nika tests/compiler/tests/grammar_a_rule_bound_is_checked.stderr tests/compiler/tests/grammar_a_match_on_a_kind_chooses_the_pattern.nika tests/compiler/tests/grammar_a_match_on_a_kind_chooses_the_pattern.stdout tests/compiler/tests/grammar_a_type_no_arm_takes_is_refused.nika tests/compiler/tests/grammar_a_type_no_arm_takes_is_refused.stderr tests/compiler/tests/grammar_refuse_in_an_arm_says_why.nika tests/compiler/tests/grammar_refuse_in_an_arm_says_why.stderr tests/compiler/tests/grammar_a_match_on_a_runtime_value_is_refused.nika tests/compiler/tests/grammar_a_match_on_a_runtime_value_is_refused.stderr Commit: grammar: a match on a kind chooses a rule’s pattern, refuse (ADR-grammar-2 D2, D6) Body: A rule body match T::kind { Kind => alts … } (new Pattern::Choose, GrammarArm) is resolved while copying (grammar_types.nika), so each copy keeps only the arm its type takes, with an arm’s names (Maybe(A), List(A), Map(K, V), Struct(S)) standing for the type’s parts; arms not taken are neither copied nor checked, as an uncalled generic rule is not. Kinds are Part II 10.3’s (I64, not the brief’s sketch Int); the catch-all is else (ADR-291 D16). No arm is NK1250 at the call, naming the rule and the path of rules with types that led there; an arm that is refuse("why") is NK1250 with that reason; a match on anything but a type’s ::kind is NK1310. A bound [S: Struct]/[S: Enum] or a declared trait on a rule’s type parameter is checked at the call (NK1164), failing open for undeclared types and traits. Each copy’s actions, guards, counted bounds and call arguments get the type parameters put in through a host walk (parser/mod.rs put_rule_types: casts, let/comptime types, T/T::x heads). A nullable type at a call site, Lit::read[i64?](…), does not parse (nor does id[i64?](x) for any generic function), so the tests reach Maybe through Value[T?] inside the grammar. Part: #1019 Tests: 6 new tests/compiler programs (grammar_a_type_parameter_in_an_action, grammar_a_rule_bound_is_checked, grammar_a_match_on_a_kind_chooses_the_pattern, grammar_a_type_no_arm_takes_is_refused, grammar_refuse_in_an_arm_says_why, grammar_a_match_on_a_runtime_value_is_refused), each failed on the unfixed compiler (parse error on match, NK1122, or accepted); nikaia test –both-settings –project tests/compiler 482 passed (5 first failed only because a concurrent cargo test relinked target/fast/nikaia, all 5 pass on rerun); it binary 2887 passed; clippy, fmt, pre-push-check, lower-std fixpoint clean Gate: green Deviation: none Found: none Needs: architect: f[i64?](x), a nullable type in a call’s type brackets, does not parse (“Expected .. or ]”), for functions and rules alike; file if not intended Changelog: A grammar rule chooses its pattern by a type’s kind with match T::kind { … }, refuses a type with refuse("why"), and checks its type parameters’ bounds at the call. Owner: none Disk freed: 0.02 GB (scratch binary); cache 3.6G, / 4.0G free; new entries over 100 MB: rlib/af187e66 266 MB, run-bundle/3f8b93b8 287 MB Rs2nika: none Pushed: local 3776e3e7b93f7bd82055437b36f80b560348422f

This site is open source. Improve this page.