diff --git a/crates/plotnik-lib/src/analyze/type_check/mod.rs b/crates/plotnik-lib/src/analyze/type_check/mod.rs index 5134a751..afda02b8 100644 --- a/crates/plotnik-lib/src/analyze/type_check/mod.rs +++ b/crates/plotnik-lib/src/analyze/type_check/mod.rs @@ -20,8 +20,6 @@ pub use types::{ }; pub use unify::{UnifyError, unify_flow, unify_flows}; -use std::collections::BTreeMap; - use indexmap::IndexMap; use crate::analyze::dependencies::DependencyAnalysis; @@ -143,7 +141,7 @@ impl<'a> InferencePass<'a> { fn flow_to_type_id(&mut self, flow: &TypeFlow) -> TypeId { match flow { - TypeFlow::Void => self.ctx.intern_struct(BTreeMap::new()), + TypeFlow::Void => TYPE_VOID, TypeFlow::Scalar(id) | TypeFlow::Bubble(id) => *id, } } diff --git a/crates/plotnik-lib/src/bytecode/constants.rs b/crates/plotnik-lib/src/bytecode/constants.rs index 67c9559e..24dec0f1 100644 --- a/crates/plotnik-lib/src/bytecode/constants.rs +++ b/crates/plotnik-lib/src/bytecode/constants.rs @@ -1,8 +1,5 @@ //! Bytecode format constants. -// Re-export primitive type constants from the shared type system -pub use crate::type_system::{TYPE_CUSTOM_START, TYPE_NODE, TYPE_STRING, TYPE_VOID}; - /// Magic bytes identifying a Plotnik bytecode file. pub const MAGIC: [u8; 4] = *b"PTKQ"; diff --git a/crates/plotnik-lib/src/bytecode/dump.rs b/crates/plotnik-lib/src/bytecode/dump.rs index a2c623be..debc7627 100644 --- a/crates/plotnik-lib/src/bytecode/dump.rs +++ b/crates/plotnik-lib/src/bytecode/dump.rs @@ -18,7 +18,7 @@ pub fn dump(module: &Module) -> String { let ctx = DumpContext::new(module); dump_header(&mut out, module); - dump_strings(&mut out, module); + dump_strings(&mut out, module, &ctx); dump_types_defs(&mut out, module, &ctx); dump_types_members(&mut out, module, &ctx); dump_types_names(&mut out, module, &ctx); @@ -35,6 +35,15 @@ fn dump_header(out: &mut String, module: &Module) { out.push('\n'); } +/// Calculate the minimum width needed to display numbers up to `count - 1`. +fn width_for_count(count: usize) -> usize { + if count <= 1 { + 1 + } else { + ((count - 1) as f64).log10().floor() as usize + 1 + } +} + /// Context for dump formatting, precomputes lookups for O(1) access. struct DumpContext { /// Whether the bytecode is linked (contains grammar IDs vs StringIds). @@ -47,6 +56,16 @@ struct DumpContext { node_field_names: BTreeMap, /// All strings (for unlinked mode lookups). all_strings: Vec, + /// Width for string indices (S#). + str_width: usize, + /// Width for type indices (T#). + type_width: usize, + /// Width for member indices (M#). + member_width: usize, + /// Width for name indices (N#). + name_width: usize, + /// Width for step indices. + step_width: usize, } impl DumpContext { @@ -83,12 +102,26 @@ impl DumpContext { .map(|i| strings.get(StringId(i as u16)).to_string()) .collect(); + // Compute widths for index formatting + let types = module.types(); + let type_count = 3 + types.defs_count(); // 3 builtins + custom types + let str_width = width_for_count(str_count); + let type_width = width_for_count(type_count); + let member_width = width_for_count(types.members_count()); + let name_width = width_for_count(types.names_count()); + let step_width = width_for_count(header.transitions_count as usize); + Self { is_linked, step_labels, node_type_names, node_field_names, all_strings, + str_width, + type_width, + member_width, + name_width, + step_width, } } @@ -123,14 +156,15 @@ impl DumpContext { } } -fn dump_strings(out: &mut String, module: &Module) { +fn dump_strings(out: &mut String, module: &Module, ctx: &DumpContext) { let strings = module.strings(); let count = module.header().str_table_count as usize; + let w = ctx.str_width; out.push_str("[strings]\n"); for i in 0..count { let s = strings.get(StringId(i as u16)); - writeln!(out, "S{i:02} {s:?}").unwrap(); + writeln!(out, "S{i:0w$} {s:?}").unwrap(); } out.push('\n'); } @@ -138,31 +172,34 @@ fn dump_strings(out: &mut String, module: &Module) { fn dump_types_defs(out: &mut String, module: &Module, ctx: &DumpContext) { let types = module.types(); let strings = module.strings(); + let tw = ctx.type_width; + let mw = ctx.member_width; out.push_str("[type_defs]\n"); - // Builtins (T00-T02) - out.push_str("T00 = void\n"); - out.push_str("T01 = Node\n"); - out.push_str("T02 = str\n"); - - // Custom types (T03+) + // All types are now in type_defs, including builtins for i in 0..types.defs_count() { let def = types.get_def(i); - let type_id = i + 3; // Custom types start at index 3 - let kind = def.type_kind().expect("valid type kind"); + let formatted = match kind { - TypeKind::Struct => format!("Struct M{}[{}]", def.data, def.count), - TypeKind::Enum => format!("Enum M{}[{}]", def.data, def.count), - TypeKind::Optional => format!("Optional(T{:02})", def.data), - TypeKind::ArrayZeroOrMore => format!("ArrayStar(T{:02})", def.data), - TypeKind::ArrayOneOrMore => format!("ArrayPlus(T{:02})", def.data), - TypeKind::Alias => format!("Alias(T{:02})", def.data), + // Primitive types + TypeKind::Void => "".to_string(), + TypeKind::Node => "".to_string(), + TypeKind::String => "".to_string(), + // Composite types + TypeKind::Struct => format!("Struct M{:0mw$}:{}", def.data, def.count), + TypeKind::Enum => format!("Enum M{:0mw$}:{}", def.data, def.count), + // Wrapper types + TypeKind::Optional => format!("Optional(T{:0tw$})", def.data), + TypeKind::ArrayZeroOrMore => format!("ArrayStar(T{:0tw$})", def.data), + TypeKind::ArrayOneOrMore => format!("ArrayPlus(T{:0tw$})", def.data), + TypeKind::Alias => format!("Alias(T{:0tw$})", def.data), }; - // Generate comment for composites + // Generate comment for non-primitives let comment = match kind { + TypeKind::Void | TypeKind::Node | TypeKind::String => String::new(), TypeKind::Struct => { let fields: Vec<_> = types .members_of(&def) @@ -192,7 +229,7 @@ fn dump_types_defs(out: &mut String, module: &Module, ctx: &DumpContext) { TypeKind::Alias => String::new(), }; - writeln!(out, "T{type_id:02} = {formatted}{comment}").unwrap(); + writeln!(out, "T{i:0tw$} = {formatted}{comment}").unwrap(); } out.push('\n'); } @@ -200,6 +237,9 @@ fn dump_types_defs(out: &mut String, module: &Module, ctx: &DumpContext) { fn dump_types_members(out: &mut String, module: &Module, ctx: &DumpContext) { let types = module.types(); let strings = module.strings(); + let mw = ctx.member_width; + let sw = ctx.str_width; + let tw = ctx.type_width; out.push_str("[type_members]\n"); for i in 0..types.members_count() { @@ -208,7 +248,7 @@ fn dump_types_members(out: &mut String, module: &Module, ctx: &DumpContext) { let type_name = format_type_name(member.type_id, module, ctx); writeln!( out, - "M{i}: S{:02} → T{:02} ; {name}: {type_name}", + "M{i:0mw$}: S{:0sw$} → T{:0tw$} ; {name}: {type_name}", member.name.0, member.type_id.0 ) .unwrap(); @@ -216,9 +256,12 @@ fn dump_types_members(out: &mut String, module: &Module, ctx: &DumpContext) { out.push('\n'); } -fn dump_types_names(out: &mut String, module: &Module, _ctx: &DumpContext) { +fn dump_types_names(out: &mut String, module: &Module, ctx: &DumpContext) { let types = module.types(); let strings = module.strings(); + let nw = ctx.name_width; + let sw = ctx.str_width; + let tw = ctx.type_width; out.push_str("[type_names]\n"); for i in 0..types.names_count() { @@ -226,7 +269,7 @@ fn dump_types_names(out: &mut String, module: &Module, _ctx: &DumpContext) { let name = strings.get(entry.name); writeln!( out, - "N{i}: S{:02} → T{:02} ; {name}", + "N{i:0nw$}: S{:0sw$} → T{:0tw$} ; {name}", entry.name.0, entry.type_id.0 ) .unwrap(); @@ -235,20 +278,19 @@ fn dump_types_names(out: &mut String, module: &Module, _ctx: &DumpContext) { } /// Format a type ID as a human-readable name. -fn format_type_name(type_id: QTypeId, module: &Module, _ctx: &DumpContext) -> String { - if type_id.is_builtin() { - return match type_id.0 { - 0 => "void".to_string(), - 1 => "Node".to_string(), - 2 => "str".to_string(), - _ => unreachable!(), - }; - } - - // Try to find a name in types.names +fn format_type_name(type_id: QTypeId, module: &Module, ctx: &DumpContext) -> String { let types = module.types(); let strings = module.strings(); + // Check if it's a primitive type + if let Some(def) = types.get(type_id) + && let Some(kind) = def.type_kind() + && let Some(name) = kind.primitive_name() + { + return format!("<{}>", name); + } + + // Try to find a name in types.names for i in 0..types.names_count() { let entry = types.get_name(i); if entry.type_id == type_id { @@ -256,13 +298,16 @@ fn format_type_name(type_id: QTypeId, module: &Module, _ctx: &DumpContext) -> St } } - // Fall back to T## format - format!("T{:02}", type_id.0) + // Fall back to T# format + let tw = ctx.type_width; + format!("T{:0tw$}", type_id.0) } -fn dump_entrypoints(out: &mut String, module: &Module, _ctx: &DumpContext) { +fn dump_entrypoints(out: &mut String, module: &Module, ctx: &DumpContext) { let strings = module.strings(); let entrypoints = module.entrypoints(); + let stw = ctx.step_width; + let tw = ctx.type_width; out.push_str("[entrypoints]\n"); @@ -282,7 +327,7 @@ fn dump_entrypoints(out: &mut String, module: &Module, _ctx: &DumpContext) { for (name, target, type_id) in entries { writeln!( out, - "{name:width$} = {:02} :: T{type_id:02}", + "{name:width$} = {:0stw$} :: T{type_id:0tw$}", target, width = max_len ) @@ -294,13 +339,7 @@ fn dump_entrypoints(out: &mut String, module: &Module, _ctx: &DumpContext) { fn dump_code(out: &mut String, module: &Module, ctx: &DumpContext) { let header = module.header(); let transitions_count = header.transitions_count as usize; - - // Calculate step number width based on total steps - let step_width = if transitions_count == 0 { - 2 - } else { - ((transitions_count as f64).log10().floor() as usize + 1).max(2) - }; + let step_width = ctx.step_width; out.push_str("[transitions]\n"); diff --git a/crates/plotnik-lib/src/bytecode/ids.rs b/crates/plotnik-lib/src/bytecode/ids.rs index 56129f45..aa69b9fc 100644 --- a/crates/plotnik-lib/src/bytecode/ids.rs +++ b/crates/plotnik-lib/src/bytecode/ids.rs @@ -1,6 +1,6 @@ //! Bytecode index newtypes. -use super::constants::{STEP_ACCEPT, STEP_SIZE, TYPE_CUSTOM_START, TYPE_STRING}; +use super::constants::{STEP_ACCEPT, STEP_SIZE}; /// Index into the Transitions section (8-byte steps). #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default)] @@ -27,37 +27,11 @@ impl StepId { pub struct StringId(pub u16); /// Index into the Type Definition table. -/// Values 0-2 are builtins; 3+ index into TypeDefs. +/// All types (including builtins) are stored sequentially in TypeDefs. #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default)] #[repr(transparent)] pub struct QTypeId(pub u16); -impl QTypeId { - pub const VOID: Self = Self(super::constants::TYPE_VOID); - pub const NODE: Self = Self(super::constants::TYPE_NODE); - pub const STRING: Self = Self(TYPE_STRING); - - #[inline] - pub fn is_builtin(self) -> bool { - self.0 <= TYPE_STRING - } - - /// Index into TypeDefs array (only valid for non-builtins). - #[inline] - pub fn custom_index(self) -> Option { - if self.0 >= TYPE_CUSTOM_START { - Some((self.0 - TYPE_CUSTOM_START) as usize) - } else { - None - } - } - - #[inline] - pub fn from_custom_index(idx: usize) -> Self { - Self(TYPE_CUSTOM_START + idx as u16) - } -} - #[cfg(test)] mod tests { use super::*; @@ -68,17 +42,4 @@ mod tests { assert_eq!(StepId(1).byte_offset(), 8); assert_eq!(StepId(10).byte_offset(), 80); } - - #[test] - fn bc_type_id_builtins() { - assert!(QTypeId::VOID.is_builtin()); - assert!(QTypeId::NODE.is_builtin()); - assert!(QTypeId::STRING.is_builtin()); - assert!(!QTypeId(3).is_builtin()); - - assert_eq!(QTypeId::VOID.custom_index(), None); - assert_eq!(QTypeId(3).custom_index(), Some(0)); - assert_eq!(QTypeId(5).custom_index(), Some(2)); - assert_eq!(QTypeId::from_custom_index(0), QTypeId(3)); - } } diff --git a/crates/plotnik-lib/src/bytecode/mod.rs b/crates/plotnik-lib/src/bytecode/mod.rs index ebe040de..472b972c 100644 --- a/crates/plotnik-lib/src/bytecode/mod.rs +++ b/crates/plotnik-lib/src/bytecode/mod.rs @@ -15,10 +15,7 @@ mod nav; mod sections; mod type_meta; -pub use constants::{ - MAGIC, SECTION_ALIGN, STEP_ACCEPT, STEP_SIZE, TYPE_CUSTOM_START, TYPE_NODE, TYPE_STRING, - TYPE_VOID, VERSION, -}; +pub use constants::{MAGIC, SECTION_ALIGN, STEP_ACCEPT, STEP_SIZE, VERSION}; pub use ids::{QTypeId, StepId, StringId}; diff --git a/crates/plotnik-lib/src/bytecode/module.rs b/crates/plotnik-lib/src/bytecode/module.rs index 82cefde1..5c79a13e 100644 --- a/crates/plotnik-lib/src/bytecode/module.rs +++ b/crates/plotnik-lib/src/bytecode/module.rs @@ -430,7 +430,12 @@ impl<'a> TypesView<'a> { /// Get a type definition by QTypeId. pub fn get(&self, id: QTypeId) -> Option { - id.custom_index().map(|idx| self.get_def(idx)) + let idx = id.0 as usize; + if idx < self.defs_count { + Some(self.get_def(idx)) + } else { + None + } } /// Get a type member by index. diff --git a/crates/plotnik-lib/src/emit/mod.rs b/crates/plotnik-lib/src/emit/mod.rs index 0cb3ccf5..c7ad36ce 100644 --- a/crates/plotnik-lib/src/emit/mod.rs +++ b/crates/plotnik-lib/src/emit/mod.rs @@ -218,18 +218,14 @@ impl TypeTableBuilder { /// Build type table from TypeContext. /// /// Types are collected in definition order, depth-first, to mirror query structure. + /// Used builtins are emitted first, then custom types - no reserved slots. pub fn build( &mut self, type_ctx: &TypeContext, interner: &Interner, strings: &mut StringTableBuilder, ) -> Result<(), EmitError> { - // Pre-populate builtin mappings - self.mapping.insert(TYPE_VOID, QTypeId::VOID); - self.mapping.insert(TYPE_NODE, QTypeId::NODE); - self.mapping.insert(TYPE_STRING, QTypeId::STRING); - - // Collect types in definition order, depth-first to mirror query structure + // Collect custom types in definition order, depth-first let mut ordered_types: Vec = Vec::new(); let mut seen: HashSet = HashSet::new(); @@ -237,12 +233,41 @@ impl TypeTableBuilder { collect_types_dfs(type_id, type_ctx, &mut ordered_types, &mut seen); } - // Pre-assign QTypeIds and reserve slots for all collected types. - // This ensures that forward references (e.g., recursive types) can be resolved. - for (i, &type_id) in ordered_types.iter().enumerate() { - let bc_id = QTypeId::from_custom_index(i); + // Determine which builtins are actually used by scanning all types + let mut used_builtins = [false; 3]; // [Void, Node, String] + let mut seen = HashSet::new(); + for &type_id in &ordered_types { + collect_builtin_refs(type_id, type_ctx, &mut used_builtins, &mut seen); + } + // Also check entrypoint result types directly + for (_def_id, type_id) in type_ctx.iter_def_types() { + if type_id == TYPE_VOID { + used_builtins[0] = true; + } else if type_id == TYPE_NODE { + used_builtins[1] = true; + } else if type_id == TYPE_STRING { + used_builtins[2] = true; + } + } + + // Phase 1: Emit used builtins first (in order: Void, Node, String) + let builtin_types = [(TYPE_VOID, TypeKind::Void), (TYPE_NODE, TypeKind::Node), (TYPE_STRING, TypeKind::String)]; + for (i, &(builtin_id, kind)) in builtin_types.iter().enumerate() { + if used_builtins[i] { + let bc_id = QTypeId(self.type_defs.len() as u16); + self.mapping.insert(builtin_id, bc_id); + self.type_defs.push(TypeDef { + data: 0, + count: 0, + kind: kind as u8, + }); + } + } + + // Phase 2: Pre-assign QTypeIds for custom types and reserve slots + for &type_id in &ordered_types { + let bc_id = QTypeId(self.type_defs.len() as u16); self.mapping.insert(type_id, bc_id); - // Push a placeholder that will be filled in during emit self.type_defs.push(TypeDef { data: 0, count: 0, @@ -250,8 +275,11 @@ impl TypeTableBuilder { }); } - // Emit TypeDefs and TypeMembers - fill in the placeholders. - for (slot_index, &type_id) in ordered_types.iter().enumerate() { + // Phase 3: Fill in custom type definitions + // We need to calculate slot index as offset from where custom types start + let builtin_count = used_builtins.iter().filter(|&&b| b).count(); + for (i, &type_id) in ordered_types.iter().enumerate() { + let slot_index = builtin_count + i; let type_shape = type_ctx .get_type(type_id) .expect("collected type must exist"); @@ -262,7 +290,7 @@ impl TypeTableBuilder { for (def_id, type_id) in type_ctx.iter_def_types() { let name_sym = type_ctx.def_name_sym(def_id); let name = strings.get_or_intern(name_sym, interner)?; - let bc_type_id = self.mapping.get(&type_id).copied().unwrap_or(QTypeId::VOID); + let bc_type_id = self.mapping.get(&type_id).copied().unwrap_or(QTypeId(0)); self.type_names.push(TypeName { name, type_id: bc_type_id, @@ -290,7 +318,7 @@ impl TypeTableBuilder { TypeShape::Custom(sym) => { // Custom type annotation: @x :: Identifier → type Identifier = Node - let bc_type_id = QTypeId::from_custom_index(slot_index); + let bc_type_id = QTypeId(slot_index as u16); // Add TypeName entry for the custom type let name = strings.get_or_intern(*sym, interner)?; @@ -299,8 +327,10 @@ impl TypeTableBuilder { type_id: bc_type_id, }); + // Custom types alias Node - look up Node's actual bytecode ID + let node_bc_id = self.mapping.get(&TYPE_NODE).copied().unwrap_or(QTypeId(0)); self.type_defs[slot_index] = TypeDef { - data: QTypeId::NODE.0, // Custom types alias Node + data: node_bc_id.0, count: 0, kind: TypeKind::Alias as u8, }; @@ -410,8 +440,8 @@ impl TypeTableBuilder { return self.resolve_type(def_type_id, type_ctx); } - // If not found, default to VOID (should not happen for well-formed types) - Ok(QTypeId::VOID) + // If not found, default to first type (should not happen for well-formed types) + Ok(QTypeId(0)) } /// Resolve a field's type, handling optionality. @@ -437,8 +467,8 @@ impl TypeTableBuilder { return Ok(optional_id); } - // Create new Optional wrapper - let optional_id = QTypeId::from_custom_index(self.type_defs.len()); + // Create new Optional wrapper at the next available index + let optional_id = QTypeId(self.type_defs.len() as u16); self.type_defs.push(TypeDef { data: base_type.0, @@ -452,8 +482,7 @@ impl TypeTableBuilder { /// Validate that counts fit in u16. pub fn validate(&self) -> Result<(), EmitError> { - // Max 65533 custom types (65535 - 3 builtins) - if self.type_defs.len() > 65533 { + if self.type_defs.len() > 65535 { return Err(EmitError::TooManyTypes(self.type_defs.len())); } if self.type_members.len() > 65535 { @@ -473,8 +502,7 @@ impl TypeTableBuilder { /// Fields/variants are at indices [base..base+count). pub fn get_member_base(&self, type_id: TypeId) -> Option { let bc_type_id = self.mapping.get(&type_id)?; - let slot_index = bc_type_id.custom_index()?; - let type_def = self.type_defs.get(slot_index)?; + let type_def = self.type_defs.get(bc_type_id.0 as usize)?; // Only Struct and Enum have member bases let kind = TypeKind::from_u8(type_def.kind)?; @@ -591,6 +619,50 @@ fn collect_types_dfs( } } +/// Collect which builtin types are referenced by a type. +fn collect_builtin_refs( + type_id: TypeId, + type_ctx: &TypeContext, + used: &mut [bool; 3], + seen: &mut HashSet, +) { + if !seen.insert(type_id) { + return; + } + + let Some(type_shape) = type_ctx.get_type(type_id) else { + return; + }; + + match type_shape { + TypeShape::Void => used[0] = true, + TypeShape::Node => used[1] = true, + TypeShape::String => used[2] = true, + TypeShape::Custom(_) => used[1] = true, // Custom types alias Node + TypeShape::Struct(fields) => { + for field_info in fields.values() { + collect_builtin_refs(field_info.type_id, type_ctx, used, seen); + } + } + TypeShape::Enum(variants) => { + for &variant_type_id in variants.values() { + collect_builtin_refs(variant_type_id, type_ctx, used, seen); + } + } + TypeShape::Array { element, .. } => { + collect_builtin_refs(*element, type_ctx, used, seen); + } + TypeShape::Optional(inner) => { + collect_builtin_refs(*inner, type_ctx, used, seen); + } + TypeShape::Ref(def_id) => { + if let Some(target_id) = type_ctx.get_def_type(*def_id) { + collect_builtin_refs(target_id, type_ctx, used, seen); + } + } + } +} + /// Pad a buffer to the section alignment boundary. fn pad_to_section(buf: &mut Vec) { let rem = buf.len() % SECTION_ALIGN; @@ -675,7 +747,7 @@ fn emit_inner( for (def_id, type_id) in type_ctx.iter_def_types() { let name_sym = type_ctx.def_name_sym(def_id); let name = strings.get_or_intern(name_sym, interner)?; - let result_type = types.get(type_id).unwrap_or(QTypeId::VOID); + let result_type = types.get(type_id).expect("all def types should be mapped"); // Get actual target from compiled result let target = compile_result diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_captured.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_captured.snap index 1ceca613..4fea8f77 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_captured.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_captured.snap @@ -7,33 +7,31 @@ Test = [(identifier) (number)] @value linked = false [strings] -S00 "Beauty will save the world" -S01 "value" -S02 "Test" -S03 "identifier" -S04 "number" +S0 "Beauty will save the world" +S1 "value" +S2 "Test" +S3 "identifier" +S4 "number" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { value } +T0 = +T1 = Struct M0:1 ; { value } [type_members] -M0: S01 → T01 ; value: Node +M0: S1 → T0 ; value: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 𝜀 05, 07 - 04 ▶ - 05 (identifier) [Node Set(M0)] 04 - 07 (number) [Node Set(M0)] 04 + 1 𝜀 2 + 2 𝜀 5, 7 + 4 ▶ + 5 (identifier) [Node Set(M0)] 4 + 7 (number) [Node Set(M0)] 4 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_captured_tagged.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_captured_tagged.snap index 5ef36198..b499fe4e 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_captured_tagged.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_captured_tagged.snap @@ -7,37 +7,35 @@ Test = [A: (identifier) @a B: (number) @b] @item linked = false [strings] -S00 "Beauty will save the world" -S01 "a" -S02 "b" -S03 "A" -S04 "B" -S05 "item" -S06 "Test" -S07 "identifier" -S08 "number" +S0 "Beauty will save the world" +S1 "a" +S2 "b" +S3 "A" +S4 "B" +S5 "item" +S6 "Test" +S7 "identifier" +S8 "number" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { a } -T04 = Struct M1[1] ; { b } -T05 = Enum M2[2] ; A | B -T06 = Struct M4[1] ; { item } +T0 = +T1 = Struct M0:1 ; { a } +T2 = Struct M1:1 ; { b } +T3 = Enum M2:2 ; A | B +T4 = Struct M4:1 ; { item } [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node -M2: S03 → T03 ; A: T03 -M3: S04 → T04 ; B: T04 -M4: S05 → T05 ; item: T05 +M0: S1 → T0 ; a: +M1: S2 → T0 ; b: +M2: S3 → T1 ; A: T1 +M3: S4 → T2 ; B: T2 +M4: S5 → T3 ; item: T3 [type_names] -N0: S06 → T06 ; Test +N0: S6 → T4 ; Test [entrypoints] -Test = 01 :: T06 +Test = 01 :: T4 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_in_quantifier.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_in_quantifier.snap index 8e67a1cd..6be8a5c6 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_in_quantifier.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_in_quantifier.snap @@ -20,29 +20,27 @@ S09 "pair" S10 "shorthand_property_identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { a } -T04 = Struct M1[1] ; { b } -T05 = Enum M2[2] ; A | B -T06 = Struct M4[1] ; { item } -T07 = ArrayStar(T06) ; T06* -T08 = Struct M5[1] ; { items } +T0 = +T1 = Struct M0:1 ; { a } +T2 = Struct M1:1 ; { b } +T3 = Enum M2:2 ; A | B +T4 = Struct M4:1 ; { item } +T5 = ArrayStar(T4) ; T4* +T6 = Struct M5:1 ; { items } [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node -M2: S03 → T03 ; A: T03 -M3: S04 → T04 ; B: T04 -M4: S05 → T05 ; item: T05 -M5: S06 → T07 ; items: T07 +M0: S01 → T0 ; a: +M1: S02 → T0 ; b: +M2: S03 → T1 ; A: T1 +M3: S04 → T2 ; B: T2 +M4: S05 → T3 ; item: T3 +M5: S06 → T5 ; items: T5 [type_names] -N0: S07 → T08 ; Test +N0: S07 → T6 ; Test [entrypoints] -Test = 01 :: T08 +Test = 01 :: T6 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_labeled.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_labeled.snap index bbc929fc..21397771 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_labeled.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_labeled.snap @@ -10,34 +10,32 @@ Test = [ linked = false [strings] -S00 "Beauty will save the world" -S01 "a" -S02 "b" -S03 "A" -S04 "B" -S05 "Test" -S06 "identifier" -S07 "number" +S0 "Beauty will save the world" +S1 "a" +S2 "b" +S3 "A" +S4 "B" +S5 "Test" +S6 "identifier" +S7 "number" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { a } -T04 = Struct M1[1] ; { b } -T05 = Enum M2[2] ; A | B +T0 = +T1 = Struct M0:1 ; { a } +T2 = Struct M1:1 ; { b } +T3 = Enum M2:2 ; A | B [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node -M2: S03 → T03 ; A: T03 -M3: S04 → T04 ; B: T04 +M0: S1 → T0 ; a: +M1: S2 → T0 ; b: +M2: S3 → T1 ; A: T1 +M3: S4 → T2 ; B: T2 [type_names] -N0: S05 → T05 ; Test +N0: S5 → T3 ; Test [entrypoints] -Test = 01 :: T05 +Test = 01 :: T3 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_no_internal_captures.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_no_internal_captures.snap index 14ae4649..766342f4 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_no_internal_captures.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_no_internal_captures.snap @@ -7,27 +7,25 @@ Test = (program [(identifier) (number)] @x) linked = false [strings] -S00 "Beauty will save the world" -S01 "x" -S02 "Test" -S03 "program" -S04 "identifier" -S05 "number" +S0 "Beauty will save the world" +S1 "x" +S2 "Test" +S3 "program" +S4 "identifier" +S5 "number" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { x } +T0 = +T1 = Struct M0:1 ; { x } [type_members] -M0: S01 → T01 ; x: Node +M0: S1 → T0 ; x: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_null_injection.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_null_injection.snap index f1dca580..f10f6a8d 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_null_injection.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_null_injection.snap @@ -7,29 +7,27 @@ Test = [(identifier) @x (number) @y] linked = false [strings] -S00 "Beauty will save the world" -S01 "x" -S02 "y" -S03 "Test" -S04 "identifier" -S05 "number" +S0 "Beauty will save the world" +S1 "x" +S2 "y" +S3 "Test" +S4 "identifier" +S5 "number" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { x, y } -T04 = Optional(T01) ; Node? +T0 = +T1 = Struct M0:2 ; { x, y } +T2 = Optional(T0) ; ? [type_members] -M0: S01 → T04 ; x: T04 -M1: S02 → T04 ; y: T04 +M0: S1 → T2 ; x: T2 +M1: S2 → T2 ; y: T2 [type_names] -N0: S03 → T03 ; Test +N0: S3 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_unlabeled.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_unlabeled.snap index af764e5e..88dc38cc 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_unlabeled.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__alternations_unlabeled.snap @@ -7,29 +7,27 @@ Test = [(identifier) @id (string) @str] linked = false [strings] -S00 "Beauty will save the world" -S01 "id" -S02 "str" -S03 "Test" -S04 "identifier" -S05 "string" +S0 "Beauty will save the world" +S1 "id" +S2 "str" +S3 "Test" +S4 "identifier" +S5 "string" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { id, str } -T04 = Optional(T01) ; Node? +T0 = +T1 = Struct M0:2 ; { id, str } +T2 = Optional(T0) ; ? [type_members] -M0: S01 → T04 ; id: T04 -M1: S02 → T04 ; str: T04 +M0: S1 → T2 ; id: T2 +M1: S2 → T2 ; str: T2 [type_names] -N0: S03 → T03 ; Test +N0: S3 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_between_siblings.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_between_siblings.snap index b87a9317..05c1923e 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_between_siblings.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_between_siblings.snap @@ -7,33 +7,30 @@ Test = (parent (a) . (b)) linked = false [strings] -S00 "Beauty will save the world" -S01 "Test" -S02 "parent" -S03 "b" -S04 "a" +S0 "Beauty will save the world" +S1 "Test" +S2 "parent" +S3 "b" +S4 "a" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[0] ; { } +T0 = [type_members] [type_names] -N0: S01 → T03 ; Test +N0: S1 → T0 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T0 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (parent) 03 - 03 ↓* (a) 04 - 04 ~ (b) 05 - 05 *↑¹ 06 - 06 ▶ + 1 𝜀 2 + 2 (parent) 3 + 3 ↓* (a) 4 + 4 ~ (b) 5 + 5 *↑¹ 6 + 6 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_first_child.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_first_child.snap index e213e6a5..36c38db8 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_first_child.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_first_child.snap @@ -7,31 +7,28 @@ Test = (parent . (first)) linked = false [strings] -S00 "Beauty will save the world" -S01 "Test" -S02 "parent" -S03 "first" +S0 "Beauty will save the world" +S1 "Test" +S2 "parent" +S3 "first" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[0] ; { } +T0 = [type_members] [type_names] -N0: S01 → T03 ; Test +N0: S1 → T0 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T0 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (parent) 03 - 03 ↓~ (first) 04 - 04 *↑¹ 05 - 05 ▶ + 1 𝜀 2 + 2 (parent) 3 + 3 ↓~ (first) 4 + 4 *↑¹ 5 + 5 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_last_child.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_last_child.snap index 943c5272..9fab5221 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_last_child.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_last_child.snap @@ -7,31 +7,28 @@ Test = (parent (last) .) linked = false [strings] -S00 "Beauty will save the world" -S01 "Test" -S02 "parent" -S03 "last" +S0 "Beauty will save the world" +S1 "Test" +S2 "parent" +S3 "last" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[0] ; { } +T0 = [type_members] [type_names] -N0: S01 → T03 ; Test +N0: S1 → T0 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T0 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (parent) 03 - 03 ↓* (last) 04 - 04 ~↑¹ 05 - 05 ▶ + 1 𝜀 2 + 2 (parent) 3 + 3 ↓* (last) 4 + 4 ~↑¹ 5 + 5 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_no_anchor.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_no_anchor.snap index 17238464..48f666fe 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_no_anchor.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_no_anchor.snap @@ -7,33 +7,30 @@ Test = (parent (a) (b)) linked = false [strings] -S00 "Beauty will save the world" -S01 "Test" -S02 "parent" -S03 "b" -S04 "a" +S0 "Beauty will save the world" +S1 "Test" +S2 "parent" +S3 "b" +S4 "a" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[0] ; { } +T0 = [type_members] [type_names] -N0: S01 → T03 ; Test +N0: S1 → T0 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T0 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (parent) 03 - 03 ↓* (a) 04 - 04 * (b) 05 - 05 *↑¹ 06 - 06 ▶ + 1 𝜀 2 + 2 (parent) 3 + 3 ↓* (a) 4 + 4 * (b) 5 + 5 *↑¹ 6 + 6 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_with_anonymous.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_with_anonymous.snap index b9c79e31..d83b4c79 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_with_anonymous.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__anchors_with_anonymous.snap @@ -7,33 +7,30 @@ Test = (parent "+" . (next)) linked = false [strings] -S00 "Beauty will save the world" -S01 "Test" -S02 "parent" -S03 "next" -S04 "+" +S0 "Beauty will save the world" +S1 "Test" +S2 "parent" +S3 "next" +S4 "+" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[0] ; { } +T0 = [type_members] [type_names] -N0: S01 → T03 ; Test +N0: S1 → T0 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T0 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (parent) 03 - 03 ↓* (+) 04 - 04 . (next) 05 - 05 *↑¹ 06 - 06 ▶ + 1 𝜀 2 + 2 (parent) 3 + 3 ↓* (+) 4 + 4 . (next) 5 + 5 *↑¹ 6 + 6 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_basic.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_basic.snap index 437191cd..dfdddc7b 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_basic.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_basic.snap @@ -7,30 +7,28 @@ Test = (identifier) @name linked = false [strings] -S00 "Beauty will save the world" -S01 "name" -S02 "Test" -S03 "identifier" +S0 "Beauty will save the world" +S1 "name" +S2 "Test" +S3 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { name } +T0 = +T1 = Struct M0:1 ; { name } [type_members] -M0: S01 → T01 ; name: Node +M0: S1 → T0 ; name: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (identifier) [Node Set(M0)] 04 - 04 ▶ + 1 𝜀 2 + 2 (identifier) [Node Set(M0)] 4 + 4 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_deeply_nested.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_deeply_nested.snap index 5d27debd..93560816 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_deeply_nested.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_deeply_nested.snap @@ -7,30 +7,28 @@ Test = (a (b (c (d) @d) @c) @b) @a linked = false [strings] -S00 "Beauty will save the world" -S01 "a" -S02 "b" -S03 "c" -S04 "d" -S05 "Test" +S0 "Beauty will save the world" +S1 "a" +S2 "b" +S3 "c" +S4 "d" +S5 "Test" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[4] ; { a, b, c, d } +T0 = +T1 = Struct M0:4 ; { a, b, c, d } [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node -M2: S03 → T01 ; c: Node -M3: S04 → T01 ; d: Node +M0: S1 → T0 ; a: +M1: S2 → T0 ; b: +M2: S3 → T0 ; c: +M3: S4 → T0 ; d: [type_names] -N0: S05 → T03 ; Test +N0: S5 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_multiple.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_multiple.snap index 3dea748e..71fb37d8 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_multiple.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_multiple.snap @@ -7,37 +7,35 @@ Test = (binary_expression (identifier) @a (number) @b) linked = false [strings] -S00 "Beauty will save the world" -S01 "a" -S02 "b" -S03 "Test" -S04 "binary_expression" -S05 "number" -S06 "identifier" +S0 "Beauty will save the world" +S1 "a" +S2 "b" +S3 "Test" +S4 "binary_expression" +S5 "number" +S6 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { a, b } +T0 = +T1 = Struct M0:2 ; { a, b } [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node +M0: S1 → T0 ; a: +M1: S2 → T0 ; b: [type_names] -N0: S03 → T03 ; Test +N0: S3 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (binary_expression) 03 - 03 ↓* (identifier) [Node Set(M0)] 05 - 05 * (number) [Node Set(M1)] 07 - 07 *↑¹ 08 - 08 ▶ + 1 𝜀 2 + 2 (binary_expression) 3 + 3 ↓* (identifier) [Node Set(M0)] 5 + 5 * (number) [Node Set(M1)] 7 + 7 *↑¹ 8 + 8 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_nested_flat.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_nested_flat.snap index e5d2a2d2..da619d0f 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_nested_flat.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_nested_flat.snap @@ -7,28 +7,26 @@ Test = (a (b (c) @c) @b) @a linked = false [strings] -S00 "Beauty will save the world" -S01 "a" -S02 "b" -S03 "c" -S04 "Test" +S0 "Beauty will save the world" +S1 "a" +S2 "b" +S3 "c" +S4 "Test" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[3] ; { a, b, c } +T0 = +T1 = Struct M0:3 ; { a, b, c } [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node -M2: S03 → T01 ; c: Node +M0: S1 → T0 ; a: +M1: S2 → T0 ; b: +M2: S3 → T0 ; c: [type_names] -N0: S04 → T03 ; Test +N0: S4 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_optional_wrapper_struct.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_optional_wrapper_struct.snap index ddab4285..60fcc4e3 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_optional_wrapper_struct.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_optional_wrapper_struct.snap @@ -7,33 +7,31 @@ Test = {{(identifier) @id} @inner}? @outer linked = false [strings] -S00 "Beauty will save the world" -S01 "id" -S02 "inner" -S03 "outer" -S04 "Test" -S05 "identifier" +S0 "Beauty will save the world" +S1 "id" +S2 "inner" +S3 "outer" +S4 "Test" +S5 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { id } -T04 = Struct M1[1] ; { inner } -T05 = Struct M2[1] ; { outer } -T06 = Optional(T03) ; T03? -T07 = Optional(T04) ; T04? +T0 = +T1 = Struct M0:1 ; { id } +T2 = Struct M1:1 ; { inner } +T3 = Struct M2:1 ; { outer } +T4 = Optional(T1) ; T1? +T5 = Optional(T2) ; T2? [type_members] -M0: S01 → T01 ; id: Node -M1: S02 → T06 ; inner: T06 -M2: S03 → T07 ; outer: T07 +M0: S1 → T0 ; id: +M1: S2 → T4 ; inner: T4 +M2: S3 → T5 ; outer: T5 [type_names] -N0: S04 → T05 ; Test +N0: S4 → T3 ; Test [entrypoints] -Test = 01 :: T05 +Test = 01 :: T3 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_struct_scope.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_struct_scope.snap index 48072979..1ee37c98 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_struct_scope.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_struct_scope.snap @@ -7,29 +7,27 @@ Test = {(a) @a (b) @b} @item linked = false [strings] -S00 "Beauty will save the world" -S01 "a" -S02 "b" -S03 "item" -S04 "Test" +S0 "Beauty will save the world" +S1 "a" +S2 "b" +S3 "item" +S4 "Test" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { a, b } -T04 = Struct M2[1] ; { item } +T0 = +T1 = Struct M0:2 ; { a, b } +T2 = Struct M2:1 ; { item } [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node -M2: S03 → T03 ; item: T03 +M0: S1 → T0 ; a: +M1: S2 → T0 ; b: +M2: S3 → T1 ; item: T1 [type_names] -N0: S04 → T04 ; Test +N0: S4 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_with_type_custom.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_with_type_custom.snap index 3271d995..e52a6565 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_with_type_custom.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_with_type_custom.snap @@ -7,33 +7,31 @@ Test = (identifier) @name :: Identifier linked = false [strings] -S00 "Beauty will save the world" -S01 "Identifier" -S02 "name" -S03 "Test" -S04 "identifier" +S0 "Beauty will save the world" +S1 "Identifier" +S2 "name" +S3 "Test" +S4 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Alias(T01) -T04 = Struct M0[1] ; { name } +T0 = +T1 = Alias(T0) +T2 = Struct M0:1 ; { name } [type_members] -M0: S02 → T03 ; name: Identifier +M0: S2 → T1 ; name: Identifier [type_names] -N0: S01 → T03 ; Identifier -N1: S03 → T04 ; Test +N0: S1 → T1 ; Identifier +N1: S3 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 1 :: T2 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (identifier) [Node Set(M0)] 04 - 04 ▶ + 1 𝜀 2 + 2 (identifier) [Node Set(M0)] 4 + 4 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_with_type_string.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_with_type_string.snap index 86bb399c..72ea8628 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_with_type_string.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_with_type_string.snap @@ -7,30 +7,28 @@ Test = (identifier) @name :: string linked = false [strings] -S00 "Beauty will save the world" -S01 "name" -S02 "Test" -S03 "identifier" +S0 "Beauty will save the world" +S1 "name" +S2 "Test" +S3 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { name } +T0 = +T1 = Struct M0:1 ; { name } [type_members] -M0: S01 → T02 ; name: str +M0: S1 → T0 ; name: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (identifier) [Text Set(M0)] 04 - 04 ▶ + 1 𝜀 2 + 2 (identifier) [Text Set(M0)] 4 + 4 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_wrapper_struct.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_wrapper_struct.snap index c14db635..c58e3f14 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_wrapper_struct.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__captures_wrapper_struct.snap @@ -7,35 +7,33 @@ Test = {{(identifier) @id (number) @num} @row}* @rows linked = false [strings] -S00 "Beauty will save the world" -S01 "id" -S02 "num" -S03 "row" -S04 "rows" -S05 "Test" -S06 "number" -S07 "identifier" +S0 "Beauty will save the world" +S1 "id" +S2 "num" +S3 "row" +S4 "rows" +S5 "Test" +S6 "number" +S7 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { id, num } -T04 = Struct M2[1] ; { row } -T05 = ArrayStar(T04) ; T04* -T06 = Struct M3[1] ; { rows } +T0 = +T1 = Struct M0:2 ; { id, num } +T2 = Struct M2:1 ; { row } +T3 = ArrayStar(T2) ; T2* +T4 = Struct M3:1 ; { rows } [type_members] -M0: S01 → T01 ; id: Node -M1: S02 → T01 ; num: Node -M2: S03 → T03 ; row: T03 -M3: S04 → T05 ; rows: T05 +M0: S1 → T0 ; id: +M1: S2 → T0 ; num: +M2: S3 → T1 ; row: T1 +M3: S4 → T3 ; rows: T3 [type_names] -N0: S05 → T06 ; Test +N0: S5 → T4 ; Test [entrypoints] -Test = 01 :: T06 +Test = 01 :: T4 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__comprehensive_multi_definition.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__comprehensive_multi_definition.snap index 7d1dfd15..7f57612d 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__comprehensive_multi_definition.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__comprehensive_multi_definition.snap @@ -30,33 +30,32 @@ S12 "right" S13 "left" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { name } -T04 = Struct M1[1] ; { value } -T05 = Struct M2[1] ; { name } -T06 = Enum M3[2] ; Literal | Variable -T07 = Struct M5[2] ; { value, target } +T0 = +T1 = +T2 = Struct M0:1 ; { name } +T3 = Struct M1:1 ; { value } +T4 = Struct M2:1 ; { name } +T5 = Enum M3:2 ; Literal | Variable +T6 = Struct M5:2 ; { value, target } [type_members] -M0: S01 → T02 ; name: str -M1: S02 → T01 ; value: Node -M2: S01 → T01 ; name: Node -M3: S03 → T04 ; Literal: T04 -M4: S04 → T05 ; Variable: T05 -M5: S02 → T06 ; value: Expression -M6: S05 → T01 ; target: Node +M0: S01 → T1 ; name: +M1: S02 → T0 ; value: +M2: S01 → T0 ; name: +M3: S03 → T3 ; Literal: T3 +M4: S04 → T4 ; Variable: T4 +M5: S02 → T5 ; value: Expression +M6: S05 → T0 ; target: [type_names] -N0: S06 → T03 ; Ident -N1: S07 → T06 ; Expression -N2: S08 → T07 ; Assignment +N0: S06 → T2 ; Ident +N1: S07 → T5 ; Expression +N2: S08 → T6 ; Assignment [entrypoints] -Assignment = 08 :: T07 -Expression = 05 :: T06 -Ident = 01 :: T03 +Assignment = 08 :: T6 +Expression = 05 :: T5 +Ident = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_multiple.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_multiple.snap index 36850c4d..64d2698a 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_multiple.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_multiple.snap @@ -8,42 +8,40 @@ Bar = (string) @str linked = false [strings] -S00 "Beauty will save the world" -S01 "id" -S02 "str" -S03 "Foo" -S04 "Bar" -S05 "identifier" -S06 "string" +S0 "Beauty will save the world" +S1 "id" +S2 "str" +S3 "Foo" +S4 "Bar" +S5 "identifier" +S6 "string" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { id } -T04 = Struct M1[1] ; { str } +T0 = +T1 = Struct M0:1 ; { id } +T2 = Struct M1:1 ; { str } [type_members] -M0: S01 → T01 ; id: Node -M1: S02 → T01 ; str: Node +M0: S1 → T0 ; id: +M1: S2 → T0 ; str: [type_names] -N0: S03 → T03 ; Foo -N1: S04 → T04 ; Bar +N0: S3 → T1 ; Foo +N1: S4 → T2 ; Bar [entrypoints] -Bar = 05 :: T04 -Foo = 01 :: T03 +Bar = 5 :: T2 +Foo = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Foo: - 01 𝜀 02 - 02 (identifier) [Node Set(M0)] 04 - 04 ▶ + 1 𝜀 2 + 2 (identifier) [Node Set(M0)] 4 + 4 ▶ Bar: - 05 𝜀 06 - 06 (string) [Node Set(M1)] 08 - 08 ▶ + 5 𝜀 6 + 6 (string) [Node Set(M1)] 8 + 8 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_reference.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_reference.snap index 5f9de4f9..5661ffe9 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_reference.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_reference.snap @@ -8,35 +8,33 @@ Root = (function_declaration name: (identifier) @name) linked = false [strings] -S00 "Beauty will save the world" -S01 "name" -S02 "value" -S03 "Expression" -S04 "Root" -S05 "identifier" -S06 "number" -S07 "function_declaration" +S0 "Beauty will save the world" +S1 "name" +S2 "value" +S3 "Expression" +S4 "Root" +S5 "identifier" +S6 "number" +S7 "function_declaration" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { name, value } -T04 = Struct M2[1] ; { name } -T05 = Optional(T01) ; Node? +T0 = +T1 = Struct M0:2 ; { name, value } +T2 = Struct M2:1 ; { name } +T3 = Optional(T0) ; ? [type_members] -M0: S01 → T05 ; name: T05 -M1: S02 → T05 ; value: T05 -M2: S01 → T01 ; name: Node +M0: S1 → T3 ; name: T3 +M1: S2 → T3 ; value: T3 +M2: S1 → T0 ; name: [type_names] -N0: S03 → T03 ; Expression -N1: S04 → T04 ; Root +N0: S3 → T1 ; Expression +N1: S4 → T2 ; Root [entrypoints] -Expression = 01 :: T03 -Root = 04 :: T04 +Expression = 01 :: T1 +Root = 04 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_single.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_single.snap index 231eed50..74fda908 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_single.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__definitions_single.snap @@ -7,30 +7,28 @@ Foo = (identifier) @id linked = false [strings] -S00 "Beauty will save the world" -S01 "id" -S02 "Foo" -S03 "identifier" +S0 "Beauty will save the world" +S1 "id" +S2 "Foo" +S3 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { id } +T0 = +T1 = Struct M0:1 ; { id } [type_members] -M0: S01 → T01 ; id: Node +M0: S1 → T0 ; id: [type_names] -N0: S02 → T03 ; Foo +N0: S2 → T1 ; Foo [entrypoints] -Foo = 01 :: T03 +Foo = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Foo: - 01 𝜀 02 - 02 (identifier) [Node Set(M0)] 04 - 04 ▶ + 1 𝜀 2 + 2 (identifier) [Node Set(M0)] 4 + 4 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_multiple.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_multiple.snap index b788c862..e6475d32 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_multiple.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_multiple.snap @@ -9,35 +9,33 @@ Test = (binary_expression linked = false [strings] -S00 "Beauty will save the world" -S01 "left" -S02 "right" -S03 "Test" -S04 "binary_expression" +S0 "Beauty will save the world" +S1 "left" +S2 "right" +S3 "Test" +S4 "binary_expression" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { left, right } +T0 = +T1 = Struct M0:2 ; { left, right } [type_members] -M0: S01 → T01 ; left: Node -M1: S02 → T01 ; right: Node +M0: S1 → T0 ; left: +M1: S2 → T0 ; right: [type_names] -N0: S03 → T03 ; Test +N0: S3 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (binary_expression) 03 - 03 ↓* left: _ [Node Set(M0)] 05 - 05 * right: _ [Node Set(M1)] 07 - 07 *↑¹ 08 - 08 ▶ + 1 𝜀 2 + 2 (binary_expression) 3 + 3 ↓* left: _ [Node Set(M0)] 5 + 5 * right: _ [Node Set(M1)] 7 + 7 *↑¹ 8 + 8 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_negated.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_negated.snap index 5cd5f19c..f0f08774 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_negated.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_negated.snap @@ -7,34 +7,32 @@ Test = (function_declaration name: (identifier) @name !type_parameters) linked = false [strings] -S00 "Beauty will save the world" -S01 "name" -S02 "Test" -S03 "function_declaration" -S04 "type_parameters" -S05 "identifier" +S0 "Beauty will save the world" +S1 "name" +S2 "Test" +S3 "function_declaration" +S4 "type_parameters" +S5 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { name } +T0 = +T1 = Struct M0:1 ; { name } [type_members] -M0: S01 → T01 ; name: Node +M0: S1 → T0 ; name: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 !type_parameters (function_declaration) 04 - 04 ↓* name: (identifier) [Node Set(M0)] 06 - 06 *↑¹ 07 - 07 ▶ + 1 𝜀 2 + 2 !type_parameters (function_declaration) 4 + 4 ↓* name: (identifier) [Node Set(M0)] 6 + 6 *↑¹ 7 + 7 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_single.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_single.snap index c6667e3b..01efdc18 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_single.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__fields_single.snap @@ -7,33 +7,31 @@ Test = (function_declaration name: (identifier) @name) linked = false [strings] -S00 "Beauty will save the world" -S01 "name" -S02 "Test" -S03 "function_declaration" -S04 "identifier" +S0 "Beauty will save the world" +S1 "name" +S2 "Test" +S3 "function_declaration" +S4 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { name } +T0 = +T1 = Struct M0:1 ; { name } [type_members] -M0: S01 → T01 ; name: Node +M0: S1 → T0 ; name: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (function_declaration) 03 - 03 ↓* name: (identifier) [Node Set(M0)] 05 - 05 *↑¹ 06 - 06 ▶ + 1 𝜀 2 + 2 (function_declaration) 3 + 3 ↓* name: (identifier) [Node Set(M0)] 5 + 5 *↑¹ 6 + 6 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_anonymous.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_anonymous.snap index c1a7b7b5..f44c3242 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_anonymous.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_anonymous.snap @@ -7,33 +7,31 @@ Test = (binary_expression "+" @op) linked = false [strings] -S00 "Beauty will save the world" -S01 "op" -S02 "Test" -S03 "binary_expression" -S04 "+" +S0 "Beauty will save the world" +S1 "op" +S2 "Test" +S3 "binary_expression" +S4 "+" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { op } +T0 = +T1 = Struct M0:1 ; { op } [type_members] -M0: S01 → T01 ; op: Node +M0: S1 → T0 ; op: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (binary_expression) 03 - 03 ↓* (+) [Node Set(M0)] 05 - 05 *↑¹ 06 - 06 ▶ + 1 𝜀 2 + 2 (binary_expression) 3 + 3 ↓* (+) [Node Set(M0)] 5 + 5 *↑¹ 6 + 6 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_error.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_error.snap index 9b9dab79..1015ace7 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_error.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_error.snap @@ -7,30 +7,28 @@ Test = (ERROR) @err linked = false [strings] -S00 "Beauty will save the world" -S01 "err" -S02 "Test" -S03 "ERROR" +S0 "Beauty will save the world" +S1 "err" +S2 "Test" +S3 "ERROR" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { err } +T0 = +T1 = Struct M0:1 ; { err } [type_members] -M0: S01 → T01 ; err: Node +M0: S1 → T0 ; err: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (ERROR) [Node Set(M0)] 04 - 04 ▶ + 1 𝜀 2 + 2 (ERROR) [Node Set(M0)] 4 + 4 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_missing.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_missing.snap index 2632782f..f725f019 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_missing.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_missing.snap @@ -7,30 +7,28 @@ Test = (MISSING) @m linked = false [strings] -S00 "Beauty will save the world" -S01 "m" -S02 "Test" -S03 "MISSING" +S0 "Beauty will save the world" +S1 "m" +S2 "Test" +S3 "MISSING" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { m } +T0 = +T1 = Struct M0:1 ; { m } [type_members] -M0: S01 → T01 ; m: Node +M0: S1 → T0 ; m: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (MISSING) [Node Set(M0)] 04 - 04 ▶ + 1 𝜀 2 + 2 (MISSING) [Node Set(M0)] 4 + 4 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_named.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_named.snap index 3942767b..3aed95c6 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_named.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_named.snap @@ -7,30 +7,28 @@ Test = (identifier) @id linked = false [strings] -S00 "Beauty will save the world" -S01 "id" -S02 "Test" -S03 "identifier" +S0 "Beauty will save the world" +S1 "id" +S2 "Test" +S3 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { id } +T0 = +T1 = Struct M0:1 ; { id } [type_members] -M0: S01 → T01 ; id: Node +M0: S1 → T0 ; id: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (identifier) [Node Set(M0)] 04 - 04 ▶ + 1 𝜀 2 + 2 (identifier) [Node Set(M0)] 4 + 4 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_wildcard_any.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_wildcard_any.snap index 1f180366..36073ace 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_wildcard_any.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_wildcard_any.snap @@ -7,32 +7,30 @@ Test = (pair key: _ @key) linked = false [strings] -S00 "Beauty will save the world" -S01 "key" -S02 "Test" -S03 "pair" +S0 "Beauty will save the world" +S1 "key" +S2 "Test" +S3 "pair" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { key } +T0 = +T1 = Struct M0:1 ; { key } [type_members] -M0: S01 → T01 ; key: Node +M0: S1 → T0 ; key: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (pair) 03 - 03 ↓* key: _ [Node Set(M0)] 05 - 05 *↑¹ 06 - 06 ▶ + 1 𝜀 2 + 2 (pair) 3 + 3 ↓* key: _ [Node Set(M0)] 5 + 5 *↑¹ 6 + 6 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_wildcard_named.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_wildcard_named.snap index 5cbb9c1c..2faed72d 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_wildcard_named.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__nodes_wildcard_named.snap @@ -7,32 +7,30 @@ Test = (pair key: (_) @key) linked = false [strings] -S00 "Beauty will save the world" -S01 "key" -S02 "Test" -S03 "pair" +S0 "Beauty will save the world" +S1 "key" +S2 "Test" +S3 "pair" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { key } +T0 = +T1 = Struct M0:1 ; { key } [type_members] -M0: S01 → T01 ; key: Node +M0: S1 → T0 ; key: [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (pair) 03 - 03 ↓* key: _ [Node Set(M0)] 05 - 05 *↑¹ 06 - 06 ▶ + 1 𝜀 2 + 2 (pair) 3 + 3 ↓* key: _ [Node Set(M0)] 5 + 5 *↑¹ 6 + 6 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__optional_first_child.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__optional_first_child.snap index cfede84c..dec4cecf 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__optional_first_child.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__optional_first_child.snap @@ -7,30 +7,28 @@ Test = (program (identifier)? @id (number) @n) linked = false [strings] -S00 "Beauty will save the world" -S01 "id" -S02 "n" -S03 "Test" -S04 "program" -S05 "number" -S06 "identifier" +S0 "Beauty will save the world" +S1 "id" +S2 "n" +S3 "Test" +S4 "program" +S5 "number" +S6 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { id, n } -T04 = Optional(T01) ; Node? +T0 = +T1 = Struct M0:2 ; { id, n } +T2 = Optional(T0) ; ? [type_members] -M0: S01 → T04 ; id: T04 -M1: S02 → T01 ; n: Node +M0: S1 → T2 ; id: T2 +M1: S2 → T0 ; n: [type_names] -N0: S03 → T03 ; Test +N0: S3 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__optional_null_injection.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__optional_null_injection.snap index 0b2e79ee..5349e135 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__optional_null_injection.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__optional_null_injection.snap @@ -7,27 +7,25 @@ Test = (function_declaration (decorator)? @dec) linked = false [strings] -S00 "Beauty will save the world" -S01 "dec" -S02 "Test" -S03 "function_declaration" -S04 "decorator" +S0 "Beauty will save the world" +S1 "dec" +S2 "Test" +S3 "function_declaration" +S4 "decorator" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { dec } -T04 = Optional(T01) ; Node? +T0 = +T1 = Struct M0:1 ; { dec } +T2 = Optional(T0) ; ? [type_members] -M0: S01 → T04 ; dec: T04 +M0: S1 → T2 ; dec: T2 [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_first_child_array.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_first_child_array.snap index 5fc683ba..6493a788 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_first_child_array.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_first_child_array.snap @@ -7,30 +7,28 @@ Test = (array (identifier)* @ids (number) @n) linked = false [strings] -S00 "Beauty will save the world" -S01 "ids" -S02 "n" -S03 "Test" -S04 "array" -S05 "number" -S06 "identifier" +S0 "Beauty will save the world" +S1 "ids" +S2 "n" +S3 "Test" +S4 "array" +S5 "number" +S6 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = ArrayStar(T01) ; Node* -T04 = Struct M0[2] ; { ids, n } +T0 = +T1 = ArrayStar(T0) ; * +T2 = Struct M0:2 ; { ids, n } [type_members] -M0: S01 → T03 ; ids: T03 -M1: S02 → T01 ; n: Node +M0: S1 → T1 ; ids: T1 +M1: S2 → T0 ; n: [type_names] -N0: S03 → T04 ; Test +N0: S3 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_optional.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_optional.snap index 0b2e79ee..5349e135 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_optional.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_optional.snap @@ -7,27 +7,25 @@ Test = (function_declaration (decorator)? @dec) linked = false [strings] -S00 "Beauty will save the world" -S01 "dec" -S02 "Test" -S03 "function_declaration" -S04 "decorator" +S0 "Beauty will save the world" +S1 "dec" +S2 "Test" +S3 "function_declaration" +S4 "decorator" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { dec } -T04 = Optional(T01) ; Node? +T0 = +T1 = Struct M0:1 ; { dec } +T2 = Optional(T0) ; ? [type_members] -M0: S01 → T04 ; dec: T04 +M0: S1 → T2 ; dec: T2 [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_optional_nongreedy.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_optional_nongreedy.snap index 6c955cd8..cf3f91e4 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_optional_nongreedy.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_optional_nongreedy.snap @@ -7,27 +7,25 @@ Test = (function_declaration (decorator)?? @dec) linked = false [strings] -S00 "Beauty will save the world" -S01 "dec" -S02 "Test" -S03 "function_declaration" -S04 "decorator" +S0 "Beauty will save the world" +S1 "dec" +S2 "Test" +S3 "function_declaration" +S4 "decorator" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { dec } -T04 = Optional(T01) ; Node? +T0 = +T1 = Struct M0:1 ; { dec } +T2 = Optional(T0) ; ? [type_members] -M0: S01 → T04 ; dec: T04 +M0: S1 → T2 ; dec: T2 [type_names] -N0: S02 → T03 ; Test +N0: S2 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 01 :: T1 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_plus.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_plus.snap index 453c2a65..09da8d8d 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_plus.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_plus.snap @@ -7,26 +7,24 @@ Test = (identifier)+ @items linked = false [strings] -S00 "Beauty will save the world" -S01 "items" -S02 "Test" -S03 "identifier" +S0 "Beauty will save the world" +S1 "items" +S2 "Test" +S3 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = ArrayPlus(T01) ; Node+ -T04 = Struct M0[1] ; { items } +T0 = +T1 = ArrayPlus(T0) ; + +T2 = Struct M0:1 ; { items } [type_members] -M0: S01 → T03 ; items: T03 +M0: S1 → T1 ; items: T1 [type_names] -N0: S02 → T04 ; Test +N0: S2 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_plus_nongreedy.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_plus_nongreedy.snap index ef0e077a..576d3fb6 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_plus_nongreedy.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_plus_nongreedy.snap @@ -7,26 +7,24 @@ Test = (identifier)+? @items linked = false [strings] -S00 "Beauty will save the world" -S01 "items" -S02 "Test" -S03 "identifier" +S0 "Beauty will save the world" +S1 "items" +S2 "Test" +S3 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = ArrayPlus(T01) ; Node+ -T04 = Struct M0[1] ; { items } +T0 = +T1 = ArrayPlus(T0) ; + +T2 = Struct M0:1 ; { items } [type_members] -M0: S01 → T03 ; items: T03 +M0: S1 → T1 ; items: T1 [type_names] -N0: S02 → T04 ; Test +N0: S2 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_repeat_navigation.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_repeat_navigation.snap index e5533632..40887586 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_repeat_navigation.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_repeat_navigation.snap @@ -7,27 +7,25 @@ Test = (function_declaration (decorator)* @decs) linked = false [strings] -S00 "Beauty will save the world" -S01 "decs" -S02 "Test" -S03 "function_declaration" -S04 "decorator" +S0 "Beauty will save the world" +S1 "decs" +S2 "Test" +S3 "function_declaration" +S4 "decorator" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = ArrayStar(T01) ; Node* -T04 = Struct M0[1] ; { decs } +T0 = +T1 = ArrayStar(T0) ; * +T2 = Struct M0:1 ; { decs } [type_members] -M0: S01 → T03 ; decs: T03 +M0: S1 → T1 ; decs: T1 [type_names] -N0: S02 → T04 ; Test +N0: S2 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_star.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_star.snap index c3cadd2f..58096ca6 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_star.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_star.snap @@ -7,26 +7,24 @@ Test = (identifier)* @items linked = false [strings] -S00 "Beauty will save the world" -S01 "items" -S02 "Test" -S03 "identifier" +S0 "Beauty will save the world" +S1 "items" +S2 "Test" +S3 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = ArrayStar(T01) ; Node* -T04 = Struct M0[1] ; { items } +T0 = +T1 = ArrayStar(T0) ; * +T2 = Struct M0:1 ; { items } [type_members] -M0: S01 → T03 ; items: T03 +M0: S1 → T1 ; items: T1 [type_names] -N0: S02 → T04 ; Test +N0: S2 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_star_nongreedy.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_star_nongreedy.snap index a9a68235..80e080c3 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_star_nongreedy.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_star_nongreedy.snap @@ -7,26 +7,24 @@ Test = (identifier)*? @items linked = false [strings] -S00 "Beauty will save the world" -S01 "items" -S02 "Test" -S03 "identifier" +S0 "Beauty will save the world" +S1 "items" +S2 "Test" +S3 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = ArrayStar(T01) ; Node* -T04 = Struct M0[1] ; { items } +T0 = +T1 = ArrayStar(T0) ; * +T2 = Struct M0:1 ; { items } [type_members] -M0: S01 → T03 ; items: T03 +M0: S1 → T1 ; items: T1 [type_names] -N0: S02 → T04 ; Test +N0: S2 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_struct_array.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_struct_array.snap index b9efef7e..e248b2db 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_struct_array.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__quantifiers_struct_array.snap @@ -7,33 +7,31 @@ Test = (array {(identifier) @a (number) @b}* @items) linked = false [strings] -S00 "Beauty will save the world" -S01 "a" -S02 "b" -S03 "items" -S04 "Test" -S05 "array" -S06 "number" -S07 "identifier" +S0 "Beauty will save the world" +S1 "a" +S2 "b" +S3 "items" +S4 "Test" +S5 "array" +S6 "number" +S7 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { a, b } -T04 = ArrayStar(T03) ; T03* -T05 = Struct M2[1] ; { items } +T0 = +T1 = Struct M0:2 ; { a, b } +T2 = ArrayStar(T1) ; T1* +T3 = Struct M2:1 ; { items } [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node -M2: S03 → T04 ; items: T04 +M0: S1 → T0 ; a: +M1: S2 → T0 ; b: +M2: S3 → T2 ; items: T2 [type_names] -N0: S04 → T05 ; Test +N0: S4 → T3 ; Test [entrypoints] -Test = 01 :: T05 +Test = 01 :: T3 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__recursion_simple.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__recursion_simple.snap index f44f905c..17df449e 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__recursion_simple.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__recursion_simple.snap @@ -24,25 +24,24 @@ S10 "function" S11 "identifier" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { value } -T04 = Struct M1[2] ; { fn, inner } -T05 = Enum M3[2] ; Lit | Rec +T0 = +T1 = +T2 = Struct M0:1 ; { value } +T3 = Struct M1:2 ; { fn, inner } +T4 = Enum M3:2 ; Lit | Rec [type_members] -M0: S01 → T02 ; value: str -M1: S02 → T01 ; fn: Node -M2: S03 → T05 ; inner: Expr -M3: S04 → T03 ; Lit: T03 -M4: S05 → T04 ; Rec: T04 +M0: S01 → T1 ; value: +M1: S02 → T0 ; fn: +M2: S03 → T4 ; inner: Expr +M3: S04 → T2 ; Lit: T2 +M4: S05 → T3 ; Rec: T3 [type_names] -N0: S06 → T05 ; Expr +N0: S06 → T4 ; Expr [entrypoints] -Expr = 01 :: T05 +Expr = 01 :: T4 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__recursion_with_structured_result.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__recursion_with_structured_result.snap index 0d5cba63..b70df5cd 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__recursion_with_structured_result.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__recursion_with_structured_result.snap @@ -29,29 +29,28 @@ S13 "identifier" S14 "program" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[1] ; { value } -T04 = Struct M1[2] ; { fn, inner } -T05 = Enum M3[2] ; Lit | Nested -T06 = Struct M5[1] ; { expr } +T0 = +T1 = +T2 = Struct M0:1 ; { value } +T3 = Struct M1:2 ; { fn, inner } +T4 = Enum M3:2 ; Lit | Nested +T5 = Struct M5:1 ; { expr } [type_members] -M0: S01 → T02 ; value: str -M1: S02 → T01 ; fn: Node -M2: S03 → T05 ; inner: Expr -M3: S04 → T03 ; Lit: T03 -M4: S05 → T04 ; Nested: T04 -M5: S06 → T05 ; expr: Expr +M0: S01 → T1 ; value: +M1: S02 → T0 ; fn: +M2: S03 → T4 ; inner: Expr +M3: S04 → T2 ; Lit: T2 +M4: S05 → T3 ; Nested: T3 +M5: S06 → T4 ; expr: Expr [type_names] -N0: S07 → T05 ; Expr -N1: S08 → T06 ; Test +N0: S07 → T4 ; Expr +N1: S08 → T5 ; Test [entrypoints] -Expr = 01 :: T05 -Test = 04 :: T06 +Expr = 01 :: T4 +Test = 04 :: T5 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_basic.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_basic.snap index 2df0c5e6..f9161146 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_basic.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_basic.snap @@ -7,33 +7,30 @@ Test = (parent {(a) (b)}) linked = false [strings] -S00 "Beauty will save the world" -S01 "Test" -S02 "parent" -S03 "b" -S04 "a" +S0 "Beauty will save the world" +S1 "Test" +S2 "parent" +S3 "b" +S4 "a" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[0] ; { } +T0 = [type_members] [type_names] -N0: S01 → T03 ; Test +N0: S1 → T0 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T0 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (parent) 03 - 03 ↓* (a) 04 - 04 * (b) 05 - 05 *↑¹ 06 - 06 ▶ + 1 𝜀 2 + 2 (parent) 3 + 3 ↓* (a) 4 + 4 * (b) 5 + 5 *↑¹ 6 + 6 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_in_quantifier.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_in_quantifier.snap index 416d54a0..35098de5 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_in_quantifier.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_in_quantifier.snap @@ -7,28 +7,26 @@ Test = (parent {(a) (b)}* @items) linked = false [strings] -S00 "Beauty will save the world" -S01 "items" -S02 "Test" -S03 "parent" -S04 "b" -S05 "a" +S0 "Beauty will save the world" +S1 "items" +S2 "Test" +S3 "parent" +S4 "b" +S5 "a" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = ArrayStar(T01) ; Node* -T04 = Struct M0[1] ; { items } +T0 = +T1 = ArrayStar(T0) ; * +T2 = Struct M0:1 ; { items } [type_members] -M0: S01 → T03 ; items: T03 +M0: S1 → T1 ; items: T1 [type_names] -N0: S02 → T04 ; Test +N0: S2 → T2 ; Test [entrypoints] -Test = 01 :: T04 +Test = 01 :: T2 [transitions] 00 𝜀 ◼ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_nested.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_nested.snap index 79a11859..3f85567a 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_nested.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_nested.snap @@ -7,37 +7,34 @@ Test = (parent {(a) {(b) (c)} (d)}) linked = false [strings] -S00 "Beauty will save the world" -S01 "Test" -S02 "parent" -S03 "d" -S04 "c" -S05 "b" -S06 "a" +S0 "Beauty will save the world" +S1 "Test" +S2 "parent" +S3 "d" +S4 "c" +S5 "b" +S6 "a" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[0] ; { } +T0 = [type_members] [type_names] -N0: S01 → T03 ; Test +N0: S1 → T0 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T0 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (parent) 03 - 03 ↓* (a) 04 - 04 * (b) 05 - 05 * (c) 06 - 06 * (d) 07 - 07 *↑¹ 08 - 08 ▶ + 1 𝜀 2 + 2 (parent) 3 + 3 ↓* (a) 4 + 4 * (b) 5 + 5 * (c) 6 + 6 * (d) 7 + 7 *↑¹ 8 + 8 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_with_captures.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_with_captures.snap index ca85e1aa..0a322edd 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_with_captures.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__codegen_tests__sequences_with_captures.snap @@ -7,35 +7,33 @@ Test = (parent {(a) @a (b) @b}) linked = false [strings] -S00 "Beauty will save the world" -S01 "a" -S02 "b" -S03 "Test" -S04 "parent" +S0 "Beauty will save the world" +S1 "a" +S2 "b" +S3 "Test" +S4 "parent" [type_defs] -T00 = void -T01 = Node -T02 = str -T03 = Struct M0[2] ; { a, b } +T0 = +T1 = Struct M0:2 ; { a, b } [type_members] -M0: S01 → T01 ; a: Node -M1: S02 → T01 ; b: Node +M0: S1 → T0 ; a: +M1: S2 → T0 ; b: [type_names] -N0: S03 → T03 ; Test +N0: S3 → T1 ; Test [entrypoints] -Test = 01 :: T03 +Test = 1 :: T1 [transitions] - 00 𝜀 ◼ + 0 𝜀 ◼ Test: - 01 𝜀 02 - 02 (parent) 03 - 03 ↓* (a) [Node Set(M0)] 05 - 05 * (b) [Node Set(M1)] 07 - 07 *↑¹ 08 - 08 ▶ + 1 𝜀 2 + 2 (parent) 3 + 3 ↓* (a) [Node Set(M0)] 5 + 5 * (b) [Node Set(M1)] 7 + 7 *↑¹ 8 + 8 ▶ diff --git a/crates/plotnik-lib/src/type_system/kind.rs b/crates/plotnik-lib/src/type_system/kind.rs index bbf4ec5e..398a8f07 100644 --- a/crates/plotnik-lib/src/type_system/kind.rs +++ b/crates/plotnik-lib/src/type_system/kind.rs @@ -5,40 +5,53 @@ /// Semantic type kinds. /// -/// This is the canonical enumeration of composite type kinds. -/// Primitive types (Void, Node, String) are handled via reserved indices, -/// not as variants here. +/// This is the canonical enumeration of all type kinds, including primitives. +/// Primitive types (Void, Node, String) are stored as TypeDefs like any other type. #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] #[repr(u8)] pub enum TypeKind { + /// Unit type - used for definitions with no captures. + Void = 0, + /// AST node reference. + Node = 1, + /// Text content extracted from node. + String = 2, /// `T?` - optional wrapper, contains zero or one value. - Optional = 0, + Optional = 3, /// `T*` - array of zero or more values. - ArrayZeroOrMore = 1, + ArrayZeroOrMore = 4, /// `T+` - array of one or more values (non-empty). - ArrayOneOrMore = 2, + ArrayOneOrMore = 5, /// Record with named fields. - Struct = 3, + Struct = 6, /// Discriminated union with tagged variants. - Enum = 4, + Enum = 7, /// Named reference to another type (e.g., `type Foo = Bar`). - Alias = 5, + Alias = 8, } impl TypeKind { /// Convert from raw discriminant. pub fn from_u8(v: u8) -> Option { match v { - 0 => Some(Self::Optional), - 1 => Some(Self::ArrayZeroOrMore), - 2 => Some(Self::ArrayOneOrMore), - 3 => Some(Self::Struct), - 4 => Some(Self::Enum), - 5 => Some(Self::Alias), + 0 => Some(Self::Void), + 1 => Some(Self::Node), + 2 => Some(Self::String), + 3 => Some(Self::Optional), + 4 => Some(Self::ArrayZeroOrMore), + 5 => Some(Self::ArrayOneOrMore), + 6 => Some(Self::Struct), + 7 => Some(Self::Enum), + 8 => Some(Self::Alias), _ => None, } } + /// Whether this is a primitive/builtin type (Void, Node, String). + pub fn is_primitive(self) -> bool { + matches!(self, Self::Void | Self::Node | Self::String) + } + /// Whether this is a wrapper type (Optional, ArrayZeroOrMore, ArrayOneOrMore). /// /// Wrapper types contain a single inner type. @@ -69,6 +82,16 @@ impl TypeKind { pub fn is_alias(self) -> bool { matches!(self, Self::Alias) } + + /// Get the display name for primitive types. + pub fn primitive_name(self) -> Option<&'static str> { + match self { + Self::Void => Some("Void"), + Self::Node => Some("Node"), + Self::String => Some("String"), + _ => None, + } + } } #[cfg(test)] @@ -77,20 +100,32 @@ mod tests { #[test] fn from_u8_valid() { - assert_eq!(TypeKind::from_u8(0), Some(TypeKind::Optional)); - assert_eq!(TypeKind::from_u8(1), Some(TypeKind::ArrayZeroOrMore)); - assert_eq!(TypeKind::from_u8(2), Some(TypeKind::ArrayOneOrMore)); - assert_eq!(TypeKind::from_u8(3), Some(TypeKind::Struct)); - assert_eq!(TypeKind::from_u8(4), Some(TypeKind::Enum)); - assert_eq!(TypeKind::from_u8(5), Some(TypeKind::Alias)); + assert_eq!(TypeKind::from_u8(0), Some(TypeKind::Void)); + assert_eq!(TypeKind::from_u8(1), Some(TypeKind::Node)); + assert_eq!(TypeKind::from_u8(2), Some(TypeKind::String)); + assert_eq!(TypeKind::from_u8(3), Some(TypeKind::Optional)); + assert_eq!(TypeKind::from_u8(4), Some(TypeKind::ArrayZeroOrMore)); + assert_eq!(TypeKind::from_u8(5), Some(TypeKind::ArrayOneOrMore)); + assert_eq!(TypeKind::from_u8(6), Some(TypeKind::Struct)); + assert_eq!(TypeKind::from_u8(7), Some(TypeKind::Enum)); + assert_eq!(TypeKind::from_u8(8), Some(TypeKind::Alias)); } #[test] fn from_u8_invalid() { - assert_eq!(TypeKind::from_u8(6), None); + assert_eq!(TypeKind::from_u8(9), None); assert_eq!(TypeKind::from_u8(255), None); } + #[test] + fn is_primitive() { + assert!(TypeKind::Void.is_primitive()); + assert!(TypeKind::Node.is_primitive()); + assert!(TypeKind::String.is_primitive()); + assert!(!TypeKind::Optional.is_primitive()); + assert!(!TypeKind::Struct.is_primitive()); + } + #[test] fn is_wrapper() { assert!(TypeKind::Optional.is_wrapper()); @@ -99,6 +134,7 @@ mod tests { assert!(!TypeKind::Struct.is_wrapper()); assert!(!TypeKind::Enum.is_wrapper()); assert!(!TypeKind::Alias.is_wrapper()); + assert!(!TypeKind::Void.is_wrapper()); } #[test] @@ -109,6 +145,7 @@ mod tests { assert!(TypeKind::Struct.is_composite()); assert!(TypeKind::Enum.is_composite()); assert!(!TypeKind::Alias.is_composite()); + assert!(!TypeKind::Node.is_composite()); } #[test] @@ -136,4 +173,12 @@ mod tests { assert!(!TypeKind::Enum.is_alias()); assert!(TypeKind::Alias.is_alias()); } + + #[test] + fn primitive_name() { + assert_eq!(TypeKind::Void.primitive_name(), Some("Void")); + assert_eq!(TypeKind::Node.primitive_name(), Some("Node")); + assert_eq!(TypeKind::String.primitive_name(), Some("String")); + assert_eq!(TypeKind::Struct.primitive_name(), None); + } } diff --git a/crates/plotnik-lib/src/type_system/primitives.rs b/crates/plotnik-lib/src/type_system/primitives.rs index 7e5a9fc5..1a6f747d 100644 --- a/crates/plotnik-lib/src/type_system/primitives.rs +++ b/crates/plotnik-lib/src/type_system/primitives.rs @@ -53,6 +53,15 @@ impl PrimitiveType { pub fn is_builtin(index: u16) -> bool { index <= TYPE_STRING } + + /// Get the display name for this primitive (for bytecode dumps). + pub const fn name(self) -> &'static str { + match self { + Self::Void => "Void", + Self::Node => "Node", + Self::String => "String", + } + } } #[cfg(test)] diff --git a/crates/plotnik-lib/src/typegen/typescript.rs b/crates/plotnik-lib/src/typegen/typescript.rs index c8c228a8..f01362fd 100644 --- a/crates/plotnik-lib/src/typegen/typescript.rs +++ b/crates/plotnik-lib/src/typegen/typescript.rs @@ -166,7 +166,7 @@ impl<'a> Emitter<'a> { // Assign names to types that need them for i in 0..self.types.defs_count() { - let type_id = QTypeId::from_custom_index(i); + let type_id = QTypeId(i as u16); if self.type_names.contains_key(&type_id) { continue; } @@ -191,7 +191,7 @@ impl<'a> Emitter<'a> { ctx: &NamingContext, contexts: &mut HashMap, ) { - if type_id.is_builtin() || contexts.contains_key(&type_id) { + if contexts.contains_key(&type_id) { return; } @@ -204,11 +204,11 @@ impl<'a> Emitter<'a> { }; match kind { + TypeKind::Void | TypeKind::Node | TypeKind::String | TypeKind::Alias => {} TypeKind::Struct => { contexts.entry(type_id).or_insert_with(|| ctx.clone()); for member in self.types.members_of(&type_def) { let field_name = self.strings.get(member.name); - // Unwrap Optional wrappers to get the actual type let (inner_type, _) = self.unwrap_optional(member.type_id); let field_ctx = NamingContext { def_name: ctx.def_name.clone(), @@ -220,16 +220,8 @@ impl<'a> Emitter<'a> { TypeKind::Enum => { contexts.entry(type_id).or_insert_with(|| ctx.clone()); } - TypeKind::ArrayZeroOrMore | TypeKind::ArrayOneOrMore => { - let inner = QTypeId(type_def.data); - self.collect_naming_contexts(inner, ctx, contexts); - } - TypeKind::Optional => { - let inner = QTypeId(type_def.data); - self.collect_naming_contexts(inner, ctx, contexts); - } - TypeKind::Alias => { - // Aliases don't need contexts + TypeKind::ArrayZeroOrMore | TypeKind::ArrayOneOrMore | TypeKind::Optional => { + self.collect_naming_contexts(QTypeId(type_def.data), ctx, contexts); } } } @@ -242,14 +234,6 @@ impl<'a> Emitter<'a> { } fn collect_refs_recursive(&mut self, type_id: QTypeId) { - if type_id == QTypeId::NODE { - self.node_referenced = true; - return; - } - if type_id == QTypeId::STRING || type_id == QTypeId::VOID { - return; - } - // Cycle detection if !self.refs_visited.insert(type_id) { return; @@ -264,6 +248,10 @@ impl<'a> Emitter<'a> { }; match kind { + TypeKind::Node => { + self.node_referenced = true; + } + TypeKind::String | TypeKind::Void => {} TypeKind::Struct | TypeKind::Enum => { let member_types: Vec<_> = self .types @@ -278,7 +266,6 @@ impl<'a> Emitter<'a> { self.collect_refs_recursive(QTypeId(type_def.data)); } TypeKind::Alias => { - // Alias to Node self.node_referenced = true; } } @@ -332,7 +319,7 @@ impl<'a> Emitter<'a> { } fn collect_reachable_types(&self, type_id: QTypeId, out: &mut HashSet) { - if type_id.is_builtin() || out.contains(&type_id) { + if out.contains(&type_id) { return; } @@ -345,6 +332,7 @@ impl<'a> Emitter<'a> { }; match kind { + TypeKind::Void | TypeKind::Node | TypeKind::String => {} TypeKind::Struct => { out.insert(type_id); for member in self.types.members_of(&type_def) { @@ -354,18 +342,13 @@ impl<'a> Emitter<'a> { TypeKind::Enum => { out.insert(type_id); for member in self.types.members_of(&type_def) { - // For enum variants, recurse into payload fields but don't - // add the payload struct itself - it will be inlined. self.collect_enum_variant_refs(member.type_id, out); } } TypeKind::Alias => { out.insert(type_id); } - TypeKind::ArrayZeroOrMore | TypeKind::ArrayOneOrMore => { - self.collect_reachable_types(QTypeId(type_def.data), out); - } - TypeKind::Optional => { + TypeKind::ArrayZeroOrMore | TypeKind::ArrayOneOrMore | TypeKind::Optional => { self.collect_reachable_types(QTypeId(type_def.data), out); } } @@ -374,31 +357,16 @@ impl<'a> Emitter<'a> { /// Collect reachable types from enum variant payloads. /// Recurses into struct fields but doesn't add the payload struct itself. fn collect_enum_variant_refs(&self, type_id: QTypeId, out: &mut HashSet) { - if type_id.is_builtin() { - return; - } - let Some(type_def) = self.types.get(type_id) else { return; }; - let Some(kind) = type_def.type_kind() else { - return; - }; - - match kind { - TypeKind::Struct => { - // DON'T add the struct - it will be inlined as $data. - // But DO recurse into its fields to find named types. - for member in self.types.members_of(&type_def) { - self.collect_reachable_types(member.type_id, out); - } - } - _ => { - // For non-struct payloads (shouldn't happen normally), - // fall back to regular collection. - self.collect_reachable_types(type_id, out); + if type_def.type_kind() == Some(TypeKind::Struct) { + for member in self.types.members_of(&type_def) { + self.collect_reachable_types(member.type_id, out); } + } else { + self.collect_reachable_types(type_id, out); } } @@ -412,24 +380,19 @@ impl<'a> Emitter<'a> { }; match kind { + TypeKind::Void | TypeKind::Node | TypeKind::String | TypeKind::Alias => vec![], TypeKind::Struct | TypeKind::Enum => self .types .members_of(&type_def) .flat_map(|member| self.unwrap_for_deps(member.type_id)) .collect(), - TypeKind::ArrayZeroOrMore | TypeKind::ArrayOneOrMore => { + TypeKind::ArrayZeroOrMore | TypeKind::ArrayOneOrMore | TypeKind::Optional => { self.unwrap_for_deps(QTypeId(type_def.data)) } - TypeKind::Optional => self.unwrap_for_deps(QTypeId(type_def.data)), - TypeKind::Alias => vec![], } } fn unwrap_for_deps(&self, type_id: QTypeId) -> Vec { - if type_id.is_builtin() { - return vec![]; - } - let Some(type_def) = self.types.get(type_id) else { return vec![]; }; @@ -439,6 +402,7 @@ impl<'a> Emitter<'a> { }; match kind { + TypeKind::Void | TypeKind::Node | TypeKind::String => vec![], TypeKind::ArrayZeroOrMore | TypeKind::ArrayOneOrMore | TypeKind::Optional => { self.unwrap_for_deps(QTypeId(type_def.data)) } @@ -447,7 +411,7 @@ impl<'a> Emitter<'a> { } fn emit_generated_or_custom(&mut self, type_id: QTypeId) { - if self.emitted.contains(&type_id) || type_id.is_builtin() { + if self.emitted.contains(&type_id) { return; } @@ -455,6 +419,14 @@ impl<'a> Emitter<'a> { return; }; + let Some(kind) = type_def.type_kind() else { + return; + }; + + if kind.is_primitive() { + return; + } + // Check if this is an alias type (custom type annotation) if type_def.is_alias() { if let Some(name) = self.type_names.get(&type_id).cloned() { @@ -593,15 +565,6 @@ impl<'a> Emitter<'a> { } fn type_to_ts(&self, type_id: QTypeId) -> String { - match type_id { - QTypeId::VOID => "void".to_string(), - QTypeId::NODE => "Node".to_string(), - QTypeId::STRING => "string".to_string(), - _ => self.custom_type_to_ts(type_id), - } - } - - fn custom_type_to_ts(&self, type_id: QTypeId) -> String { let Some(type_def) = self.types.get(type_id) else { return "unknown".to_string(); }; @@ -611,6 +574,9 @@ impl<'a> Emitter<'a> { }; match kind { + TypeKind::Void => "undefined".to_string(), + TypeKind::Node => "Node".to_string(), + TypeKind::String => "string".to_string(), TypeKind::Struct | TypeKind::Enum => { if let Some(name) = self.type_names.get(&type_id) { name.clone() @@ -691,10 +657,6 @@ impl<'a> Emitter<'a> { } fn inline_data_type(&self, type_id: QTypeId) -> String { - if type_id == QTypeId::VOID { - return "{}".to_string(); - } - let Some(type_def) = self.types.get(type_id) else { return self.type_to_ts(type_id); }; @@ -703,6 +665,10 @@ impl<'a> Emitter<'a> { return self.type_to_ts(type_id); }; + if kind == TypeKind::Void { + return "{}".to_string(); + } + if kind == TypeKind::Struct { self.inline_struct(&type_def) } else { @@ -712,9 +678,6 @@ impl<'a> Emitter<'a> { /// Unwrap Optional wrappers and return (inner_type, is_optional). fn unwrap_optional(&self, type_id: QTypeId) -> (QTypeId, bool) { - if type_id.is_builtin() { - return (type_id, false); - } let Some(type_def) = self.types.get(type_id) else { return (type_id, false); };