langium
langium copied to clipboard
When determining implemented interfaces in union types langium should honor inheritance hierarchy
Langium version: 3.0, 3.1 Package name: langium
Steps To Reproduce
- Given the following grammar:
grammar HelloWorld
entry Model:
(entities+=Entity | receptors+=Receptor)*;
interface Base {}
interface Person extends Base {name: string}
interface Receptor {in: Base}
Person returns Person:
'person' name=ID;
Bot returns Base: {infer Bot}
'id' id=ID;
Entity: Bot | Person;
Receptor returns Receptor:
'receptor' in=Entity;
hidden terminal WS: /\s+/;
terminal ID: /[_a-zA-Z][\w_]*/;
hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//;
hidden terminal SL_COMMENT: /\/\/[^\n\r]*/;
- Try to generate using "langium:generate" command.
The current behavior
Compilation fails with message:
The assigned type 'Entity' is not compatible with the declared property 'in' of type 'Base'.
The expected behavior
Compilation takes into account that interface Person also extends Base and compilation completes.