Skip to content

Commit

Permalink
Merge pull request JuliaLang#25680 from JuliaLang/kf/errorannotate
Browse files Browse the repository at this point in the history
Add type annotations on inference-generated error cases
  • Loading branch information
Keno committed Jan 22, 2018
2 parents 4873dc0 + 96a0dbb commit a71ae77
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,9 @@ function invoke_NF(argexprs, @nospecialize(etype), atypes::Vector{Any}, sv::Opti
append!(stmts, match)
if error_label !== nothing
push!(stmts, error_label)
push!(stmts, Expr(:call, GlobalRef(_topmod(sv.mod), :error), "fatal error in type inference (type bound)"))
error_call = Expr(:call, GlobalRef(_topmod(sv.mod), :error), "fatal error in type inference (type bound)")
error_call.typ = Union{}
push!(stmts, error_call)
end
if spec_miss !== nothing
push!(stmts, spec_miss)
Expand Down Expand Up @@ -1449,7 +1451,9 @@ function inlineable(@nospecialize(f), @nospecialize(ft), e::Expr, atypes::Vector
lastexpr = pop!(body.args)
if isa(lastexpr, LabelNode)
push!(body.args, lastexpr)
push!(body.args, Expr(:call, GlobalRef(topmod, :error), "fatal error in type inference (lowering)"))
error_call = Expr(:call, GlobalRef(topmod, :error), "fatal error in type inference (lowering)")
error_call.typ = Union{}
push!(body.args, error_call)
lastexpr = nothing
elseif !(isa(lastexpr, Expr) && lastexpr.head === :return)
# code sometimes ends with a meta node, e.g. inbounds pop
Expand Down

0 comments on commit a71ae77

Please sign in to comment.