From 6c51d9e87173a6a32dc24f2c0aeac24e12cd93f4 Mon Sep 17 00:00:00 2001 From: Simeon Schaub Date: Fri, 18 Feb 2022 13:04:07 -0500 Subject: [PATCH] fix nothrow check for `get_binding_type` (#44229) This got missed in #43671. --- base/compiler/tfuncs.jl | 3 ++- test/compiler/inference.jl | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/base/compiler/tfuncs.jl b/base/compiler/tfuncs.jl index ec56b826d1491..54b89c9a04f43 100644 --- a/base/compiler/tfuncs.jl +++ b/base/compiler/tfuncs.jl @@ -1705,7 +1705,8 @@ function _builtin_nothrow(@nospecialize(f), argtypes::Array{Any,1}, @nospecializ end return false elseif f === Core.get_binding_type - return length(argtypes) == 2 + length(argtypes) == 2 || return false + return argtypes[1] ⊑ Module && argtypes[2] ⊑ Symbol elseif f === donotdelete return true end diff --git a/test/compiler/inference.jl b/test/compiler/inference.jl index d4fbe0dbfbf6b..61058f9589f52 100644 --- a/test/compiler/inference.jl +++ b/test/compiler/inference.jl @@ -4028,3 +4028,5 @@ function f_boundscheck_elim(n) ntuple(x->(@inbounds getfield(sin, x)), n) end @test Tuple{} <: code_typed(f_boundscheck_elim, Tuple{Int})[1][2] + +@test !Core.Compiler.builtin_nothrow(Core.get_binding_type, Any[Rational{Int}, Core.Const(:foo)], Any)