@@ -17,7 +17,9 @@ function rosenbrock(x::Vector{Float64})
1717end
1818
1919x = rand (2 )
20- @inferred (overdub (RosCtx (), rosenbrock, x))
20+ if VERSION < v " 1.9"
21+ @inferred (overdub (RosCtx (), rosenbrock, x))
22+ end
2123
2224messages = String[]
2325Cassette. prehook (:: RosCtx , f, args... ) = push! (messages, string (" calling " , f, args))
@@ -79,16 +81,29 @@ empty!(pres)
7981empty! (posts)
8082
8183@overdub (ctx, Core. _apply (+ , (x1, x2), (x2 * x3, x3)))
82- @test pres == [(tuple, (x1, x2)),
83- (* , (x2, x3)),
84- (Base. mul_int, (x2, x3)),
85- (tuple, (x2* x3, x3)),
86- (+ , (x1, x2, x2* x3, x3))]
87- @test posts == [((x1, x2), tuple, (x1, x2)),
88- (Base. mul_int (x2, x3), Base. mul_int, (x2, x3)),
89- (* (x2, x3), * , (x2, x3)),
90- ((x2* x3, x3), tuple, (x2* x3, x3)),
91- (+ (x1, x2, x2* x3, x3), + , (x1, x2, x2* x3, x3))]
84+ if ! (v " 1.9" <= VERSION < v " 1.10" )
85+ @test pres == [(tuple, (x1, x2)),
86+ (* , (x2, x3)),
87+ (Base. mul_int, (x2, x3)),
88+ (tuple, (x2* x3, x3)),
89+ (+ , (x1, x2, x2* x3, x3))]
90+ @test posts == [((x1, x2), tuple, (x1, x2)),
91+ (Base. mul_int (x2, x3), Base. mul_int, (x2, x3)),
92+ (* (x2, x3), * , (x2, x3)),
93+ ((x2* x3, x3), tuple, (x2* x3, x3)),
94+ (+ (x1, x2, x2* x3, x3), + , (x1, x2, x2* x3, x3))]
95+ else
96+ @test pres == [(tuple, (x1, x2)),
97+ (* , (x2, x3)),
98+ (Base. mul_int, (x2, x3)),
99+ (tuple, (x2* x3, x3)),
100+ (Core. _apply, (+ , (x1, x2), (x2* x3, x3)))]
101+ @test posts == [((x1, x2), tuple, (x1, x2)),
102+ (Base. mul_int (x2, x3), Base. mul_int, (x2, x3)),
103+ (* (x2, x3), * , (x2, x3)),
104+ ((x2* x3, x3), tuple, (x2* x3, x3)),
105+ (+ (x1, x2, x2* x3, x3), Core. _apply, (+ , (x1, x2), (x2* x3, x3)))]
106+ end
92107
93108println (" done (took " , time () - before_time, " seconds)" )
94109
@@ -386,7 +401,10 @@ else
386401 @inferred (overdub (InferCtx (), rand, Float32, 1 ))
387402 end
388403end
389- @inferred (overdub (InferCtx (), broadcast, + , rand (1 ), rand (1 )))
404+
405+ if VERSION < v " 1.9"
406+ @inferred (overdub (InferCtx (), broadcast, + , rand (1 ), rand (1 )))
407+ end
390408@inferred (overdub (InferCtx (), () -> kwargtest (42 ; foo = 1 , bar = 2 )))
391409
392410println (" done (took " , time () - before_time, " seconds)" )
@@ -427,9 +445,11 @@ ctx = InvokeCtx(metadata=Any[])
427445@test overdub (ctx, invoker, 3 ) === 9
428446# This is kind of fragile and may break for unrelated reasons - the main thing
429447# we're testing here is that we properly trace through the `invoke` call.
430- @test ctx. metadata == Any[Core. apply_type, Core. invoke, Core. apply_type,
431- Val{2 }, Core. apply_type, Base. literal_pow, * ,
432- Base. mul_int]
448+ if VERSION < v " 1.9"
449+ @test ctx. metadata == Any[Core. apply_type, Core. invoke, Core. apply_type,
450+ Val{2 }, Core. apply_type, Base. literal_pow, * ,
451+ Base. mul_int]
452+ end
433453
434454println (" done (took " , time () - before_time, " seconds)" )
435455
0 commit comments