From eee264b2f31797e43079c54b4046955c4c805d34 Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Mon, 17 Jul 2023 19:22:38 +0900 Subject: [PATCH] improve "top-level statement selection" testset --- test/toplevel/test_virtualprocess.jl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/toplevel/test_virtualprocess.jl b/test/toplevel/test_virtualprocess.jl index b5c682fe1..feb6a0e02 100644 --- a/test/toplevel/test_virtualprocess.jl +++ b/test/toplevel/test_virtualprocess.jl @@ -1680,8 +1680,7 @@ end @testset "top-level statement selection" begin # simplest example - let - # global function + let # global function vmod, res = @analyze_toplevel2 begin foo() = return # should be concretized end @@ -1709,20 +1708,28 @@ end end slice = JET.select_statements(src) + found_w = found_sum = found_product = found_write = false for (i, stmt) in enumerate(src.code) if JET.isexpr(stmt, :(=)) lhs, rhs = stmt.args if isa(lhs, Core.SlotNumber) - if src.slotnames[lhs.id] === :w || src.slotnames[lhs.id] === :sum + if src.slotnames[lhs.id] === :w + found_w = true + @test slice[i] + elseif src.slotnames[lhs.id] === :sum + found_sum = true @test slice[i] elseif src.slotnames[lhs.id] === :product + found_product = true @test !slice[i] end end elseif JET.@capture(stmt, write(x_)) + found_write = true @test !slice[i] end end + @test found_w; @test found_sum; @test found_product; @test found_write end @testset "captured variables" begin