File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1506,10 +1506,18 @@ JL_DLLEXPORT int jl_isa(jl_value_t *x, jl_value_t *t)
15061506 if (((jl_datatype_t * )t2 )-> name == jl_type_typename ) {
15071507 jl_value_t * tp = jl_tparam0 (t2 );
15081508 if (jl_is_typevar (tp )) {
1509- while (jl_is_typevar (tp ))
1510- tp = ((jl_tvar_t * )tp )-> ub ;
1511- if (!jl_has_free_typevars (tp ))
1512- return jl_subtype (x , tp );
1509+ if (((jl_tvar_t * )tp )-> lb == jl_bottom_type ) {
1510+ while (jl_is_typevar (tp ))
1511+ tp = ((jl_tvar_t * )tp )-> ub ;
1512+ if (!jl_has_free_typevars (tp ))
1513+ return jl_subtype (x , tp );
1514+ }
1515+ else if (((jl_tvar_t * )tp )-> ub == (jl_value_t * )jl_any_type ) {
1516+ while (jl_is_typevar (tp ))
1517+ tp = ((jl_tvar_t * )tp )-> lb ;
1518+ if (!jl_has_free_typevars (tp ))
1519+ return jl_subtype (tp , x );
1520+ }
15131521 }
15141522 }
15151523 else {
Original file line number Diff line number Diff line change @@ -488,6 +488,10 @@ function test_Type()
488488 @test ! (Tuple{Int,} <: (@UnionAll T<:Tuple Type{T}) )
489489 @test isa (Tuple{Int}, (@UnionAll T<: Tuple Type{T}))
490490
491+ @test ! isa (Int, Type{>: String })
492+ @test isa (Union{Int,String}, Type{>: String })
493+ @test isa (Any, Type{>: String })
494+
491495 # this matches with T==DataType, since DataType is concrete
492496 @test issub (Tuple{Type{Int},Type{Int8}}, Tuple{T,T} where T)
493497 @test ! issub (Tuple{Type{Int},Type{Union{}}}, Tuple{T,T} where T)
You can’t perform that action at this time.
0 commit comments