Skip to content

Commit 0ea7485

Browse files
committed
improve typing of certain functions
1 parent f63d897 commit 0ea7485

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed

src/callbacks.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ Global variable, maps callback keys to user hooks.
3030
"""
3131
const user_callbacks_by_key = Dict{Any, Any}()
3232

33-
34-
3533
"""
3634
key = Revise.add_callback(f, files, modules=nothing; key=gensym())
3735

src/packagedef.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,13 @@ end
537537
init_watching(files) = init_watching(pkgdatas[NOPACKAGE], files)
538538

539539
"""
540-
revise_dir_queued(dirname)
540+
revise_dir_queued(dirname::AbstractString)
541541
542542
Wait for one or more of the files registered in `Revise.watched_files[dirname]` to be
543543
modified, and then queue the corresponding files on [`Revise.revision_queue`](@ref).
544544
This is generally called via a [`Revise.TaskThunk`](@ref).
545545
"""
546-
@noinline function revise_dir_queued(dirname)
546+
@noinline function revise_dir_queued(dirname::AbstractString)
547547
@assert isabspath(dirname)
548548
if !isdir(dirname)
549549
sleep(0.1) # in case git has done a delete/replace cycle

src/pkgs.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ end
390390

391391
# Much of this is adapted from base/loading.jl
392392

393-
function manifest_file(project_file)
393+
function manifest_file(project_file = Base.active_project())
394394
if project_file isa String && isfile(project_file)
395395
mfile = Base.project_file_manifest_path(project_file)
396396
if mfile isa String
@@ -399,7 +399,6 @@ function manifest_file(project_file)
399399
end
400400
return nothing
401401
end
402-
manifest_file() = manifest_file(Base.active_project())
403402

404403
function manifest_paths!(pkgpaths::Dict, manifest_file::String)
405404
d = if isdefined(Base, :get_deps) # `get_deps` is present in versions that support new manifest formats
@@ -427,7 +426,7 @@ end
427426
manifest_paths(manifest_file::String) =
428427
manifest_paths!(Dict{PkgId,String}(), manifest_file)
429428

430-
function watch_manifest(mfile)
429+
function watch_manifest(mfile::String)
431430
while true
432431
try
433432
wait_changed(mfile)

src/recipes.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end
1414

1515
const vstring = "v$(VERSION.major).$(VERSION.minor)"
1616

17-
function inpath(path, dirs)
17+
function inpath(path::AbstractString, dirs::Vector{String})
1818
spath = splitpath(path)
1919
idx = findfirst(isequal(first(dirs)), spath)
2020
idx === nothing && return false
@@ -29,15 +29,15 @@ function inpath(path, dirs)
2929
return true
3030
end
3131

32-
function _track(id, modname; modified_files=revision_queue)
32+
function _track(id::PkgId, modname::Symbol; modified_files=revision_queue)
3333
haskey(pkgdatas, id) && return nothing # already tracked
3434
isbase = modname === :Base
3535
isstdlib = !isbase && modname stdlib_names
3636
if isbase || isstdlib
3737
# Test whether we know where to find the files
3838
if isbase
3939
srcdir = fixpath(joinpath(juliadir, "base"))
40-
dirs = ["base"]
40+
dirs = String["base"]
4141
else
4242
stdlibv = joinpath("stdlib", vstring, String(modname))
4343
srcdir = fixpath(joinpath(juliadir, stdlibv))
@@ -48,7 +48,7 @@ function _track(id, modname; modified_files=revision_queue)
4848
# This can happen for Pkg, since it's developed out-of-tree
4949
srcdir = joinpath(juliadir, "usr", "share", "julia", stdlibv) # omit fixpath deliberately
5050
end
51-
dirs = ["stdlib", String(modname)]
51+
dirs = String["stdlib", String(modname)]
5252
end
5353
if !isdir(srcdir)
5454
@error "unable to find path containing source for $modname, tracking is not possible"

src/relocatable_exprs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function Base.iterate(iter::LineSkippingIterator, i=0)
7373
return (iter.args[i], i)
7474
end
7575

76-
function skip_to_nonline(args, i)
76+
function skip_to_nonline(args::Vector{Any}, i::Int)
7777
while true
7878
i > length(args) && return i
7979
ex = args[i]

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function unwrap(ex::Expr)
8787
end
8888
unwrap(rex::RelocatableExpr) = RelocatableExpr(unwrap(rex.ex))
8989

90-
istrivial(a) = a === nothing || isa(a, LineNumberNode)
90+
istrivial(@nospecialize a) = a === nothing || isa(a, LineNumberNode)
9191

9292
function unwrap_where(ex::Expr)
9393
while isexpr(ex, :where)

0 commit comments

Comments
 (0)