From 1366501d60908bda30cd0abf1f26b2c839494b86 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 17:39:29 +0000 Subject: [PATCH 1/3] Initial plan From 247822ac93f2073ad3542f7ea45658b54cab4058 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 17:57:23 +0000 Subject: [PATCH 2/3] Conditionally use Base.JuliaSyntax on newer Julia versions Co-authored-by: ericphanson <5846501+ericphanson@users.noreply.github.com> --- src/ExplicitImports.jl | 16 +++++++++++++--- test/runtests.jl | 10 ++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/ExplicitImports.jl b/src/ExplicitImports.jl index f533fad..b8ba232 100644 --- a/src/ExplicitImports.jl +++ b/src/ExplicitImports.jl @@ -1,20 +1,30 @@ module ExplicitImports +const BASE_JULIASYNTAX_VERSION = v"1.12.0-DEV.0" +const USE_BASE_JULIASYNTAX = VERSION >= BASE_JULIASYNTAX_VERSION + #! explicit-imports: off # We vendor some dependencies to avoid compatibility problems. We tell ExplicitImports to ignore # these as we don't want it to recurse into vendored dependencies. # We also add `Vendored` to `ignore_submodules` elsewhere. module Vendored -include(joinpath("vendored", "JuliaSyntax", "src", "JuliaSyntax.jl")) +if VERSION < v"1.12.0-DEV.0" + include(joinpath("vendored", "JuliaSyntax", "src", "JuliaSyntax.jl")) +end include(joinpath("vendored", "AbstractTrees", "src", "AbstractTrees.jl")) end #! explicit-imports: on -using .Vendored.JuliaSyntax +if USE_BASE_JULIASYNTAX + import Base: JuliaSyntax +else + import .Vendored: JuliaSyntax +end +using .JuliaSyntax # suppress warning about Base.parse collision, even though parse is never used # this avoids a warning when loading the package while creating an unused explicit import # the former occurs for all users, the latter only for developers of this package -using .Vendored.JuliaSyntax: parse +using .JuliaSyntax: parse using .Vendored.AbstractTrees using .Vendored.AbstractTrees: parent diff --git a/test/runtests.jl b/test/runtests.jl index 5b26716..0c67a8e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1286,6 +1286,16 @@ include("issue_140.jl") end end + @testset "JuliaSyntax backend selection" begin + if VERSION >= ExplicitImports.BASE_JULIASYNTAX_VERSION + @test ExplicitImports.JuliaSyntax === Base.JuliaSyntax + @test !isdefined(ExplicitImports.Vendored, :JuliaSyntax) + else + @test isdefined(ExplicitImports.Vendored, :JuliaSyntax) + @test ExplicitImports.JuliaSyntax === ExplicitImports.Vendored.JuliaSyntax + end + end + @testset "backtick modules and locations" begin @testset "print_explicit_imports" begin # Test that module names and file:line locations are surrounded by backticks From d22731bc9beb0367fabbb62b72b8429eaa155246 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 18:00:00 +0000 Subject: [PATCH 3/3] Refine JuliaSyntax backend condition to reuse shared constant Co-authored-by: ericphanson <5846501+ericphanson@users.noreply.github.com> --- src/ExplicitImports.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ExplicitImports.jl b/src/ExplicitImports.jl index b8ba232..f99899b 100644 --- a/src/ExplicitImports.jl +++ b/src/ExplicitImports.jl @@ -8,7 +8,8 @@ const USE_BASE_JULIASYNTAX = VERSION >= BASE_JULIASYNTAX_VERSION # these as we don't want it to recurse into vendored dependencies. # We also add `Vendored` to `ignore_submodules` elsewhere. module Vendored -if VERSION < v"1.12.0-DEV.0" +using ..ExplicitImports: USE_BASE_JULIASYNTAX +if !USE_BASE_JULIASYNTAX include(joinpath("vendored", "JuliaSyntax", "src", "JuliaSyntax.jl")) end include(joinpath("vendored", "AbstractTrees", "src", "AbstractTrees.jl"))