From 124abaa73c06e4c73c6cc6d470dbaa08eb9d4e28 Mon Sep 17 00:00:00 2001 From: anand jain <33790004+anandijain@users.noreply.github.com> Date: Thu, 23 Mar 2023 15:47:40 -0400 Subject: [PATCH] define `InteractiveUtils.@infer_effects` (#49062) --- stdlib/InteractiveUtils/src/macros.jl | 4 ++-- stdlib/InteractiveUtils/test/runtests.jl | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/InteractiveUtils/src/macros.jl b/stdlib/InteractiveUtils/src/macros.jl index 135c207654ca0..53242a422140b 100644 --- a/stdlib/InteractiveUtils/src/macros.jl +++ b/stdlib/InteractiveUtils/src/macros.jl @@ -2,7 +2,7 @@ # macro wrappers for various reflection functions -import Base: typesof, insert!, replace_ref_begin_end! +import Base: typesof, insert!, replace_ref_begin_end!, infer_effects separate_kwargs(args...; kwargs...) = (args, values(kwargs)) @@ -212,7 +212,7 @@ macro which(ex0::Symbol) return :(which($__module__, $ex0)) end -for fname in [:code_warntype, :code_llvm, :code_native] +for fname in [:code_warntype, :code_llvm, :code_native, :infer_effects] @eval begin macro ($fname)(ex0...) gen_call_with_extracted_types_and_kwargs(__module__, $(Expr(:quote, fname)), ex0) diff --git a/stdlib/InteractiveUtils/test/runtests.jl b/stdlib/InteractiveUtils/test/runtests.jl index cd1e660377230..5f90491fd8151 100644 --- a/stdlib/InteractiveUtils/test/runtests.jl +++ b/stdlib/InteractiveUtils/test/runtests.jl @@ -719,3 +719,5 @@ end end end end + +@test Base.infer_effects(sin, (Int,)) == InteractiveUtils.@infer_effects sin(42)