Skip to content

Commit 042c4d5

Browse files
committed
Merge pull request #13272 from JuliaLang/sjk/13261
Fix #13261, isvatuple MethodError in inference
2 parents 926d990 + 5c0eb6d commit 042c4d5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

base/inference.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ function precise_container_types(args, types, vtypes, sv)
783783
if any(isvarargtype, result[i])
784784
return nothing
785785
end
786+
elseif ti === Union{}
787+
return nothing
786788
elseif ti<:Tuple && (i==n || !isvatuple(ti))
787789
result[i] = ti.parameters
788790
elseif ti<:AbstractArray && i==n
@@ -2813,7 +2815,7 @@ function inlining_pass(e::Expr, sv, ast)
28132815
newargs[i-3] = aarg.args[2:end]
28142816
elseif isa(aarg, Tuple)
28152817
newargs[i-3] = Any[ QuoteNode(x) for x in aarg ]
2816-
elseif (t<:Tuple) && !isvatuple(t) && effect_free(aarg,sv,true)
2818+
elseif (t<:Tuple) && t !== Union{} && !isvatuple(t) && effect_free(aarg,sv,true)
28172819
# apply(f,t::(x,y)) => f(t[1],t[2])
28182820
tp = t.parameters
28192821
newargs[i-3] = Any[ mk_getfield(aarg,j,tp[j]) for j=1:length(tp) ]

test/core.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3390,3 +3390,8 @@ f8932(a::Vec3_8932, b::Vec3_8932) = Vec3_8932(a.x % b.x, a.y % b.y, a.z % b.z)
33903390
a8932 = Vec3_8932(1,1,1)
33913391
b8932 = Vec3_8932(2,2,2)
33923392
@test f8932(a8932, b8932) == Vec3_8932(1.0, 1.0, 1.0)
3393+
3394+
# issue #13261
3395+
f13261() = (x = (error("oops"),); +(x...))
3396+
g13261() = f13261()
3397+
@test_throws ErrorException g13261()

0 commit comments

Comments
 (0)