Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2767,8 +2767,8 @@ function evalfile(path::AbstractString, args::Vector{String}=String[])
Expr(:toplevel,
:(const ARGS = $args),
:(eval(x) = $(Expr(:core, :eval))(__anon__, x)),
:(include(x) = $(Expr(:top, :include))(__anon__, x)),
:(include(mapexpr::Function, x) = $(Expr(:top, :include))(mapexpr, __anon__, x)),
:(include(x::AbstractString) = $(Expr(:top, :include))(__anon__, x)),
:(include(mapexpr::Function, x::AbstractString) = $(Expr(:top, :include))(mapexpr, __anon__, x)),
:(include($path))))
end
evalfile(path::AbstractString, args::Vector) = evalfile(path, String[args...])
Expand Down
4 changes: 2 additions & 2 deletions src/jlfrontend.scm
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@
(block
,@loc
(call (core eval) ,name ,x)))
(= (call include ,x)
(= (call include (:: ,x (top AbstractString)))
(block
,@loc
(call (core _call_latest) (top include) ,name ,x)))
(= (call include (:: ,mex (top Function)) ,x)
(= (call include (:: ,mex (top Function)) (:: ,x (top AbstractString)))
(block
,@loc
(call (core _call_latest) (top include) ,mex ,name ,x)))))
Expand Down
11 changes: 11 additions & 0 deletions test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,17 @@ import .Foo28190.Libdl; import Libdl
end
end

@testset "`::AbstractString` constraint on the path argument to `include`" begin
for m ∈ (NotPkgModule, evalfile("testhelpers/just_module.jl"))
let i = m.include
@test !applicable(i, (nothing,))
@test !applicable(i, (identity, nothing,))
@test !hasmethod(i, Tuple{Nothing})
@test !hasmethod(i, Tuple{Function,Nothing})
end
end
end

@testset "`Base.project_names` and friends" begin
# Some functions in Pkg assumes that these tuples have the same length
n = length(Base.project_names)
Expand Down
1 change: 1 addition & 0 deletions test/testhelpers/just_module.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@__MODULE__