Langium 3.1: Changes in inference
cdietrich opened this issue · 1 comments
cdietrich commented
we have something like
Primary infers Expression:
{infer Parenthesis} '(' expr=Expression ')' |
....
NumberLiteral |
BooleanLiteral |
StringLiteral |
....
in our grammar.
with langium 3.1 we now see following compile error
src/grammars/generated/ast.ts(1615,18): error TS2320: Interface 'Parenthesis' cannot simultaneously extend types 'BooleanLiteral' and 'NumberLiteral'.
Named property 'value' of types 'BooleanLiteral' and 'NumberLiteral' are not identical.
src/grammars/generated/ast.ts(1615,18): error TS2320: Interface 'Parenthesis' cannot simultaneously extend types 'BooleanLiteral' and 'StringLiteral'.
Named property 'value' of types 'BooleanLiteral' and 'StringLiteral' are not identical.
export interface StringLiteral extends AstNode {
readonly $container: .......;
readonly $type: 'Parenthesis' | 'StringLiteral';
value: string;
}
before in langium3 it was
export interface StringLiteral extends AstNode {
readonly $container: ......;
readonly $type: 'StringLiteral';
value: string;
}
=> should the moveup also consider the type?
cdietrich commented
similar problem at other children with same name and different types. the parenthesis type basially gets spoiled into a lot of inferred types around expressions
this also happens with
Rule: {infer A} 'somekeyword' | B;