Skip to content

Commit f0ce704

Browse files
timholytkelman
authored andcommitted
Also check eqc in intersect_typevar (fixes JuliaLang#11367)
1 parent 541d721 commit f0ce704

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/jltypes.c

+10
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,16 @@ static jl_value_t *intersect_typevar(jl_tvar_t *a, jl_value_t *b,
750750
break;
751751
}
752752
}
753+
for(i=0; i < eqc->n; i+=2) {
754+
if (eqc->data[i] == b && !jl_is_typevar(eqc->data[i+1])) {
755+
jl_value_t *ti = jl_type_intersection((jl_value_t*)a, eqc->data[i+1]);
756+
if (ti == (jl_value_t*)jl_bottom_type) {
757+
JL_GC_POP();
758+
return ti;
759+
}
760+
break;
761+
}
762+
}
753763
}
754764
extend((jl_value_t*)a, b, penv);
755765
if (jl_is_typevar(b)) {

test/core.jl

+6
Original file line numberDiff line numberDiff line change
@@ -2877,3 +2877,9 @@ type B11136 end
28772877
let T = TypeVar(:T, true), TB = TypeVar(:T, B11136, true)
28782878
testintersect(Tuple{T, T}, Tuple{A11136, TB}, Bottom)
28792879
end
2880+
2881+
# issue #11367
2882+
abstract Foo11367
2883+
let T1 = TypeVar(:T1, true), T2 = TypeVar(:T2, Foo11367, true)
2884+
testintersect(Tuple{T1, T1}, Tuple{Type{BigInt}, T2}, Bottom)
2885+
end

0 commit comments

Comments
 (0)