How to create validation error for parent AST node? #1703
-
Hi Langium community, I can only create validation error for node's children property not its parents. if (leftType !== rightType) {
accept('error', `Can’t assign ${rightType} type to variable with type ${leftType} in assignment.`,
{ node: assignemntStatement, property: 'left' });
} For example, if the operands have different types in assignment statement, show error line for the entire line not just on And I am also wondering how to debug for validator since there is no output. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello, if you remove the property attribute the entire statement will be on error: if (leftType !== rightType) {
accept('error', `Can’t assign ${rightType} type to variable with type ${leftType} in assignment.`,
{ node: assignemntStatement });
} |
Beta Was this translation helpful? Give feedback.
-
Hello @durianwaffle, you can use nearly any |
Beta Was this translation helpful? Give feedback.
Hello, if you remove the property attribute the entire statement will be on error: