Referring an imported type from an inference rule
I need to verify that an expression is of the subtype of an imported type, as in this one:
But I do not know how to express it. I think I need to extend the base language by adding temporal types, and translate the types to e.g. java.time.* classes in the generator.
Is it possible to refer to those types directly?
Thanks in advance.
Please sign in to leave a comment.
Are you asking how to fix the error in that code block on the screenshot? You need to use a quotation: either a full one or a light one. See https://www.jetbrains.com/help/mps/quotations.html.
Or are you asking how to query for subtyping in general, e.g. in the generator? You can use isSubtype(...) expression in the generator if you use the jetbrains.mps.lang.typesystem language in your generator.
Ahh, I think I now understand what you want: you have a Java class and you want to build a corresponding type. For that you need to use ClassifierType, the light quotation would then look like this: <ClassifierType(classifier: YourJavaClassGoesHere)>.