cannot translate statement: for rendertemplate to undefined output template
In the minimal example the statement in the
errfunction cannot be translated. This is because theRenderTemplateFunctionCallterm has aIfTemplinstead of aTemplateCall. This only fails for calls to anoutputtemplate with an entity argument, without there being such a template. In that caseoutput(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 isdesugar-typesin/src/org/webdsl/dsl/modules/types/entity.str.Minimal example:
application test entity Ent {} page root() {} function err() { var str := rendertemplate(output(Ent{})); }Error:
Submitted by Christoffer Gersen on 1 February 2013 at 13:18[ 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(""))})})
Issue Log
Similar cause as the failing render-template-function succeed-web test.
Related sources:
render-template-function.str
entity.strWorkaround: wrap it in a template.
Solution = workaround by compiler ?
fixed in r5816
Log in to post comments