Skip to content

Commit 79172d2

Browse files
authored
feat: Enhanced children validation (#70)
1 parent 3787cc6 commit 79172d2

4 files changed

Lines changed: 987 additions & 115 deletions

File tree

crates/plotnik-lib/src/diagnostics/message.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub enum DiagnosticKind {
6565
UnknownField,
6666
FieldNotOnNodeType,
6767
InvalidFieldChildType,
68+
InvalidChildType,
6869

6970
// Often consequences of earlier errors
7071
UnnamedDefNotLast,
@@ -168,6 +169,7 @@ impl DiagnosticKind {
168169
Self::UnknownField => "unknown field",
169170
Self::FieldNotOnNodeType => "field not valid on this node type",
170171
Self::InvalidFieldChildType => "node type not valid for this field",
172+
Self::InvalidChildType => "node type not valid as child",
171173

172174
// Structural
173175
Self::UnnamedDefNotLast => "only the last definition can be unnamed",
@@ -194,6 +196,7 @@ impl DiagnosticKind {
194196
Self::UnknownField => "`{}` is not a valid field".to_string(),
195197
Self::FieldNotOnNodeType => "field `{}` is not valid on this node type".to_string(),
196198
Self::InvalidFieldChildType => "node type `{}` is not valid for this field".to_string(),
199+
Self::InvalidChildType => "`{}` cannot be a child of this node".to_string(),
197200

198201
// Recursion with cycle path
199202
Self::RecursionNoEscape => "infinite recursion: {}".to_string(),

0 commit comments

Comments
 (0)