@@ -1091,6 +1091,19 @@ Adapt.adapt_storage(::ArrayConverter, xs::AbstractArray) = convert(Array, xs)
10911091 @test t. b. d isa Array
10921092end
10931093
1094+ # The following code defines `MyArray1/2/3` with different `BroadcastStyle`s.
1095+ # 1. `MyArray1` and `MyArray1` have `similar` defined.
1096+ # We use them to simulate `BroadcastStyle` overloading `Base.copyto!`.
1097+ # 2. `MyArray3` has no `similar` defined.
1098+ # We use it to simulate `BroadcastStyle` overloading `Base.copy`.
1099+ # 3. Their resolved style could be summaryized as (`-` means conflict)
1100+ # | MyArray1 | MyArray2 | MyArray3 | Array
1101+ # -------------------------------------------------------------
1102+ # MyArray1 | MyArray1 | - | MyArray1 | MyArray1
1103+ # MyArray2 | - | MyArray2 | - | MyArray2
1104+ # MyArray3 | MyArray1 | - | MyArray3 | MyArray3
1105+ # Array | MyArray1 | Array | MyArray3 | Array
1106+
10941107for S in (1 , 2 , 3 )
10951108 MyArray = Symbol (:MyArray , S)
10961109 @eval begin
@@ -1129,9 +1142,9 @@ Base.BroadcastStyle(::Broadcast.ArrayStyle{MyArray2}, S::Broadcast.DefaultArrayS
11291142 @test isa (@inferred (Base. dataids (s)), NTuple{N, UInt} where {N})
11301143
11311144 # Make sure we can handle style with similar defined
1132- # And we can handle most conflict
1133- # s1 and s2 has similar defined, but s3 not
1134- # s2 are conflict with s1 and s3. (And it's weaker than DefaultArrayStyle)
1145+ # And we can handle most conflicts
1146+ # `s1` and `s2` have similar defined, but `s3` does not
1147+ # `s2` conflicts with `s1` and `s3` and is weaker than ` DefaultArrayStyle`
11351148 s1 = StructArray {ComplexF64} ((MyArray1 (rand (2 )), MyArray1 (rand (2 ))))
11361149 s2 = StructArray {ComplexF64} ((MyArray2 (rand (2 )), MyArray2 (rand (2 ))))
11371150 s3 = StructArray {ComplexF64} ((MyArray3 (rand (2 )), MyArray3 (rand (2 ))))
0 commit comments