Skip to content

Commit

Permalink
Add error for failure in type inference
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonReinhard committed Nov 1, 2024
1 parent 656f17e commit a01b9a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/code_gen/tape_machine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,6 @@ function gen_function_body(tape::Tape; closures_size::Int)

setdiff!(undefined_argument_symbols, ret_symbols_set)

#=Expr(
:macrocall,
Symbol("@closure"),
@__LINE__,
Expr( <closure...> )
)=#

# combine to one closure call, including all the local inits and the actual call to the closure
pushfirst!(closures, closure)
end
Expand Down
5 changes: 5 additions & 0 deletions src/task/compute.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ function result_type(fc::FunctionCall, known_res_types::Dict{Symbol,Type})
"failure during type inference: function call $fc is type unstable, possible return types: $types",
)
end
if isempty(types)
throw(
"failure during type inference: function call $fc has no return types, this is likely because no method matches the arguments",
)
end

return types[1]
end

0 comments on commit a01b9a8

Please sign in to comment.