From 08182714e09e3b2243f6f82fa578f54876e2d331 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 15 Mar 2017 17:05:55 -0400 Subject: [PATCH] fix #21028, static parameter value incorrectly set to typevar This issue was caused by 6fb2c67e9e4461d48cbfe57bd30849a6615b06a1. --- src/subtype.c | 2 +- test/subtype.jl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/subtype.c b/src/subtype.c index e03f88b0fdb98..d1461eefc47ad 100644 --- a/src/subtype.c +++ b/src/subtype.c @@ -1292,7 +1292,7 @@ static jl_value_t *finish_unionall(jl_value_t *res, jl_varbinding_t *vb, jl_sten if (vb->right && e->envidx < e->envsz) { jl_value_t *oldval = e->envout[e->envidx]; - if (!varval || (!is_leaf_bound(varval) && !var_occurs_invariant(res, vb->var, 0))) + if (!varval || (!is_leaf_bound(varval) && !vb->occurs_inv)) e->envout[e->envidx] = (jl_value_t*)vb->var; else if (!(oldval && jl_is_typevar(oldval) && jl_is_long(varval))) e->envout[e->envidx] = varval; diff --git a/test/subtype.jl b/test/subtype.jl index 503e6e34eed7e..774929132255d 100644 --- a/test/subtype.jl +++ b/test/subtype.jl @@ -857,6 +857,9 @@ function test_intersection() # issue #20998 _, E = intersection_env(Tuple{Int,Any,Any}, Tuple{T,T,S} where {T,S}) @test length(E) == 2 && E[1] == Int && isa(E[2], TypeVar) + _, E = intersection_env(Tuple{Dict{Int,Type}, Type, Any}, + Tuple{Dict{K,V}, Any, Int} where {K,V}) + @test E[2] == Type end function test_intersection_properties()