From 90ecde0df2b0a8102d68c407af97fd463d73cc0b Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Mon, 24 Feb 2020 12:48:30 +0100 Subject: [PATCH] Whitelist hypot from method substitution warning. --- src/compiler/irgen.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/irgen.jl b/src/compiler/irgen.jl index b2153021..951badfc 100644 --- a/src/compiler/irgen.jl +++ b/src/compiler/irgen.jl @@ -45,6 +45,7 @@ struct MethodSubstitutionWarning <: Exception end Base.showerror(io::IO, err::MethodSubstitutionWarning) = print(io, "You called $(err.original), maybe you intended to call $(err.substitute) instead?") +const method_substitution_whitelist = [:hypot] function compile_method_instance(job::CompilerJob, method_instance::Core.MethodInstance, world) function postprocess(ir) @@ -102,7 +103,8 @@ function compile_method_instance(job::CompilerJob, method_instance::Core.MethodI # FIXME: this might be too coarse method = method_instance.def if Base.moduleroot(method.module) == Base && - isdefined(CUDAnative, method_instance.def.name) + isdefined(CUDAnative, method_instance.def.name) && + !in(method_instance.def.name, method_substitution_whitelist) substitute_function = getfield(CUDAnative, method.name) tt = Tuple{method_instance.specTypes.parameters[2:end]...} if hasmethod(substitute_function, tt)