Skip to content

Commit b18647e

Browse files
authored
Revert "Improve typesubtract for tuples (#35600)" (#37562)
This reverts commit cf0c3e0.
1 parent c718376 commit b18647e

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

base/compiler/typeutils.jl

-9
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ function typesubtract(@nospecialize(a), @nospecialize(b))
7070
if isa(a, Union)
7171
return Union{typesubtract(a.a, b),
7272
typesubtract(a.b, b)}
73-
elseif a isa DataType
74-
if b isa DataType
75-
if a.name === b.name === Tuple.name && length(a.types) == length(b.types)
76-
ta = switchtupleunion(a)
77-
if length(ta) > 1
78-
return typesubtract(Union{ta...}, b)
79-
end
80-
end
81-
end
8273
end
8374
return a # TODO: improve this bound?
8475
end

test/compiler/inference.jl

-41
Original file line numberDiff line numberDiff line change
@@ -2585,47 +2585,6 @@ end
25852585

25862586
@test map(>:, [Int], [Int]) == [true]
25872587

2588-
# issue 35566
2589-
module Issue35566
2590-
function step(acc, x)
2591-
xs, = acc
2592-
y = x > 0.0 ? x : missing
2593-
if y isa eltype(xs)
2594-
ys = push!(xs, y)
2595-
else
2596-
ys = vcat(xs, [y])
2597-
end
2598-
return (ys,)
2599-
end
2600-
2601-
function probe(y)
2602-
if y isa Tuple{Vector{Missing}}
2603-
return Val(:missing)
2604-
else
2605-
return Val(:expected)
2606-
end
2607-
end
2608-
2609-
function _foldl_iter(rf, val::T, iter, state) where {T}
2610-
while true
2611-
ret = iterate(iter, state)
2612-
ret === nothing && break
2613-
x, state = ret
2614-
y = rf(val, x)
2615-
if y isa T
2616-
val = y
2617-
else
2618-
return probe(y)
2619-
end
2620-
end
2621-
return Val(:expected)
2622-
end
2623-
2624-
f() = _foldl_iter(step, (Missing[],), [0.0], 1)
2625-
end
2626-
@test Core.Compiler.typesubtract(Tuple{Union{Int,Char}}, Tuple{Char}) == Tuple{Int}
2627-
@test Base.return_types(Issue35566.f) == [Val{:expected}]
2628-
26292588
# constant prop through keyword arguments
26302589
_unstable_kw(;x=1,y=2) = x == 1 ? 0 : ""
26312590
_use_unstable_kw_1() = _unstable_kw(x = 2)

0 commit comments

Comments
 (0)