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:
@@ -12,15 +12,8 @@ species Human {
|
||||
lifespan: 80
|
||||
}
|
||||
|
||||
enum Mood {
|
||||
Happy,
|
||||
Sad,
|
||||
Angry
|
||||
}
|
||||
|
||||
character Alice: Human {
|
||||
age: 7
|
||||
mood: Happy
|
||||
---backstory
|
||||
A curious girl who loves adventures
|
||||
---
|
||||
@@ -122,7 +115,6 @@ mod document_tests {
|
||||
assert!(doc.name_table.resolve_name("Growing").is_some());
|
||||
assert!(doc.name_table.resolve_name("DailyRoutine").is_some());
|
||||
assert!(doc.name_table.resolve_name("Human").is_some());
|
||||
assert!(doc.name_table.resolve_name("Mood").is_some());
|
||||
assert!(doc.name_table.resolve_name("Friendship").is_some());
|
||||
}
|
||||
|
||||
@@ -399,7 +391,6 @@ mod symbols_tests {
|
||||
assert!(symbols.iter().any(|s| s.name == "Growing"));
|
||||
assert!(symbols.iter().any(|s| s.name == "DailyRoutine"));
|
||||
assert!(symbols.iter().any(|s| s.name == "Human"));
|
||||
assert!(symbols.iter().any(|s| s.name == "Mood"));
|
||||
assert!(symbols.iter().any(|s| s.name == "Friendship"));
|
||||
}
|
||||
|
||||
@@ -432,9 +423,6 @@ mod symbols_tests {
|
||||
|
||||
let child = symbols.iter().find(|s| s.name == "Child").unwrap();
|
||||
assert_eq!(child.kind, SymbolKind::INTERFACE);
|
||||
|
||||
let mood = symbols.iter().find(|s| s.name == "Mood").unwrap();
|
||||
assert_eq!(mood.kind, SymbolKind::ENUM);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user