Skip to content

Commit 60fea81

Browse files
committed
.
1 parent 97a43ca commit 60fea81

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ TestEnv = "1e6cf692-eddd-4d53-88a5-2d735e33781b"
1515

1616
[compat]
1717
Dates = "1"
18-
JuliaSyntax = "1"
18+
JuliaSyntax = "0.4, 1"
1919
Logging = "1"
2020
Pkg = "1"
2121
Profile = "1"

src/ReTestItems.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ end
866866

867867
# Parses and evals files found by the `walkdir_task`. During macro expansion of `@testitem`
868868
# test items are push!d onto the FileNode stored in task local storage as `:__RE_TEST_ITEMS__`.
869-
function include_task(walkdir_channel, setup_channel, project_root, ti_filter)
869+
function include_task(walkdir_channel, setup_channel, project_root, ti_filter::TestItemFilter)
870870
try
871871
testitem_names = Set{String}() # to enforce that names in the same file are unique
872872
task_local_storage(:__RE_TEST_RUNNING__, true) do

src/include_test_file.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using JuliaSyntax: ParseStream, @K_str, build_tree, bump_trivia, kind, parse!, peek_full_token, peek_token
22
using StringViews
33

4-
function include_test_file(ti_filter, path::String)
4+
function include_test_file(ti_filter::TestItemFilter, path::String)
55
bytes = read(path)
66
stream = ParseStream(bytes)
77
tls = task_local_storage()
@@ -43,22 +43,22 @@ function _eval_from_stream(stream, path)
4343
end
4444

4545
# test_rel -> apply ti_filter on the parsed ast
46-
function _eval_from_stream(stream, path, ti_filter)
46+
function _eval_from_stream(stream, path, ti_filter::TestItemFilter)
4747
parse!(stream; rule=:statement)
4848
ast = build_tree(Expr, stream; filename=path)
49-
filtered = ti_filter(ast)
50-
filtered === nothing || Core.eval(Main, filtered)
49+
filtered = ti_filter(ast)::Union{Nothing, Expr}
50+
filtered === nothing || Core.eval(Main, filtered::Expr)
5151
return nothing
5252
end
5353

5454
# like above, but tries to avoid parsing the ast if it sees from the name identifier token
5555
# it won't pass the filter
56-
function _eval_from_stream(stream, path, ti_filter, bytes)
56+
function _eval_from_stream(stream, path, ti_filter::TestItemFilter, bytes)
5757
if ti_filter.name isa Nothing
5858
parse!(stream; rule=:statement)
5959
ast = build_tree(Expr, stream; filename=path)
60-
filtered = ti_filter(ast)
61-
filtered === nothing || Core.eval(Main, filtered)
60+
filtered = ti_filter(ast)::Union{Nothing, Expr}
61+
filtered === nothing || Core.eval(Main, filtered::Expr)
6262
return nothing
6363
end
6464

@@ -67,8 +67,8 @@ function _eval_from_stream(stream, path, ti_filter, bytes)
6767
parse!(stream; rule=:statement)
6868
if _contains(name, ti_filter.name)
6969
ast = build_tree(Expr, stream; filename=path)
70-
filtered = ti_filter(ast)
71-
filtered === nothing || Core.eval(Main, filtered)
70+
filtered = ti_filter(ast)::Union{Nothing, Expr}
71+
filtered === nothing || Core.eval(Main, filtered::Expr)
7272
end
7373
return nothing
7474
end

0 commit comments

Comments
 (0)