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:
@@ -228,6 +228,7 @@ fn format_value_type(value: &Value) -> String {
|
||||
| Value::Duration(_) => "Duration".to_string(),
|
||||
| Value::ProseBlock(_) => "ProseBlock".to_string(),
|
||||
| Value::Override(_) => "Override".to_string(),
|
||||
| Value::Any => "Any".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,7 +565,6 @@ fn entity_completions(doc: &Document) -> Vec<CompletionItem> {
|
||||
| DeclKind::Relationship => CompletionItemKind::STRUCT,
|
||||
| DeclKind::Location => CompletionItemKind::CONSTANT,
|
||||
| DeclKind::Species => CompletionItemKind::CLASS,
|
||||
| DeclKind::Enum => CompletionItemKind::ENUM,
|
||||
};
|
||||
|
||||
let name = entry
|
||||
@@ -682,7 +682,6 @@ fn top_level_keyword_completions() -> Vec<CompletionItem> {
|
||||
keyword_item("relationship", "Define a relationship", "relationship ${1:Name} {\n $0\n}"),
|
||||
keyword_item("location", "Define a location", "location ${1:Name} {\n $0\n}"),
|
||||
keyword_item("species", "Define a species", "species ${1:Name} {\n $0\n}"),
|
||||
keyword_item("enum", "Define an enumeration", "enum ${1:Name} {\n ${2:Value1}\n ${3:Value2}\n}"),
|
||||
keyword_item("use", "Import declarations", "use ${1:path::to::item};"),
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user