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: check typeof dependencies before cleanup #8695

Merged
merged 1 commit into from
Jan 17, 2020
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
11 changes: 11 additions & 0 deletions spec/compiler/semantic/block_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1432,4 +1432,15 @@ describe "Block inference" do
Node.new.sum
)) { int32 }
end

it "doesn't crash on cleaning up typeof node without dependencies (#8669)" do
semantic(%(
def foo(&)
end

foo do
typeof(bar)
end
))
end
end
5 changes: 4 additions & 1 deletion src/compiler/crystal/semantic/cleanup_transformer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,10 @@ module Crystal
node = super

unless node.type?
node.unbind_from node.dependencies
if dependencies = node.dependencies?
node.unbind_from node.dependencies
end

node.bind_to node.expressions
end

Expand Down