Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#224 closed defect (fixed)

map allows non-list arguments

Reported by: Jim Ursetto Owned by: felix winkelmann
Priority: critical Milestone:
Component: core libraries Version: 4.4.x
Keywords: Cc:
Estimated difficulty:


If the first list argument to map is not actually a list, map will just return (). Version: git fd66e1b (master)

#;1> (map (lambda (x) x) 'foo)
#;2> (map 'foo 'foo)

Change History (7)

comment:1 Changed 14 years ago by Jim Ursetto

More data points: peter reports the same issue with 4.4.0, while mario (4.4.6) and moritz (4.4.6) find it works correctly.

I used make spotless and rebuilt the compiler with itself and it is still giving this issue. But it doesn't make sense; the code is clear that an error should occur.

Originally this was on 4.4.6 macosx-unix-gnu-x86 but I have now reproduced it from a clean git clone on another platform, 4.4.6 linux-unix-gnu-x86.

comment:2 Changed 14 years ago by Jim Ursetto

As seen at the compiled output appears to be wrong, it appears to be an issue with internal-compiler-syntax on ##sys#map etc. where the argument is only tested for pair?. An error is not thrown for non-lists.

comment:3 Changed 14 years ago by Jim Ursetto

Owner: set to felix winkelmann
Status: newassigned

Issue also affects for-each. Looks like a straightforward fix but I will let you handle it from here.

comment:4 Changed 14 years ago by Jim Ursetto

mario says galinha is using Chicken 4.2.0 to generate the snapshots, which explains why the snapshot bootstrap files are not affected; this problem was introduced in Chicken 4.2.1.

comment:5 Changed 14 years ago by felix winkelmann

Status: assignedaccepted
Version: 4.4.x

comment:6 Changed 14 years ago by felix winkelmann

Resolution: fixed
Status: acceptedclosed

In 22699fd729e2b1e08e8bdb2d6a5d640382d209d8 (experimental), a check has been added (unless in unsafe mode). Note that this only checks for the arguments being lists, not "proper" lists - the loops terminate on the first non-pair argument found.

comment:7 Changed 13 years ago by felix winkelmann

Milestone: 4.6.0

Milestone 4.6.0 deleted

Note: See TracTickets for help on using tickets.