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

Add test for #1486 #746

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add test for #1486 #746

wants to merge 1 commit into from

Conversation

Altai-man
Copy link
Member

Closes rakudo/rakudo#1486

I really don't know where to put this, in literals there is nothing for hash literals and hash or hashes have nothing related also, instead testing just methods.

@@ -140,6 +140,11 @@ plan 55;
eval-lives-ok 'my %*a{Int}', "Accept dynamic object hash"
}

# https://github.com/rakudo/rakudo/issues/1486
{
ok {:foo, (if 1 { :bar })}, 'a conditional inside circumfix {} works';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure the static optimizer doesn't optimize the if 1 away?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope the new version is complex enough?

@@ -140,6 +140,11 @@ plan 55;
eval-lives-ok 'my %*a{Int}', "Accept dynamic object hash"
}

# https://github.com/rakudo/rakudo/issues/1486
{
ok {:foo, (if 0.5.rand < 1 { :bar })}, 'a conditional inside circumfix {} works';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to ask about a comment explaining the approach about if. It's going to be really confusing what purpose of it without the background of this PR.

BTW, a sufficiently sophisticated static optimizer would optimize away this if too. But, unfortunately, we're not going get one of the kind any time soon.

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.

if {...} inside circumfix {} crashes
3 participants