Skip to content

Commit 65cc7f3

Browse files
committed
Also check eqc in intersect_typevar (fixes #11367)
1 parent bcf5361 commit 65cc7f3

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
@@ -2855,3 +2855,9 @@ type B11136 end
28552855
let T = TypeVar(:T, true), TB = TypeVar(:T, B11136, true)
28562856
testintersect(Tuple{T, T}, Tuple{A11136, TB}, Bottom)
28572857
end
2858+
2859+
# issue #11367
2860+
abstract Foo11367
2861+
let T1 = TypeVar(:T1, true), T2 = TypeVar(:T2, Foo11367, true)
2862+
testintersect(Tuple{T1, T1}, Tuple{Type{BigInt}, T2}, Bottom)
2863+
end

0 commit comments

Comments
 (0)