Skip to content

Add specs for safe navigation chains on a non-nil receiver - #1411

Open
sampokuokkanen wants to merge 1 commit into
ruby:masterfrom
sampokuokkanen:safe-navigator-chain
Open

sampokuokkanen wants to merge 1 commit into
ruby:masterfrom
sampokuokkanen:safe-navigator-chain

Conversation

@sampokuokkanen

Copy link
Copy Markdown
Contributor

The only chain example (nil&.one&.two&.three) uses a nil receiver, so it passes even if an implementation skips the later calls of a chain. JRuby's Prism compiler had that bug: a&.b&.c on a non-nil receiver returned nil without calling c (jruby/jruby#8832, fixed in jruby/jruby#10164).

This adds two examples for a non-nil receiver: one that calls each method of a chain, including an index call with an argument, and one that stops at the first nil.

The only chain example used a nil receiver, so it passed even when
an implementation skipped the later calls of a chain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant