Recursive protocol method for a record never terminates

Description

When extending a protocol for a record, a recursive method can never terminate in some cases.

prn call #1 prints nil as expected, but prn call #2 never terminates.

It looks like the compiler creates a variable assigned to this within the while loop such that the test of "x" is always really testing this when it should be testing the value of x passed in by the call to recur.

Note, I'm testing ClojureScript 1.8.51. The "Affects Version/s" field above only gives 1.7.228 as the most recent version.

Environment

Any

Activity

Show:

David Nolen July 8, 2017 at 4:58 PM

Confirmed with Mike Fikes this is still an issue on master even with the recur enhancements.

import May 23, 2016 at 10:14 AM

Comment made by: bstiles

Actually, "always really testing 'this' when it should be testing the value of x passed in by the call to recur" is only true if the type of the value represented by x remains the same. If, as in the example, the type changes, the call should be dispatched to the properly matching method implementation.

This seems to behave as expected in Clojure.

Details

Assignee

Reporter

Affects versions

Priority

Created May 23, 2016 at 10:05 AM
Updated July 8, 2017 at 4:58 PM