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

Compiler: missing request_value in not call #6452

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions spec/compiler/codegen/not_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,16 @@ describe "Code gen: not" do
!a.is_a?(String) && !a
)).to_b.should be_false
end

it "codegens not with inlinable value (#6451)" do
codegen(%(
class Test
def test
false
end
end

!Test.new.test
nil))
end
end
4 changes: 3 additions & 1 deletion src/compiler/crystal/codegen/codegen.cr
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,9 @@ module Crystal
end

def visit(node : Not)
accept node.exp
request_value do
accept node.exp
end
@last = codegen_cond node.exp.type.remove_indirection
@last = not @last
false
Expand Down