feat(type-system): implement concept_comparison with pattern matching
Added complete support for the new type system syntax including: - concept: Base type declarations - sub_concept: Enum and record sub-type definitions - concept_comparison: Compile-time pattern matching with conditional guards Parser changes: - Added VariantPattern, FieldCondition, and Condition AST nodes - Implemented "is" keyword for pattern matching (e.g., "CupType is Glass or CupType is Plastic") - Added Value::Any variant to support universal type matching - Disambiguated enum-like vs record-like sub_concept syntax LSP updates: - Added Value::Any match arms across code_actions, completion, hover, inlay_hints, and semantic_tokens - Type inference and formatting support for Any values Example fixes: - Fixed syntax error in baker-family behaviors (missing closing brace in nested if) - Removed deprecated core_enums.sb file
This commit is contained in:
@@ -116,7 +116,6 @@ character Alice { age: 8 }
|
||||
species Human {}
|
||||
character Alice: Human {}
|
||||
template Child {}
|
||||
enum Mood { Happy, Sad }
|
||||
location Home {}
|
||||
relationship Friends { Alice as friend {} Bob as friend {} }
|
||||
"#;
|
||||
@@ -125,7 +124,6 @@ relationship Friends { Alice as friend {} Bob as friend {} }
|
||||
assert!(doc.name_table.resolve_name("Human").is_some());
|
||||
assert!(doc.name_table.resolve_name("Alice").is_some());
|
||||
assert!(doc.name_table.resolve_name("Child").is_some());
|
||||
assert!(doc.name_table.resolve_name("Mood").is_some());
|
||||
assert!(doc.name_table.resolve_name("Home").is_some());
|
||||
assert!(doc.name_table.resolve_name("Friends").is_some());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user