Skip to content

Commit

Permalink
Prune egal types when forming a Union (#37207)
Browse files Browse the repository at this point in the history
Fixes #37180.
  • Loading branch information
martinholters authored Aug 27, 2020
1 parent 8a01917 commit f047d7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ JL_DLLEXPORT jl_value_t *jl_type_union(jl_value_t **ts, size_t n)
if (j != i && temp[i] && temp[j]) {
if (temp[i] == temp[j] || temp[i] == jl_bottom_type ||
temp[j] == (jl_value_t*)jl_any_type ||
jl_egal(temp[i], temp[j]) ||
(!has_free && !jl_has_free_typevars(temp[j]) &&
jl_subtype(temp[i], temp[j]))) {
temp[i] = NULL;
Expand Down
3 changes: 3 additions & 0 deletions test/subtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1766,3 +1766,6 @@ end
@testintersect(Tuple{Type{T}, AbstractVector{T}} where T,
Tuple{Union, F36869{Int64, Missing}},
Tuple{Union, F36869{Int64, Missing}})

# issue #37180
@test !(typeintersect(Tuple{AbstractArray{T}, VecOrMat{T}} where T, Tuple{Array, Any}).body.parameters[1] isa Union)

2 comments on commit f047d7f

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something went wrong when running your job:

NanosoldierError: failed to run benchmarks against primary commit: failed process: Process(`make -j3 USECCACHE=1 USE_BINARYBUILDER_LLVM=0`, ProcessExited(2)) [2]

Logs and partial data can be found here
cc @ararslan

Please sign in to comment.