pharo icon indicating copy to clipboard operation
pharo copied to clipboard

#to:do: optimization evaluates argument before receiver

Open j-brant opened this issue 1 year ago • 1 comments

Bug description The first argument of the to:do: message send is evaluated before the receiver.

To Reproduce Evaluate:

| stream results |
results := OrderedCollection new.
stream := #( 1 5 ) readStream.
stream next to: stream next do: [ :i | results add: i ].
results

This should return an ordered collection with numbers 1 to 5, but instead returns an empty collection as the to: argument is evaluated before the receiver.

Expected behavior The receiver of the message should be evaluated before an arguments like happens with non-optimized messages.

Version information:

  • Pharo Version: Pharo 13 (and 10 and likely most other versions).

j-brant avatar Jul 19 '24 11:07 j-brant

Thanks, I will check

MarcusDenker avatar Jul 22 '24 09:07 MarcusDenker