Rejection of dynamic function invocations on empty loops (mistaken for object/array lookup)

Bug #1171860 reported by Ghislain Fourny
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
Medium
Markos Zaharioudakis

Bug Description

This query raises an error, although it looks valid to me:

for $f in () return $f()

This is because $f seems to be typed as the empty sequence, which is a subtype of json-item()*, which leads to $f()'s being recognized as an object lookup, which fails because it is not unary.

More generally, should $f on an empty loop not be typed as item() (or item()? if using "allowing empty")? This would have the nice effect that $f() would be recognized as a dynamic function invocation.

Tags: fots
Revision history for this message
Ghislain Fourny (gislenius) wrote :

There are two expecting failures related to this in FOTS:

EXPECTED_FOTS_FAILURE (prod-RequireProhibitFeature require-higher-order-function-5-s 0)
EXPECTED_FOTS_FAILURE (prod-RequireProhibitFeature require-higher-order-function-10-s 0)

tags: added: fots
Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

It does not raise an error, it just returns the empty sequence as expected. I will look at the FOTS failures.

Changed in zorba:
status: New → Fix Committed
Changed in zorba:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.