References declared in super types can not be resolved for subtypes.
Langium version: 0.5.0 (and also tested in locally linked Langium from current main branch)
Steps To Reproduce
Use minimal grammar pasted below (example.langium)
langium:generate etc
Try to use grammar with example from test.example
See error below
Code example:
example.langium file (not working)
entry Model:
examples += Example*
;
Example returns Example:
{SpecificExample} "example" name=ID "using" parent=[Example:ID]
;
interface Example {
parent: @Example
}
interface SpecificExample extends Example {
}
example.langium file (working)
entry Model:
examples += Example*
;
Example returns Example:
{SpecificExample} "example" name=ID "using" parent=[Example:ID]
;
interface Example {
}
interface SpecificExample extends Example {
parent: @Example
}
test.example file
example A using B
example B using A
The current behavior
In the "not working" case:
An error occurred while resolving reference to 'B': Error: SpecificExample:parent is not a valid reference id. type-derivation-test-language(linking-error)
Anticipated cause: in the ast.ts, getReferenceType looks like this:
getReferenceType(refInfo: ReferenceInfo): string {
const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
switch (referenceId) {
case 'Example:parent': {
return Example;
}
default: {
throw new Error(`${referenceId} is not a valid reference id.`);
}
}
}
since SpecificExample:parent is not explicitly listed, it cannot be resolved
The expected behavior
Also references defined in super types should work in sub-types
References declared in super types can not be resolved for subtypes.
Langium version: 0.5.0 (and also tested in locally linked Langium from current main branch)
Steps To Reproduce
example.langium
)test.example
Code example:
example.langium
file (not working)example.langium
file (working)test.example
fileThe current behavior
In the "not working" case:
An error occurred while resolving reference to 'B': Error: SpecificExample:parent is not a valid reference id. type-derivation-test-language(linking-error)
Anticipated cause: in the
ast.ts
,getReferenceType
looks like this:since
SpecificExample:parent
is not explicitly listed, it cannot be resolvedThe expected behavior
Also references defined in super types should work in sub-types