Dan789
Dan789

Reputation: 81

JetBrains MPS Shapes tutorial error

I've been following the JetBrains MPS Shapes tutorial: https://confluence.jetbrains.com/display/MPSD32/Shapes+-+an+introductory+MPS+tutorial

In the tutorial section "A more robust generation for Squares" there is the following definition:

template reduce_Square                                                                                          
input Square                                                                                                    

parameters                                                                                                      
<< ... >>                                                                                                       

content node:                                                                                                   
   { 
      Graphics g = null; 
      <TF { 
          ->$g.setColor(Color.->$red); 
          ->$g.drawRect($10, $10, $10, $10); 
       } TF> 
    }

And the reference macro for g (which you can see in the Inspector part of the editor if you put the cursor at ->$g) is:

(outputNode, genContext, operationContext, node)->join(node<VariableDeclaration> | string) { 
  genContext.get output graphicParam for (node.parent : Canvas); 

}

Yet when trying to rebuild the "Shapes" language I get the following error message (4 times, twice for each ->$g):

type node<> is not a subtype of node<VariableDeclaration>

Upvotes: 1

Views: 195

Answers (1)

Vaclav Pech
Vaclav Pech

Reputation: 1441

Could you please check that you specify the from and to concepts for the mapping label correctly? It should be "label graphicsParam : Canvas -> ParameterDeclaration", as specified in the tutorial.

Upvotes: 0

Related Questions