Bogus error with commented-out FUNCTIONMACRO arguments

Description

Given the following made-up, working example:

DataRec := RECORD UNSIGNED1 x; UNSIGNED1 y; UNSIGNED1 z := 0; END; ds := DATASET ( [ {12, 14}, {22, 24}, {32, 34} ], DataRec ); MaybeAdd(inFile, destField, field1 = '', field2 = '') := FUNCTIONMACRO LOCAL result := PROJECT ( inFile, TRANSFORM ( RECORDOF(inFile), SELF.destField := #IF(#TEXT(field1) != '') LEFT.field1 #ELSE 0 #END + #IF(#TEXT(field2) != '') LEFT.field2 #ELSE 0 #END , SELF := LEFT ) ); RETURN result; ENDMACRO; res := MaybeAdd ( ds, z, field1 := x, field2 := y ); res;

The problem pops up in the call to MaybeAdd() if you comment out the field1 argument:

// field1 := x,

or

/* field1 := x, */

If you comment that line out and syntax-check the code, you get this error:

Error: Object 'LEFT' does not have a field named 'field2' (26, 3), 2171,

Only removing the argument entirely works.

Conclusion

None

Activity

Show:

Richard Chapman January 15, 2016 at 3:12 PM
Edited

Cherry-picked the commit to 5.6.0

Richard Chapman August 11, 2015 at 3:40 PM

Weird but apparently true...

, want to take a look?

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Components

Assignee

Reporter

Priority

Fix versions

Affects versions

Created August 11, 2015 at 2:24 PM
Updated January 15, 2016 at 3:13 PM
Resolved September 4, 2015 at 11:26 AM

Flag notifications