Annoying warning during generation for an extended language.

I've created an extension of the XML language by extending the concept `XmlContent` to a concept `XmlSqlQuery` which holds an instance of a `Query`-concept from (you guessed it!) an SQL language we've implemented. The TextGen for `XmlSqlQuery` is simply `append ${node.query}$` but generation produces warnings like "apply template: child '...XmlContent' is expected for role 'content' but was 'SQL.structure.SelectQuery'".

I actually understand the warning but want to know how to get rid of this, since the produced output is what I want, but the many warnings muddle the build.

0
4 comments

Warning tells you insert node<SelectQuery> where node<XmlContent> is expected. Given 'XmlSqlQuery' extends 'XmlContent', and 'XmlSqlQuery' aggregates 'SelectQuery', and type of 'content' role in a container concept (XmlElement?) is 'XmlContent', I would expect instances of XmlSqlQuery to be inserted there, not node<SelectQuery>. If you insert proper node kind into an aggregation link, there'd be no warning.

FWIW, the option to turn off the warning (and the check) is 'Warn when child cannot be placed into role' in Generator preferences. It's global (for all generators). I highly recommend to fix generator, though.

1

Maybe you can use mbeddr's "SuppressWarnings" annotation to suppress all warnings for this node? 

 

0

Unfortunately, that does not seem to be the case :(

I figured this would've been a relatively common thing since extending languages is something we can do every day with MPS.

0

Thanks, Artem! This was (in hindsight: obviously) the solution.

0

Please sign in to leave a comment.