From a01b9a8f5eb809ce0f16453d420d47f12227a18d Mon Sep 17 00:00:00 2001 From: AntonReinhard Date: Fri, 1 Nov 2024 13:00:20 +0100 Subject: [PATCH] Add error for failure in type inference --- src/code_gen/tape_machine.jl | 7 ------- src/task/compute.jl | 5 +++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/code_gen/tape_machine.jl b/src/code_gen/tape_machine.jl index b328a17..78eabbe 100644 --- a/src/code_gen/tape_machine.jl +++ b/src/code_gen/tape_machine.jl @@ -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( ) - )=# - # combine to one closure call, including all the local inits and the actual call to the closure pushfirst!(closures, closure) end diff --git a/src/task/compute.jl b/src/task/compute.jl index 8593646..dd78b09 100644 --- a/src/task/compute.jl +++ b/src/task/compute.jl @@ -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