6060# issue #42835
6161@test ! Core. Compiler. type_more_complex (Int, Any, Core. svec (), 1 , 1 , 1 )
6262@test ! Core. Compiler. type_more_complex (Int, Type{Int}, Core. svec (), 1 , 1 , 1 )
63- @test ! Core. Compiler. type_more_complex (Type{Int}, Any, Core. svec (), 1 , 1 , 1 )
63+ @test Core. Compiler. type_more_complex (Type{Int}, Any, Core. svec (), 1 , 1 , 1 ) # maybe should be fixed?
64+ @test Core. Compiler. limit_type_size (Type{Int}, Any, Union{}, 0 , 0 ) == Type{Int}
6465@test Core. Compiler. type_more_complex (Type{Type{Int}}, Type{Int}, Core. svec (Type{Int}), 1 , 1 , 1 )
6566@test Core. Compiler. type_more_complex (Type{Type{Int}}, Int, Core. svec (Type{Int}), 1 , 1 , 1 )
6667@test Core. Compiler. type_more_complex (Type{Type{Int}}, Any, Core. svec (), 1 , 1 , 1 )
7172@test Core. Compiler. type_more_complex (ComplexF32, Type{ComplexF32}, Core. svec (), 1 , 1 , 1 )
7273@test ! Core. Compiler. type_more_complex (Type{ComplexF32}, Any, Core. svec (Type{Type{ComplexF32}}), 1 , 1 , 1 )
7374@test Core. Compiler. type_more_complex (Type{ComplexF32}, Type{Type{ComplexF32}}, Core. svec (), 1 , 1 , 1 )
74- @test ! Core. Compiler. type_more_complex (Type{ComplexF32}, ComplexF32, Core. svec (), 1 , 1 , 1 )
75+ @test Core. Compiler. type_more_complex (Type{ComplexF32}, ComplexF32, Core. svec (), 1 , 1 , 1 )
76+ @test Core. Compiler. limit_type_size (Type{ComplexF32}, ComplexF32, Union{}, 1 , 1 ) == Type{<: Complex }
7577@test Core. Compiler. type_more_complex (Type{ComplexF32}, Any, Core. svec (), 1 , 1 , 1 )
7678@test Core. Compiler. type_more_complex (Type{Type{ComplexF32}}, Type{ComplexF32}, Core. svec (Type{ComplexF32}), 1 , 1 , 1 )
7779@test Core. Compiler. type_more_complex (Type{Type{ComplexF32}}, ComplexF32, Core. svec (ComplexF32), 1 , 1 , 1 )
7880@test Core. Compiler. type_more_complex (Type{Type{Type{ComplexF32}}}, Type{Type{ComplexF32}}, Core. svec (Type{ComplexF32}), 1 , 1 , 1 )
7981
8082# n.b. Type{Type{Union{}} === Type{Core.TypeofBottom}
81- @test ! Core. Compiler. type_more_complex (Type{Union{}}, Any, Core. svec (), 1 , 1 , 1 )
82- @test ! Core. Compiler. type_more_complex (Type{Type{Union{}}}, Any, Core. svec (), 1 , 1 , 1 )
83+ @test Core. Compiler. type_more_complex (Type{Union{}}, Any, Core. svec (), 1 , 1 , 1 )
84+ @test Core. Compiler. type_more_complex (Type{Type{Union{}}}, Any, Core. svec (), 1 , 1 , 1 )
8385@test Core. Compiler. type_more_complex (Type{Type{Type{Union{}}}}, Any, Core. svec (), 1 , 1 , 1 )
8486@test Core. Compiler. type_more_complex (Type{Type{Type{Union{}}}}, Type{Type{Union{}}}, Core. svec (Type{Type{Union{}}}), 1 , 1 , 1 )
8587@test Core. Compiler. type_more_complex (Type{Type{Type{Type{Union{}}}}}, Type{Type{Type{Union{}}}}, Core. svec (Type{Type{Type{Union{}}}}), 1 , 1 , 1 )
8688
8789@test ! Core. Compiler. type_more_complex (Type{1 }, Type{2 }, Core. svec (), 1 , 1 , 1 )
8890@test Core. Compiler. type_more_complex (Type{Union{Float32,Float64}}, Union{Float32,Float64}, Core. svec (Union{Float32,Float64}), 1 , 1 , 1 )
89- @test ! Core. Compiler. type_more_complex (Type{Union{Float32,Float64}}, Union{Float32,Float64}, Core. svec (Union{Float32,Float64}), 0 , 1 , 1 )
91+ @test Core. Compiler. type_more_complex (Type{Union{Float32,Float64}}, Union{Float32,Float64}, Core. svec (Union{Float32,Float64}), 0 , 1 , 1 )
9092@test Core. Compiler. type_more_complex (Type{<: Union{Float32,Float64} }, Type{Union{Float32,Float64}}, Core. svec (Union{Float32,Float64}), 1 , 1 , 1 )
9193@test Core. Compiler. type_more_complex (Type{<: Union{Float32,Float64} }, Any, Core. svec (Union{Float32,Float64}), 1 , 1 , 1 )
9294
@@ -101,6 +103,44 @@ let # 40336
101103 @test t != = r && t <: r
102104end
103105
106+ @test Core. Compiler. limit_type_size (Type{Type{Type{Int}}}, Type, Union{}, 0 , 0 ) == Type{<: Type }
107+ @test Core. Compiler. limit_type_size (Type{Type{Int}}, Type, Union{}, 0 , 0 ) == Type{<: Type }
108+ @test Core. Compiler. limit_type_size (Type{Int}, Type, Union{}, 0 , 0 ) == Type{Int}
109+ @test Core. Compiler. limit_type_size (Type{<: Int }, Type, Union{}, 0 , 0 ) == Type{<: Int }
110+ @test Core. Compiler. limit_type_size (Type{ComplexF32}, ComplexF32, Union{}, 0 , 0 ) == Type{<: Complex } # added nesting
111+ @test Core. Compiler. limit_type_size (Type{ComplexF32}, Type{ComplexF64}, Union{}, 0 , 0 ) == Type{ComplexF32} # base matches
112+ @test Core. Compiler. limit_type_size (Type{ComplexF32}, Type, Union{}, 0 , 0 ) == Type{<: Complex }
113+ @test_broken Core. Compiler. limit_type_size (Type{<: ComplexF64 }, Type, Union{}, 0 , 0 ) == Type{<: Complex }
114+ @test Core. Compiler. limit_type_size (Type{<: ComplexF64 }, Type, Union{}, 0 , 0 ) == Type # 50692
115+ @test Core. Compiler. limit_type_size (Type{Union{ComplexF32,ComplexF64}}, Type, Union{}, 0 , 0 ) == Type
116+ @test_broken Core. Compiler. limit_type_size (Type{Union{ComplexF32,ComplexF64}}, Type, Union{}, 0 , 0 ) == Type{<: Complex } # 50692
117+ @test Core. Compiler. limit_type_size (Type{Union{Float32,Float64}}, Type, Union{}, 0 , 0 ) == Type
118+ @test Core. Compiler. limit_type_size (Type{Union{Int,Type{Int}}}, Type{Type{Int}}, Union{}, 0 , 0 ) == Type
119+ @test Core. Compiler. limit_type_size (Type{Union{Int,Type{Int}}}, Union{Type{Int},Type{Type{Int}}}, Union{}, 0 , 0 ) == Type
120+ @test Core. Compiler. limit_type_size (Type{Union{Int,Type{Int}}}, Type{Union{Type{Int},Type{Type{Int}}}}, Union{}, 0 , 0 ) == Type{Union{Int, Type{Int}}}
121+ @test Core. Compiler. limit_type_size (Type{Union{Int,Type{Int}}}, Type{Type{Int}}, Union{}, 0 , 0 ) == Type
122+
123+
124+ # issue #43296 #43296
125+ struct C43296{t,I} end
126+ r43296 (b) = r43296 (typeof (b))
127+ r43296 (:: Type ) = nothing
128+ r43296 (:: Nothing ) = nonexistent
129+ r43296 (:: Type{C43296{c,d}} ) where {c,d} = f43296 (r43296 (c), e)
130+ f43296 (:: Nothing , :) = nothing
131+ f43296 (g, :) = h
132+ k43296 (b, j, :) = l
133+ k43296 (b, j, :: Nothing ) = b
134+ i43296 (b, j) = k43296 (b, j, r43296 (j))
135+ @test only (Base. return_types (i43296, (Int, C43296{C43296{C43296{Val, Tuple}, Tuple}}))) == Int
136+
137+ abstract type e43296{a, j} <: AbstractArray{a, j} end
138+ abstract type b43296{a, j, c, d} <: e43296{a, j} end
139+ struct h43296{a, j, f, d, i} <: b43296{a, j, f, d} end
140+ Base. ndims (:: Type{f} ) where {f<: e43296 } = ndims (supertype (f))
141+ Base. ndims (g:: e43296 ) = ndims (typeof (g))
142+ @test only (Base. return_types (ndims, (h43296{Any, 0 , Any, Int, Any},))) == Int
143+
104144@test Core. Compiler. unionlen (Union{}) == 1
105145@test Core. Compiler. unionlen (Int8) == 1
106146@test Core. Compiler. unionlen (Union{Int8, Int16}) == 2
0 commit comments