Skip to content

#to:do: optimization evaluates argument before receiver #16927

Open
@j-brant

Description

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions