diff --git a/base/compiler/typelimits.jl b/base/compiler/typelimits.jl index 09372b2dc9613..436c24d85d8d0 100644 --- a/base/compiler/typelimits.jl +++ b/base/compiler/typelimits.jl @@ -277,22 +277,9 @@ function type_more_complex(@nospecialize(t), @nospecialize(c), sources::SimpleVe else tupledepth = 0 end - isgenerator = (t.name.name === :Generator && t.name.module === _topmod(t.name.module)) for i = 1:length(tP) tPi = tP[i] cPi = cP[i + ntail] - if isgenerator - let tPi = unwrap_unionall(tPi), - cPi = unwrap_unionall(cPi) - if isa(tPi, DataType) && isa(cPi, DataType) && - !isabstracttype(tPi) && !isabstracttype(cPi) && - sym_isless(cPi.name.name, tPi.name.name) - # allow collect on (anonymous) Generators to nest, provided that their functions are appropriately ordered - # TODO: is there a better way? - continue - end - end - end type_more_complex(tPi, cPi, sources, depth + 1, tupledepth, 0) && return true end return false diff --git a/base/compiler/utilities.jl b/base/compiler/utilities.jl index 7c3b19ead54cc..4ad66c2d8ed01 100644 --- a/base/compiler/utilities.jl +++ b/base/compiler/utilities.jl @@ -66,8 +66,6 @@ end is_meta_expr_head(head::Symbol) = head === :boundscheck || head === :meta || head === :loopinfo is_meta_expr(@nospecialize x) = isa(x, Expr) && is_meta_expr_head(x.head) -sym_isless(a::Symbol, b::Symbol) = ccall(:strcmp, Int32, (Ptr{UInt8}, Ptr{UInt8}), a, b) < 0 - function is_self_quoting(@nospecialize(x)) return isa(x,Number) || isa(x,AbstractString) || isa(x,Tuple) || isa(x,Type) || isa(x,Char) || x === nothing || isa(x,Function) diff --git a/test/compiler/inference.jl b/test/compiler/inference.jl index dc46bc2495c7f..cfd44967a5081 100644 --- a/test/compiler/inference.jl +++ b/test/compiler/inference.jl @@ -96,6 +96,16 @@ end @test !Core.Compiler.type_more_complex(Tuple{Vararg{Tuple{}}}, Tuple{Vararg{Tuple}}, Core.svec(), 0, 0, 0) @test Core.Compiler.type_more_complex(Tuple{Vararg{Tuple}}, Tuple{Vararg{Tuple{}}}, Core.svec(), 0, 0, 0) +# issue #51694 +@test Core.Compiler.type_more_complex( + Base.Generator{Base.Iterators.Flatten{Array{Bool, 1}}, typeof(identity)}, + Base.Generator{Array{Bool, 1}, typeof(identity)}, + Core.svec(), 0, 0, 0) +@test Core.Compiler.type_more_complex( + Base.Generator{Base.Iterators.Flatten{Base.Generator{Array{Bool, 1}, typeof(identity)}}, typeof(identity)}, + Base.Generator{Array{Bool, 1}, typeof(identity)}, + Core.svec(), 0, 0, 0) + let # 40336 t = Type{Type{Int}} c = Type{Int}