Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to sink last statement in for loop with explicit loop var #2944

Open
thundergnat opened this issue Jun 1, 2019 · 0 comments
Open

Comments

@thundergnat
Copy link
Contributor

thundergnat commented Jun 1, 2019

The Problem

When using an explicit for loop variable, the last statement is not sunk.

Related to #1570 (Which focused on the case of for loops with implicit loop variables)

(Updated to better demonstrate the issue)

sub wat ($n) {
    1.map: -> $m { say "uno: $m" }
    1.map: -> $m { say "dos: $m" }
}

for 1 -> $p { say "|$p|"; wat($p) } # explicit for loop variable
say '';
for 1       { say "|$_|"; wat($_) } # implicit for loop variable
say '';
for 1 -> $p { say "|$p|"; sink wat($p) } # explicit for loop variable with sink

Expected Behavior

|1|
uno: 1
dos: 1

|1|
uno: 1
dos: 1

|1|
uno: 1
dos: 1

Actual Behavior

|1|
uno: 1

|1|
uno: 1
dos: 1

|1|
uno: 1
dos: 1

Environment

  • Operating system:
  • Compiler version (perl6 -v):
    Linux Mint 19.01 Cinnamon
    This is Rakudo version 2019.03 built on MoarVM version 2019.03
    implementing Perl 6.d.

and on Camelia: rakudo-moar a643b8b

@thundergnat thundergnat changed the title Odd interaction between explicit for loop variables and iterators Failure to sink last statement in for loop with explicit loop var Jun 6, 2019
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

No branches or pull requests

1 participant