In the minimal example the statement in the err function cannot be translated. This is because the RenderTemplateFunctionCall term has a IfTempl instead of a TemplateCall. This only fails for calls to an output template with an entity argument, without there being such a template. In that case output(String) is called to print the name of the entity, but a not-null check is also added around the template call causing the error. The desugar rule responsible for this is desugar-types in /src/org/webdsl/dsl/modules/types/entity.str.

Minimal example:

application test
entity Ent {}
page root() {}
function err() {
  var str := rendertemplate(output(Ent{}));
}

Error:

[ Main | critical ] cannot translate statement
           VarDeclInit("str0"{OriginalNameAnno("str")},SimpleSort("String"){DefValueAnno(String("")),[]},RenderTemplateFunctionCall(IfTempl(NotEq(ThisCall("err_objCr0"{NewFunctionNameAnno("err_objCr0"),"err_objCr0"{"err_objCr0"}},[]){GlobalCallAnno([]),TypeAnno(SimpleSort("Ent"){EntityAnno("id",None,False),DefValueAnno(Null)})},Null{TypeAnno(SimpleSort("Null"))}){TypeAnno(SimpleSort("Bool"){DefValueAnno(False)})},[TemplateCall("outputString"{OriginalNameAnno("output")},[FieldAccess(ThisCall("err_objCr0"{NewFunctionNameAnno("err_objCr0"),"err_objCr0"{"err_objCr0"}},[]){GlobalCallAnno([]),TypeAnno(SimpleSort("Ent"){EntityAnno("id",None,False),DefValueAnno(Null)})},"name"){IsGeneratedProperty,TypeAnno(SimpleSort("String"){DefValueAnno(String(""))})}],[TemplateCall("elementsempty"{OriginalNameAnno("elementsempty")},[],[ResolvedRequireKey("elements#outputString")],TemplateBody([])){CalledTemplateArgs([]),CallToDefinedAnno,PositionAnno(""),LiftedElementsTemplateCall}],TemplateBody([])){CalledTemplateArgs([Arg("s",SimpleSort("String")){At("../.servletapp/src-webdsl-template/built-in.app",1831,17)}]),CallToDefinedAnno,PositionAnno("")}],[])){TypeAnno(SimpleSort("String"){DefValueAnno(String(""))})})
Submitted by Christoffer Gersen on 1 February 2013 at 13:18

On 14 June 2013 at 12:37 Elmer van Chastelet commented:

Similar cause as the failing render-template-function succeed-web test.

Related sources:
render-template-function.str
entity.str

Workaround: wrap it in a template.

Solution = workaround by compiler ?


On 24 October 2013 at 14:39 Danny Groenewegen commented:

fixed in r5816


On 24 October 2013 at 14:39 Danny Groenewegen closed this issue.

On 24 October 2013 at 14:41 Danny Groenewegen tagged 1.3.0

Log in to post comments