@@ -41,16 +41,16 @@ if VERSION >= v"1.6" # for ComposedFunction
41
41
@test (2 , 5 , 10 , 17 , 26 , 37 ) === @inferred getall (obj, @optic _ |> _[:] |> Elements () |> Elements () |> _[:] |> Elements () |> Elements () |> _[1 ]^ 2 + 1 |> only)
42
42
43
43
# trickier types for Elements():
44
- obj = (a= (" ab" , " c" ), b= ([1 2 ; 3 4 ],), c= (SVector (1 ), SVector (2 , 3 )))
44
+ obj = (a= (" ab" , " c" ), b= ([1 2 ; 3 4 ],), c= (SVector (1. ), SVector (2 , 3 )))
45
45
@test [' b' , ' c' , ' d' ] == @inferred getall (obj, @optic _. a |> Elements () |> Elements () |> _ + 1 )
46
46
@test [2 , 4 , 3 , 5 ] == @inferred getall (obj, @optic _. b |> Elements () |> Elements () |> _ + 1 )
47
- @test (1 , 2 , 3 ) === @inferred getall (obj, @optic _. c |> Elements () |> Elements ())
48
- @test (2 , 3 , 4 ) === @inferred getall (obj, @optic _. c |> Elements () |> Elements () |> _ + 1 )
47
+ @test (1. , 2 , 3 ) === @inferred getall (obj, @optic _. c |> Elements () |> Elements ())
48
+ @test (2. , 3 , 4 ) === @inferred getall (obj, @optic _. c |> Elements () |> Elements () |> _ + 1 )
49
49
50
50
# composition order should not matter:
51
- @test (2 , 3 , 4 ) === @inferred getall (obj, (@optic (_ + 1 ) ∘ Elements () ∘ Elements ()) ∘ @optic (_. c))
52
- @test (2 , 3 , 4 ) === @inferred getall (obj, (@optic (_ + 1 ) ∘ Elements ()) ∘ (Elements () ∘ @optic (_. c)))
53
- @test (2 , 3 , 4 ) === @inferred getall (obj, @optic (_ + 1 ) ∘ (Elements () ∘ Elements () ∘ @optic (_. c)))
51
+ @test (2. , 3 , 4 ) === @inferred getall (obj, (@optic (_ + 1 ) ∘ Elements () ∘ Elements ()) ∘ @optic (_. c))
52
+ @test (2. , 3 , 4 ) === @inferred getall (obj, (@optic (_ + 1 ) ∘ Elements ()) ∘ (Elements () ∘ @optic (_. c)))
53
+ @test (2. , 3 , 4 ) === @inferred getall (obj, @optic (_ + 1 ) ∘ (Elements () ∘ Elements () ∘ @optic (_. c)))
54
54
55
55
obj = ()
56
56
@test () === @inferred getall (obj, @optic _ |> Elements () |> _ + 1 )
118
118
@test (a= 1 , b= ((c= - 3. , d= - 4. ), (c= - 5. , d= - 6. ))) === @inferred setall (obj, @optic (_ * 3 ) ∘ (Properties () ∘ Elements () ∘ @optic (_. b)), [- 9 , - 12 , - 15 , - 18 ])
119
119
120
120
# SVectors and nested Elements:
121
- obj = (c= (SVector (1 ), SVector (2 , 3 )),)
121
+ obj = (c= (SVector (1. ), SVector (2 , 3 )),)
122
122
@test setall (obj. c[1 ], Elements (), (5 , 6 )) === SVector (5 , 6 )
123
123
@test setall (obj. c[1 ], Elements (), (5 ,)) === SVector (5 )
124
124
@test setall (obj. c[1 ], Elements (), [5 , 6 ]) === SVector (5 , 6 )
0 commit comments