Replies: 2 comments
-
|
Hello @lou1306, thanks for the feedback! The Typir types are created after indexing and before linking. Since required references are resolved by Langium on request even before the "official linking phase", there should be no problem in general. Errors like Inside your inference rules, you need to take care about non-resolved cross-references yourself, e.g. typir.Inference.addInferenceRulesForAstNodes({
EnumLiteralUse: (languageNode) => {
const ref = languageNode.literal.ref;
if (isEnumLiteral(ref)) {
return ref;
} else if (ref === undefined) {
return InferenceRuleNotApplicable; // found non-resolved cross-reference
} else {
...
}
},
});Maybe this check is missing? |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your reply! It steered us in the right direction. Somehow, when I should also add (and apologies for not mentioning it earlier) that we are working on Langium 3.5.0/Typir 0.2.2. Maybe a more recent version would solve this for us, but we haven't looked into updating yet. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Thank you for Typir, it's an excellent framework to work with!
We have a DSL with builtin types such as
intandbool, pretty standard (typed) variable declarations such asx: bool; the user may also define custom enumerations likeenum myEnum {foo, bar, baz}.Typir works perfectly most of the time, it is also pretty reactive to report or clear type errors when making changes in expressions, etc. However, if one tries to declare a new variable, say
y: bool, and starts typing down the letters 'b', 'o', 'o', 'l', the following error messages appear:It seems that Typir is eagerly looking to type-check the file and fails to find a primitive type
bnot abenumeration, triggering the error. Indeed, if I copy-paste the entirey: booldeclaration, no error is triggered. Furthermore, the errors do not disappear even after the type is spelt out in full.Is there something we are missing in Typir's execution "lifecycle"?
Beta Was this translation helpful? Give feedback.
All reactions