diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 942eba8c..bcee9167 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -22,6 +22,10 @@ jobs: - windows-latest arch: - x64 + - x86 + exclude: + - os: macOS-latest + arch: x86 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 diff --git a/.github/workflows/TypedSyntaxCI.yml b/.github/workflows/TypedSyntaxCI.yml index 59a351a3..165ba4d0 100644 --- a/.github/workflows/TypedSyntaxCI.yml +++ b/.github/workflows/TypedSyntaxCI.yml @@ -18,6 +18,7 @@ jobs: - ubuntu-latest arch: - x64 + - x86 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 diff --git a/TypedSyntax/test/runtests.jl b/TypedSyntax/test/runtests.jl index 74ffc0f5..52bf2d7e 100644 --- a/TypedSyntax/test/runtests.jl +++ b/TypedSyntax/test/runtests.jl @@ -349,7 +349,7 @@ include("test_module.jl") tsn = TypedSyntaxNode(TSN.summer_iterate, (Vector{Float64},)) @test tsn.typ == Union{Int,Float64} sig, body = children(tsn) - @test has_name_typ(child(body, 2, 1), :ret, Union{Nothing, Tuple{Float64, Int64}}) + @test has_name_typ(child(body, 2, 1), :ret, Union{Nothing, Tuple{Float64, Int}}) @test has_name_typ(child(body, 3, 2, 1, 1, 1), :x, Float64) # `where`, unnamed arguments, and types-as-arguments @@ -552,7 +552,7 @@ include("test_module.jl") @test TypedSyntax.num_positional_args(tsn) == 2 # Display - tsn = TypedSyntaxNode(TSN.mysin, (Int,)) + tsn = TypedSyntaxNode(TSN.mysin, (Int64,)) str = sprint(tsn; context=:color=>false) do io, obj printstyled(io, obj; hide_type_stable=false) end @@ -602,7 +602,7 @@ include("test_module.jl") end @test occursin("[1]\e[36m::Float32\e[39m", str) @test occursin("[2]\e[36m::Float32\e[39m", str) - tsn = TypedSyntaxNode(TSN.simplef, (Int, Float64)) + tsn = TypedSyntaxNode(TSN.simplef, (Int64, Float64)) str = sprint(tsn; context=:color=>false) do io, obj printstyled(io, obj; hide_type_stable=false) end @@ -695,32 +695,32 @@ using TypedSyntax: InlayHint, Diagnostic, InlayHintKinds @testset "test_vscode.jl" begin # VSCode - tsn = TypedSyntaxNode(TSN.fVSCode, (Int64,)) + tsn = TypedSyntaxNode(TSN.fVSCode, (Int,)) io = IOContext(devnull, :inlay_hints=>Dict{String, Vector{InlayHint}}(), :diagnostics=>Diagnostic[]) printstyled(io, tsn) - @test getproperty.(first(values(io[:inlay_hints])), :kind) == [InlayHintKinds.Nothing, InlayHintKinds.Type, InlayHintKinds.Nothing] && getproperty.(first(values(io[:inlay_hints])), :label) == ["::Union{Float64, Int64}", "(", ")::Union{Float64, Int64}"] + @test getproperty.(first(values(io[:inlay_hints])), :kind) == [InlayHintKinds.Nothing, InlayHintKinds.Type, InlayHintKinds.Nothing] && getproperty.(first(values(io[:inlay_hints])), :label) == ["::Union{Float64, $Int}", "(", ")::Union{Float64, $Int}"] @test length(io[:diagnostics]) == 2 io = IOContext(devnull, :inlay_hints=>Dict{String, Vector{InlayHint}}(), :diagnostics=>Diagnostic[]) printstyled(io, tsn; hide_type_stable=false) - @test getproperty.(first(values(io[:inlay_hints])), :kind) == vcat(InlayHintKinds.Type, InlayHintKinds.Nothing, repeat([InlayHintKinds.Type], 15), InlayHintKinds.Nothing) && getproperty.(first(values(io[:inlay_hints])), :label) == ["::Int64" - "::Union{Float64, Int64}" - "::Int64" + @test getproperty.(first(values(io[:inlay_hints])), :kind) == vcat(InlayHintKinds.Type, InlayHintKinds.Nothing, repeat([InlayHintKinds.Type], 15), InlayHintKinds.Nothing) && getproperty.(first(values(io[:inlay_hints])), :label) == ["::$Int" + "::Union{Float64, $Int}" + "::$Int" "(" - "::Int64" - ")::Int64" - "::Int64" + "::$Int" + ")::$Int" + "::$Int" "(" - "::Int64" - ")::Int64" + "::$Int" + ")::$Int" "(" - "::Int64" + "::$Int" "(" - "::Int64" + "::$Int" ")::Bool" - "::Int64" + "::$Int" "::Float64" - ")::Union{Float64, Int64}"] + ")::Union{Float64, $Int}"] @test length(io[:diagnostics]) == 2 end diff --git a/test/test_codeview_vscode.jl b/test/test_codeview_vscode.jl index c90033dd..8ef87974 100644 --- a/test/test_codeview_vscode.jl +++ b/test/test_codeview_vscode.jl @@ -36,7 +36,7 @@ include("test_vscode_example_functions.jl") fake_terminal() do term, in, out, _ t = @async begin - @test_nowarn descend(fib, (Int64,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode) + @test_nowarn descend(fib, (Int,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode) end write(in, 'q') wait(t) @@ -60,18 +60,18 @@ include("test_vscode_example_functions.jl") if !hide_type_stable && inlay_types_vscode @test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ - TypedSyntax.InlayHint(1, 14, "::Int64", 1) - TypedSyntax.InlayHint(1, 15, "::Int64", 1) + TypedSyntax.InlayHint(1, 14, "::$Int", 1) + TypedSyntax.InlayHint(1, 15, "::$Int", 1) TypedSyntax.InlayHint(3, 11, "(", 1) TypedSyntax.InlayHint(3, 15, "(", 1) - TypedSyntax.InlayHint(3, 16, "::Int64", 1) - TypedSyntax.InlayHint(3, 20, ")::Int64", 1) - TypedSyntax.InlayHint(3, 21, "::Int64", 1) + TypedSyntax.InlayHint(3, 16, "::$Int", 1) + TypedSyntax.InlayHint(3, 20, ")::$Int", 1) + TypedSyntax.InlayHint(3, 21, "::$Int", 1) TypedSyntax.InlayHint(3, 28, "(", 1) - TypedSyntax.InlayHint(3, 29, "::Int64", 1) - TypedSyntax.InlayHint(3, 33, ")::Int64", 1) - TypedSyntax.InlayHint(3, 34, "::Int64", 1) - TypedSyntax.InlayHint(3, 34, ")::Int64", 1) + TypedSyntax.InlayHint(3, 29, "::$Int", 1) + TypedSyntax.InlayHint(3, 33, ")::$Int", 1) + TypedSyntax.InlayHint(3, 34, "::$Int", 1) + TypedSyntax.InlayHint(3, 34, ")::$Int", 1) ]) elseif hide_type_stable && inlay_types_vscode @test isempty(VSCodeServer.inlay_hints[1]) @@ -85,7 +85,7 @@ include("test_vscode_example_functions.jl") fake_terminal() do term, in, out, _ t = @async begin - @test_nowarn descend(fVSCode, (Int64,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode) + @test_nowarn descend(fVSCode, (Int,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode) end write(in, 'q') wait(t) @@ -114,60 +114,60 @@ include("test_vscode_example_functions.jl") if !hide_type_stable && inlay_types_vscode if iswarn @test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ - TypedSyntax.InlayHint(7, 18, "::Int64", 1) - TypedSyntax.InlayHint(7, 19, "::Union{Float64, Int64}", nothing) - TypedSyntax.InlayHint(8, 5, "::Int64", 1) + TypedSyntax.InlayHint(7, 18, "::$Int", 1) + TypedSyntax.InlayHint(7, 19, "::Union{Float64, $Int}", nothing) + TypedSyntax.InlayHint(8, 5, "::$Int", 1) TypedSyntax.InlayHint(8, 8, "(", 1) - TypedSyntax.InlayHint(8, 9, "::Int64", 1) - TypedSyntax.InlayHint(8, 13, ")::Int64", 1) - TypedSyntax.InlayHint(9, 5, "::Int64", 1) + TypedSyntax.InlayHint(8, 9, "::$Int", 1) + TypedSyntax.InlayHint(8, 13, ")::$Int", 1) + TypedSyntax.InlayHint(9, 5, "::$Int", 1) TypedSyntax.InlayHint(9, 8, "(", 1) - TypedSyntax.InlayHint(9, 13, "::Int64", 1) - TypedSyntax.InlayHint(9, 13, ")::Int64", 1) + TypedSyntax.InlayHint(9, 13, "::$Int", 1) + TypedSyntax.InlayHint(9, 13, ")::$Int", 1) TypedSyntax.InlayHint(10, 11, "(", 1) - TypedSyntax.InlayHint(10, 12, "::Int64", 1) + TypedSyntax.InlayHint(10, 12, "::$Int", 1) TypedSyntax.InlayHint(10, 16, "(", 1) - TypedSyntax.InlayHint(10, 17, "::Int64", 1) + TypedSyntax.InlayHint(10, 17, "::$Int", 1) TypedSyntax.InlayHint(10, 21, ")::Bool", 1) - TypedSyntax.InlayHint(10, 26, "::Int64", 1) + TypedSyntax.InlayHint(10, 26, "::$Int", 1) TypedSyntax.InlayHint(10, 32, "::Float64", 1) - TypedSyntax.InlayHint(10, 33, ")::Union{Float64, Int64}", nothing) + TypedSyntax.InlayHint(10, 33, ")::Union{Float64, $Int}", nothing) ]) else @test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ - TypedSyntax.InlayHint(7, 18, "::Int64", 1) - TypedSyntax.InlayHint(7, 19, "::Union{Float64, Int64}", 1) - TypedSyntax.InlayHint(8, 5, "::Int64", 1) + TypedSyntax.InlayHint(7, 18, "::$Int", 1) + TypedSyntax.InlayHint(7, 19, "::Union{Float64, $Int}", 1) + TypedSyntax.InlayHint(8, 5, "::$Int", 1) TypedSyntax.InlayHint(8, 8, "(", 1) - TypedSyntax.InlayHint(8, 9, "::Int64", 1) - TypedSyntax.InlayHint(8, 13, ")::Int64", 1) - TypedSyntax.InlayHint(9, 5, "::Int64", 1) + TypedSyntax.InlayHint(8, 9, "::$Int", 1) + TypedSyntax.InlayHint(8, 13, ")::$Int", 1) + TypedSyntax.InlayHint(9, 5, "::$Int", 1) TypedSyntax.InlayHint(9, 8, "(", 1) - TypedSyntax.InlayHint(9, 13, "::Int64", 1) - TypedSyntax.InlayHint(9, 13, ")::Int64", 1) + TypedSyntax.InlayHint(9, 13, "::$Int", 1) + TypedSyntax.InlayHint(9, 13, ")::$Int", 1) TypedSyntax.InlayHint(10, 11, "(", 1) - TypedSyntax.InlayHint(10, 12, "::Int64", 1) + TypedSyntax.InlayHint(10, 12, "::$Int", 1) TypedSyntax.InlayHint(10, 16, "(", 1) - TypedSyntax.InlayHint(10, 17, "::Int64", 1) + TypedSyntax.InlayHint(10, 17, "::$Int", 1) TypedSyntax.InlayHint(10, 21, ")::Bool", 1) - TypedSyntax.InlayHint(10, 26, "::Int64", 1) + TypedSyntax.InlayHint(10, 26, "::$Int", 1) TypedSyntax.InlayHint(10, 32, "::Float64", 1) - TypedSyntax.InlayHint(10, 33, ")::Union{Float64, Int64}", 1) + TypedSyntax.InlayHint(10, 33, ")::Union{Float64, $Int}", 1) ]) end elseif hide_type_stable && inlay_types_vscode if iswarn @test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ - TypedSyntax.InlayHint(7, 19, "::Union{Float64, Int64}", nothing) + TypedSyntax.InlayHint(7, 19, "::Union{Float64, $Int}", nothing) TypedSyntax.InlayHint(10, 11, "(", 1) - TypedSyntax.InlayHint(10, 33, ")::Union{Float64, Int64}", nothing) + TypedSyntax.InlayHint(10, 33, ")::Union{Float64, $Int}", nothing) ]) else @test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ - TypedSyntax.InlayHint(7, 19, "::Union{Float64, Int64}", 1) + TypedSyntax.InlayHint(7, 19, "::Union{Float64, $Int}", 1) TypedSyntax.InlayHint(10, 11, "(", 1) - TypedSyntax.InlayHint(10, 33, ")::Union{Float64, Int64}", 1) + TypedSyntax.InlayHint(10, 33, ")::Union{Float64, $Int}", 1) ]) end end @@ -206,12 +206,20 @@ include("test_vscode_example_functions.jl") if !hide_type_stable && inlay_types_vscode @test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ TypedSyntax.InlayHint(14, 18, "::Float64", 1) - TypedSyntax.InlayHint(14, 19, "::Int64", 1) - TypedSyntax.InlayHint(15, 15, "::Float64", 1) - TypedSyntax.InlayHint(15, 16, "::Int64", 1) + TypedSyntax.InlayHint(14, 19, "::$Int", 1) + TypedSyntax.InlayHint(15, 11, "::Type{$Int}", 1) + TypedSyntax.InlayHint(15, 13, "::Float64", 1) + TypedSyntax.InlayHint(15, 14, "::$Int", 1) TypedSyntax.InlayHint(16, 9, "::Float64", 1) - TypedSyntax.InlayHint(16, 10, "::Int64", 1) - ]) + TypedSyntax.InlayHint(16, 10, "::$Int", 1) + ]) || equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ + TypedSyntax.InlayHint(14, 18, "::Float64", 1) + TypedSyntax.InlayHint(14, 19, "::$Int", 1) + TypedSyntax.InlayHint(15, 13, "::Float64", 1) + TypedSyntax.InlayHint(15, 14, "::$Int", 1) + TypedSyntax.InlayHint(16, 9, "::Float64", 1) + TypedSyntax.InlayHint(16, 10, "::$Int", 1) + ]) # Workaround for #530 elseif hide_type_stable && inlay_types_vscode @test isempty(VSCodeServer.inlay_hints[1]) end @@ -219,12 +227,12 @@ include("test_vscode_example_functions.jl") end for inlay_types_vscode in (true, false), diagnostics_vscode in (true, false), iswarn in (true, false), hide_type_stable in (true, false) - @testset "fibcall Int64 inlay_types_vscode=$inlay_types_vscode, diagnostics_vscode=$diagnostics_vscode, iswarn=$iswarn, hide_type_stable=$hide_type_stable" begin + @testset "fibcall Int inlay_types_vscode=$inlay_types_vscode, diagnostics_vscode=$diagnostics_vscode, iswarn=$iswarn, hide_type_stable=$hide_type_stable" begin VSCodeServer.reset_test_containers() fake_terminal() do term, in, out, _ t = @async begin - @test_nowarn descend(fibcall, (Int64,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode) + @test_nowarn descend(fibcall, (Int,); terminal=term, iswarn, hide_type_stable, inlay_types_vscode, diagnostics_vscode) end write(in, 'q') wait(t) @@ -248,25 +256,45 @@ include("test_vscode_example_functions.jl") if !hide_type_stable && inlay_types_vscode @test equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ - TypedSyntax.InlayHint(14, 18, "::Int64", 1) - TypedSyntax.InlayHint(14, 19, "::Int64", 1) - TypedSyntax.InlayHint(15, 15, "::Int64", 1) - TypedSyntax.InlayHint(15, 16, "::Int64", 1) - TypedSyntax.InlayHint(16, 9, "::Int64", 1) - TypedSyntax.InlayHint(16, 10, "::Int64", 1) - TypedSyntax.InlayHint(1, 14, "::Int64", 1) - TypedSyntax.InlayHint(1, 15, "::Int64", 1) + TypedSyntax.InlayHint(14, 18, "::$Int", 1) + TypedSyntax.InlayHint(14, 19, "::$Int", 1) + TypedSyntax.InlayHint(15, 11, "::Type{$Int}", 1) + TypedSyntax.InlayHint(15, 13, "::$Int", 1) + TypedSyntax.InlayHint(15, 14, "::$Int", 1) + TypedSyntax.InlayHint(16, 9, "::$Int", 1) + TypedSyntax.InlayHint(16, 10, "::$Int", 1) + TypedSyntax.InlayHint(1, 14, "::$Int", 1) + TypedSyntax.InlayHint(1, 15, "::$Int", 1) TypedSyntax.InlayHint(3, 11, "(", 1) TypedSyntax.InlayHint(3, 15, "(", 1) - TypedSyntax.InlayHint(3, 16, "::Int64", 1) - TypedSyntax.InlayHint(3, 20, ")::Int64", 1) - TypedSyntax.InlayHint(3, 21, "::Int64", 1) + TypedSyntax.InlayHint(3, 16, "::$Int", 1) + TypedSyntax.InlayHint(3, 20, ")::$Int", 1) + TypedSyntax.InlayHint(3, 21, "::$Int", 1) TypedSyntax.InlayHint(3, 28, "(", 1) - TypedSyntax.InlayHint(3, 29, "::Int64", 1) - TypedSyntax.InlayHint(3, 33, ")::Int64", 1) - TypedSyntax.InlayHint(3, 34, "::Int64", 1) - TypedSyntax.InlayHint(3, 34, ")::Int64", 1) - ]) + TypedSyntax.InlayHint(3, 29, "::$Int", 1) + TypedSyntax.InlayHint(3, 33, ")::$Int", 1) + TypedSyntax.InlayHint(3, 34, "::$Int", 1) + TypedSyntax.InlayHint(3, 34, ")::$Int", 1) + ]) || equal_upto_ordering(first(values(VSCodeServer.inlay_hints[1])), [ + TypedSyntax.InlayHint(14, 18, "::$Int", 1) + TypedSyntax.InlayHint(14, 19, "::$Int", 1) + TypedSyntax.InlayHint(15, 13, "::$Int", 1) + TypedSyntax.InlayHint(15, 14, "::$Int", 1) + TypedSyntax.InlayHint(16, 9, "::$Int", 1) + TypedSyntax.InlayHint(16, 10, "::$Int", 1) + TypedSyntax.InlayHint(1, 14, "::$Int", 1) + TypedSyntax.InlayHint(1, 15, "::$Int", 1) + TypedSyntax.InlayHint(3, 11, "(", 1) + TypedSyntax.InlayHint(3, 15, "(", 1) + TypedSyntax.InlayHint(3, 16, "::$Int", 1) + TypedSyntax.InlayHint(3, 20, ")::$Int", 1) + TypedSyntax.InlayHint(3, 21, "::$Int", 1) + TypedSyntax.InlayHint(3, 28, "(", 1) + TypedSyntax.InlayHint(3, 29, "::$Int", 1) + TypedSyntax.InlayHint(3, 33, ")::$Int", 1) + TypedSyntax.InlayHint(3, 34, "::$Int", 1) + TypedSyntax.InlayHint(3, 34, ")::$Int", 1) + ]) # Workaround for #530 elseif hide_type_stable && inlay_types_vscode @test isempty(VSCodeServer.inlay_hints[1]) end @@ -274,4 +302,4 @@ include("test_vscode_example_functions.jl") end end -end \ No newline at end of file +end diff --git a/test/test_vscode_example_functions.jl b/test/test_vscode_example_functions.jl index 8de22280..8728ed8a 100644 --- a/test/test_vscode_example_functions.jl +++ b/test/test_vscode_example_functions.jl @@ -13,6 +13,6 @@ end # exact location in file matters function fibcall(n) - fib(Int64(n)) + fib(Int(n)) fib(n) end \ No newline at end of file