Skip to content

Commit

Permalink
Merge pull request #6452 from asterite/bug/6451-not-missing-request-v…
Browse files Browse the repository at this point in the history
…alue

Compiler: missing `request_value` in `not` call
  • Loading branch information
ysbaddaden authored Jul 27, 2018
2 parents 4f720ab + e6ac69b commit a6ba4e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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

0 comments on commit a6ba4e8

Please sign in to comment.