Hello dear MPS experts !
I have a problem with defining a type for a node. My situation:
I have a node called "assignmentNode" with two child-nodes "leftSide" and "rightSide" to define assignent expressions. On the leftSide I can only use AttributeReferences (which refer to nodes of type VariableDeclaration) and on the rightSide I can have expressions.
I have a typesystem inference rule to make sure that the type of the <Expression> on the right side corresponds to the type of the <AttributeReference> on the left side.
<assignmentNode> looks like: <AttributeReference> = <Expression> (e.g. myIntAttribute = 2 + 4 + 1)
On the rightSide I also want to use a node "<complexNode>" which has two child-nodes nodeX and attributeReference.
<complexNode> looks like: <nodeX>.<attributeReference> (e.g. someNodeName.myIntAttribute)
This attributeReference refers to a VariableDeclaration and since has a type, nodeX is a custom node, its type should be ignored.
I now want to be able to use <complexNode> on the rightSide of my <assignmentNode> like this:
<attributeReference> = <complexNode> (or... <attributeReference> = <nodeX>.<attributeReference>)
I get a type-error since MPS and my typesystem inference rule say that the type of <complexNode> on the rightSide does not equal the type of the <attributeReference> on the leftSide
Is it possible to manually define the type of <complexNode> to ensure that the leftSide of <assignmentNode> has the same type as its rightSide?
I want to set the "overall" type of <complexNode> to the type of its child node called <attributeReference>.
E.g. typeof(complexNode) = complexNode.attributeReference.type
Thanks a lot!