Skip to content

Commit 489ae0a

Browse files
vtjnashKristofferC
authored andcommitted
Revert "Improve typesubtract for tuples (#35600)" (#37562)
This reverts commit cf0c3e0. (cherry picked from commit b18647e)
1 parent 7c7e8b6 commit 489ae0a

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

base/compiler/typeutils.jl

Lines changed: 0 additions & 9 deletions
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

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,47 +2562,6 @@ end
25622562

25632563
@test map(>:, [Int], [Int]) == [true]
25642564

2565-
# issue 35566
2566-
module Issue35566
2567-
function step(acc, x)
2568-
xs, = acc
2569-
y = x > 0.0 ? x : missing
2570-
if y isa eltype(xs)
2571-
ys = push!(xs, y)
2572-
else
2573-
ys = vcat(xs, [y])
2574-
end
2575-
return (ys,)
2576-
end
2577-
2578-
function probe(y)
2579-
if y isa Tuple{Vector{Missing}}
2580-
return Val(:missing)
2581-
else
2582-
return Val(:expected)
2583-
end
2584-
end
2585-
2586-
function _foldl_iter(rf, val::T, iter, state) where {T}
2587-
while true
2588-
ret = iterate(iter, state)
2589-
ret === nothing && break
2590-
x, state = ret
2591-
y = rf(val, x)
2592-
if y isa T
2593-
val = y
2594-
else
2595-
return probe(y)
2596-
end
2597-
end
2598-
return Val(:expected)
2599-
end
2600-
2601-
f() = _foldl_iter(step, (Missing[],), [0.0], 1)
2602-
end
2603-
@test Core.Compiler.typesubtract(Tuple{Union{Int,Char}}, Tuple{Char}) == Tuple{Int}
2604-
@test Base.return_types(Issue35566.f) == [Val{:expected}]
2605-
26062565
# constant prop through keyword arguments
26072566
_unstable_kw(;x=1,y=2) = x == 1 ? 0 : ""
26082567
_use_unstable_kw_1() = _unstable_kw(x = 2)

0 commit comments

Comments
 (0)