getodk/javarosa

Syntax errors in conditional expressions only fail at run time

Opened this issue · 2 comments

There is no static analysis performed to make sure expressions have the correct syntax. In general, this is fine because as soon as a user opens a form definition in Validate, Collect or any other JavaRosa client, the full form will be evaluated and an expression with bad syntax will be identified.

However, this is problematic in the case of expressions that involve nesting, particularly with conditional logic. Consider for example the expression if (/data/my_var = 'yes', fake-function('bad', 'bad'), 0). If no one actually tries yes as a value for my_var, the fact that fake-function isn't supported won't be detected until a real user tries to enter yes and hits a runtime exception.

See getodk/validate#60 and most likely #480 for examples of how this has affected real users.

Hello all. I just found a screenshot that I can share with you of what the issue looks like when it appears on the phone, if it's of any help.

Screenshot_20190819-123600

Thanks! That looks like what I would expect.