File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -46,5 +46,31 @@ using StaticNumbers
4646 @test m3 === @SMatrix [1 0 ; 0 0 ]
4747end
4848
49+ function test_all_inferrable (f, argtypes)
50+ typed = first (code_typed (f, argtypes))
51+ code = typed. first
52+ @test all (T -> ! (T isa UnionAll || T === Any), code. slottypes)
53+ end
54+
55+ # Example of macro that caused inference issues before.
56+ macro test_macro (expr)
57+ quote
58+ function f ($ (esc (:x )))
59+ $ (Setfield. setmacro (identity, expr, overwrite= true ))
60+ $ (Setfield. setmacro (identity, expr, overwrite= true ))
61+ $ (Setfield. setmacro (identity, expr, overwrite= true ))
62+ $ (Setfield. setmacro (identity, expr, overwrite= true ))
63+ $ (Setfield. setmacro (identity, expr, overwrite= true ))
64+ return $ (esc (:x ))
65+ end
66+ end
67+ end
68+
69+ @testset " setmacro multiple usage" begin
70+ let f = @test_macro (x[end ] = 1 )
71+ test_all_inferrable (f, (Vector{Float64}, ))
72+ end
73+ end
74+
4975end # module
5076
You can’t perform that action at this time.
0 commit comments