From 65cc7f3f8021e7c225a55c04136ae78a825b4729 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Thu, 21 May 2015 17:20:10 -0500 Subject: [PATCH] Also check eqc in intersect_typevar (fixes #11367) --- src/jltypes.c | 10 ++++++++++ test/core.jl | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/jltypes.c b/src/jltypes.c index e619f643d1d09..3a3125e905ee0 100644 --- a/src/jltypes.c +++ b/src/jltypes.c @@ -750,6 +750,16 @@ static jl_value_t *intersect_typevar(jl_tvar_t *a, jl_value_t *b, break; } } + for(i=0; i < eqc->n; i+=2) { + if (eqc->data[i] == b && !jl_is_typevar(eqc->data[i+1])) { + jl_value_t *ti = jl_type_intersection((jl_value_t*)a, eqc->data[i+1]); + if (ti == (jl_value_t*)jl_bottom_type) { + JL_GC_POP(); + return ti; + } + break; + } + } } extend((jl_value_t*)a, b, penv); if (jl_is_typevar(b)) { diff --git a/test/core.jl b/test/core.jl index 4d42d8c78be36..e643eb721ba1a 100644 --- a/test/core.jl +++ b/test/core.jl @@ -2855,3 +2855,9 @@ type B11136 end let T = TypeVar(:T, true), TB = TypeVar(:T, B11136, true) testintersect(Tuple{T, T}, Tuple{A11136, TB}, Bottom) end + +# issue #11367 +abstract Foo11367 +let T1 = TypeVar(:T1, true), T2 = TypeVar(:T2, Foo11367, true) + testintersect(Tuple{T1, T1}, Tuple{Type{BigInt}, T2}, Bottom) +end