File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -268,12 +268,16 @@ function ==(t1::Tuple, t2::Tuple)
268
268
if length (t1) != length (t2)
269
269
return false
270
270
end
271
+ anymissing = false
271
272
for i = 1 : length (t1)
272
- if ! (t1[i] == t2[i])
273
- return false
274
- end
273
+ eq = (t1[i] == t2[i])
274
+ if ismissing (eq)
275
+ anymissing = true
276
+ elseif ! eq
277
+ return false
278
+ end
275
279
end
276
- return true
280
+ return anymissing ? missing : true
277
281
end
278
282
279
283
const tuplehash_seed = UInt === UInt64 ? 0x77cfa1eef01bca90 : 0xf01bca90
Original file line number Diff line number Diff line change 222
222
@test Union{Int, Missing}[1 ] != Union{Int, Missing}[2 ]
223
223
end
224
224
225
+ @testset " == and != on tuples" begin
226
+ @test ismissing ((1 , missing ) == (1 , missing ))
227
+ @test ismissing ((" a" , missing ) == (" a" , missing ))
228
+ @test ismissing ((missing ,) == (missing ,))
229
+ @test ismissing ((missing , 2 ) == (1 , missing ))
230
+
231
+ @test ismissing ((1 , missing ) != (1 , missing ))
232
+ @test ismissing ((" a" , missing ) != (" a" , missing ))
233
+ @test ismissing ((missing ,) != (missing ,))
234
+ @test ismissing ((missing , 2 ) != (1 , missing ))
235
+ end
236
+
225
237
@testset " any & all" begin
226
238
@test any ([true , missing ])
227
239
@test any (x -> x == 1 , [1 , missing ])
You can’t perform that action at this time.
0 commit comments