bqw5189 / closure-templates

Automatically exported from code.google.com/p/closure-templates
Apache License 2.0
0 stars 0 forks source link

ClassCastException when using hash as argument to custom functions. #79

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Implement this test case: http://pastebin.com/BdhNpXyk

What is the expected output? What do you see instead?
I expect to see no errors, and to receive the hash as an argument, instead 
there is a exception.

What version of the product are you using? On what operating system?
Using sources from the master branch of github.

Please provide any additional information below.

Relevant exception ->

Caused by: com.google.template.soy.sharedpasses.render.RenderException: While 
computing function "foo(['a': 1, 'b': 2])": 
com.google.template.soy.data.internal.EasyDictImpl cannot be cast to 
com.google.template.soy.data.SoyData
    at com.google.template.soy.sharedpasses.render.EvalVisitor.computeFunctionHelper(EvalVisitor.java:671)
    at com.google.template.soy.sharedpasses.render.EvalVisitor.visitFunctionNode(EvalVisitor.java:651)
    at com.google.template.soy.sharedpasses.render.EvalVisitor.visitFunctionNode(EvalVisitor.java:87)
    at com.google.template.soy.exprtree.AbstractReturningExprNodeVisitor.visit(AbstractReturningExprNodeVisitor.java:117)
    at com.google.template.soy.sharedpasses.render.EvalVisitor.visitExprRootNode(EvalVisitor.java:148)
    at com.google.template.soy.sharedpasses.render.EvalVisitor.visitExprRootNode(EvalVisitor.java:87)
    at com.google.template.soy.exprtree.AbstractReturningExprNodeVisitor.visit(AbstractReturningExprNodeVisitor.java:80)
    at com.google.template.soy.exprtree.AbstractReturningExprNodeVisitor.visit(AbstractReturningExprNodeVisitor.java:72)
    at com.google.template.soy.basetree.AbstractReturningNodeVisitor.exec(AbstractReturningNodeVisitor.java:42)
    at com.google.template.soy.sharedpasses.render.RenderVisitor.eval(RenderVisitor.java:775)
    ... 45 more
Caused by: java.lang.ClassCastException: 
com.google.template.soy.data.internal.EasyDictImpl cannot be cast to 
com.google.template.soy.data.SoyData
    at com.google.template.soy.tofu.internal.TofuModule$SoyTofuFunctionAdapter.computeForJava(TofuModule.java:125)
    at com.google.template.soy.sharedpasses.render.EvalVisitor.computeFunctionHelper(EvalVisitor.java:668)
    ... 54 more

Original issue reported on code.google.com by siga.fredo on 3 Dec 2014 at 4:47

GoogleCodeExporter commented 9 years ago
Closure Templates has migrated to GitHub: 
https://github.com/google/closure-templates. Please reopen this there if it's 
still an issue.

Original comment by brendan....@gmail.com on 27 Feb 2015 at 12:10