@@ -64,24 +64,24 @@ ir = @code_ir fact(1)
6464tr = @trace f ()
6565@test returntype (tr) == String
6666
67- tr = @trace pow (Int, 3 )
67+ tr = @trace pow (:: Int , 3 )
6868@test length (tr. blocks) == 1
6969@test returntype (tr) == Int
7070
7171tr = @trace pow (2 , 3 )
7272@test length (tr. blocks) == 1
7373@test returntype (tr) == Const (8 )
7474
75- tr = @trace pow (2 , Int)
75+ tr = @trace pow (2 , :: Int )
7676@test returntype (tr) == Int
7777
78- tr = @trace pow (2.0 , Int)
78+ tr = @trace pow (2.0 , :: Int )
7979@test returntype (tr) == Union{Float64,Int}
8080
81- tr = @trace pow (1 , Int)
81+ tr = @trace pow (1 , :: Int )
8282@test returntype (tr) == Const (1 )
8383
84- tr = @trace bar (Int, Int)
84+ tr = @trace bar (:: Int , :: Int )
8585@test returntype (tr) == Int
8686
8787function foo (x)
9393tr = @trace foo (1 )
9494@test returntype (tr) == Const (1 )
9595
96- tr = @trace foo (Int)
96+ tr = @trace foo (:: Int )
9797@test returntype (tr) == Int
9898
9999function foo (x)
142142tr = @trace pow (2 , 3 )
143143@test returntype (tr) == Const (8 )
144144
145- tr = @trace pow (Int, Int)
145+ tr = @trace pow (:: Int , :: Int )
146146@test returntype (tr) == Int
147147
148148function sumabs2 (xs)
@@ -153,14 +153,26 @@ function sumabs2(xs)
153153 return s
154154end
155155
156- tr = @trace sumabs2 (arrayshape (Float64, 3 ))
156+ tr = @trace sumabs2 (:: arrayshape (Float64, 3 ))
157157@test length (blocks (tr)) == 1
158158@test returntype (tr) == Float64
159159
160160f (xs) = sum (xs)
161- tr = @trace f (Matrix{Int32})
161+ tr = @trace f (:: Matrix{Int32} )
162162@test returntype (tr) == Int32
163163
164164f (xs) = sum (xs, dims = 1 )
165- tr = @trace f (Matrix{Int32})
165+ tr = @trace f (:: Matrix{Int32} )
166166@test returntype (tr) == Matrix{Int32}
167+
168+
169+ function negsquare (x)
170+ if x > 0
171+ return x^ 2
172+ else
173+ return - x^ 2
174+ end
175+ end
176+
177+ tr = @trace negsquare (:: Float64 )
178+ @test returntype (tr) == Float64
0 commit comments