juliacomputing / deprecations.jl Goto Github PK
View Code? Open in Web Editor NEWA database of julia deprecations and how to fix them
License: Other
A database of julia deprecations and how to fix them
License: Other
-lower(mod, arg) = VERSION < v"0.7-" ? expand(arg) : Meta.lower(mod, arg)
+lower(mod, arg) = false ? expand(arg) : Meta.lower(mod, arg)
E.g.
import Base: eps
a bunch of functions got keyword arguments instead of positional arguments
In file /tmp/tmpH3kn24/src/intervals/rounding_macros.jl starting at line 49:
macro round(ex1, ex2)
I am defining a macro @round
, so the deprecation for the function round
is not relevant.
It would be good to catch the low-hanging fruit on fixing for the logging changes.
Just getting the single argument forms of info
, and warn
would presumably catch 90% of all uses.
Slack-dump for context:
Lyndon White [6:35 PM]
Does Femto cleaner not dowarn(foo)
-->@warn(foo)
?Fredrik Ekre [6:36 PM]
NoLyndon White [6:36 PM]
Should I open an issue on Deprecations.jl?Fredrik Ekre [6:37 PM]
I am not sure the transformation is always possible thoughLyndon White [6:38 PM]
You are probably right, (though idk why) that issue is listed as a breaking change so the deprecation mustn't always workFredrik Ekre [6:39 PM]
warn
takes several arguments for exampleLyndon White [6:39 PM]
It might still be better to have Femtocleaner fix it, since presumably 90% of the time it does work?
Maybe making it fix it in the simplest caseFredrik Ekre [6:39 PM]
Yea
warn("foo")
->@warn("foo")
for example
-(::Type{<: JLArray{T}})(x::AbstractArray) where T = JLArray(convert(Array{T}, x), size(x))
+<: JLArray{T}(x::AbstractArray) where T = JLArray(convert(Array{T}, x), size(x))
While trying to clean Documenter.jl
BoundsError: attempt to access 0-element Array{Any,1} at index [1]
Stacktrace:
[1] getindex(::Array{Any,1}, ::Int64) at ./array.jl:549
[2] getindex(::Deprecations.CSTUtils.OverlayNode{CSTParser.TupleH}, ::Int64) at /opt/pkgs/v0.6/Deprecations/src/CSTUtils/treewalking.jl:46
[3] match_parameters(::Deprecations.CSTUtils.OverlayNode{CSTParser.TupleH}, ::Deprecations.CSTUtils.OverlayNode{CSTParser.TupleH}, ::Dict{Any,Any}) at /opt/pkgs/v0.6/Deprecations/src/astmatching.jl:66
[4] (::Deprecations.#find_replacements#89)(::Deprecations.CSTUtils.OverlayNode{CSTParser.TupleH}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:144
[5] (::Deprecations.#find_replacements#89)(::Deprecations.CSTUtils.OverlayNode{CSTParser.Do}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:185 (repeats 2 times)
[6] (::Deprecations.#find_replacements#89)(::Deprecations.CSTUtils.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:140
[7] #text_replacements#86(::Void, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:189
[8] #collect_deprecation_annotations#10(::Bool, ::Function, ::GitHub.GitHubWebAPI, ::Base.LibGit2.GitRepo, ::String, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:187
[9] (::FemtoCleaner.##57#63{GitHub.GitHubWebAPI})(::Tuple{Base.LibGit2.GitRepo,String}) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:356
[10] with_cloned_repo(::FemtoCleaner.##57#63{GitHub.GitHubWebAPI}, ::GitHub.GitHubWebAPI, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:25
[11] event_callback(::GitHub.GitHubWebAPI, ::String, ::MbedTLS.PKContext, ::Int64, ::Int64, ::Base.LibGit2.Signature, ::GitHub.EventListener, ::String, ::GitHub.WebhookEvent) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:353
[12] #handle_event_request#169(::GitHub.AnonymousAuth, ::String, ::Void, ::Void, ::Void, ::Function, ::HTTP.Messages.Request, ::FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}) at /opt/pkgs/v0.6/GitHub/src/activity/events.jl:112
[13] (::GitHub.#kw##handle_event_request)(::Array{Any,1}, ::GitHub.#handle_event_request, ::HTTP.Messages.Request, ::Function) at ./<missing>:0
[14] handle_request(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:525
[15] handle_stream(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:501
[16] (::HTTP.Servers.##54#55{GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}},HTTP.ConnectionPool.Transaction{TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}})() at ./task.jl:335
E.g. eps
wasn't picked up in
@pure function Rational{T}(x::AbstractIrrational) where T<:Integer
o = precision(BigFloat)
p = 256
while true
setprecision(BigFloat, p)
bx = BigFloat(x)
r = rationalize(T, bx, tol=0)
if abs(BigFloat(r) - bx) > eps(bx)
setprecision(BigFloat, o)
return r
end
p += 32
end
end
Consider the following diff, generated by Deprecations current master (as of this writing):
-immutable PkgMeta
+struct PkgMeta
name::Compat.UTF8String
url::Compat.UTF8String
versions::Vector{PkgMetaVersion}
@@ -93,7 +93,7 @@ function get_pkg(pkg_name::AbstractString;
ver_path = joinpath(vers_path, dir)
sha = strip(readstring(joinpath(ver_path,"sha1")))
req_path = joinpath(ver_path,"requires")
- reqs = Compat.UTF8String[]
+ reqs = String[]
Notice that in the type definition, the field name
is declared as ::Compat.UTF8String
, but this is left untouched. But at the bottom of the diff, when Compat.UTF8String
is used in a typed empty array literal, it gets properly changed to String
.
e.g.
Core.eval(mod, :(const $(TEMP_SYM) = $(Dict{Symbol, Vector}())))
julia> Deprecations.edit_text("""
if VERSION < v"0.1.0"
foo() = 1
else
# comment
foo() = 2
end
""")
(true, "foo() = 2\n")
I believe the # comment
comment should be preserved?
My instances of parse(Int, somestring)
were replaced with Meta.parse(Int, somestring)
.
I guess this is due to this replacement: https://github.com/JuliaComputing/Deprecations.jl/blob/master/src/database/simple.jl#L391.
But my understanding is that the parse
method should not change in this case.
In https://github.com/JuliaDiffEq/DiffEqBase.jl
- if VERSION < v"0.6-" && length(tmp) == 3
- # Work around bug
+ if # Work around bug
E.g.
@eval const $s1=$t1
I tried to use FemtoCleaner locally on 0.6.3 (as I could not get it to work on 0.7 alpha).
It is not clear to me which version of AbstractTrees, CSTParser and Deprecations I should use for that.
Currently, I fail due to Deprecations not compiling (I installed AbstractTrees v0.1.0 which does not seem to work).
Is there any way I can get this working.
using FemtoCleaner
INFO: Precompiling module CSTParser.
ERROR: LoadError: LoadError: LoadError: UndefVarError: prevsibling not defined
Stacktrace:
[1] include_from_node1(::String) at .\loading.jl:576
[2] include(::String) at .\sysimg.jl:14
[3] include_from_node1(::String) at .\loading.jl:576
[4] eval(::Module, ::Any) at .\boot.jl:235
[5] _require(::Symbol) at .\loading.jl:490
[6] require(::Symbol) at .\loading.jl:405
[7] include_from_node1(::String) at .\loading.jl:576
[8] eval(::Module, ::Any) at .\boot.jl:235
[9] _require(::Symbol) at .\loading.jl:490
[10] require(::Symbol) at .\loading.jl:405
while loading C:\Users\bernhard.konig\.julia\v0.6\Deprecations\src\astmatching.jl, in expression starting on line 116
while loading C:\Users\bernhard.konig\.julia\v0.6\Deprecations\src\Deprecations.jl, in expression starting on line 27
while loading C:\Users\bernhard.konig\.julia\v0.6\FemtoCleaner\src\FemtoCleaner.jl, in expression starting on line 9
-if isdefined(Base, :airyai) && VERSION < v"0.7.0-DEV.986" #22763
- import Base: airyai, airyaix, airyaiprime, airyaiprimex,
+if isdefined(Base, :airyai) && import Base: airyai, airyaix, airyaiprime, airyaiprimex,
As noted by @ViralBShah in https://github.com/ViralBShah/SpecFun.jl/pull/4
Vector{}
Vector{Int}(0)
-> Vector{Int}()
.We filter only one. We should filter both.
We have this for using
. Add it for import
.
The fixes here are wrong: maleadt/LLVM.jl@c393eb2
WARNING: Exception thrown when fixing file gpuarray_interface.jl. Exception was:
BoundsError
Stacktrace:
[1] indexed_next(::Bool, ::Int64, ::Bool) at ./tuple.jl:56
[2] reassemble_tree(::Deprecations.CSTUtils.OverlayNode{CSTParser.Block}, ::Dict{Any,Any}, ::Deprecations.ChildReplacementNode) at /opt/pkgs/v0.6/Deprecations/src/astmatching.jl:251
[3] reassemble_tree(::Deprecations.CSTUtils.OverlayNode{CSTParser.Struct}, ::Dict{Any,Any}, ::Void) at /opt/pkgs/v0.6/Deprecations/src/astmatching.jl:244
[4] (::Deprecations.#find_replacements#99)(::Deprecations.CSTUtils.OverlayNode{CSTParser.Struct}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:146
[5] (::Deprecations.#find_replacements#99)(::Deprecations.CSTUtils.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:185
[6] (::Deprecations.#find_replacements#99)(::Deprecations.CSTUtils.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:140
[7] #text_replacements#96(::Tuple{Deprecations.CSTAnalyzer.State{Deprecations.CSTAnalyzer.FileSystem},Deprecations.CSTAnalyzer.Scope}, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:189
[8] (::Deprecations.#kw##text_replacements)(::Array{Any,1}, ::Deprecations.#text_replacements, ::String, ::Array{Any,1}) at ./<missing>:0
[9] #edit_text#100(::Array{Any,1}, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:194
[10] (::Deprecations.#kw##edit_text)(::Array{Any,1}, ::Deprecations.#edit_text, ::String, ::Array{Any,1}) at ./<missing>:0
[11] #edit_file#105(::Array{Any,1}, ::Function, ::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:199
[12] (::Deprecations.#kw##edit_file)(::Array{Any,1}, ::Deprecations.#edit_file, ::String, ::Array{Any,1}, ::Function) at ./<missing>:0
[13] #process_deprecations#6(::Bool, ::Function, ::Base.LibGit2.GitRepo, ::String) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:80
[14] (::FemtoCleaner.#kw##process_deprecations)(::Array{Any,1}, ::FemtoCleaner.#process_deprecations, ::Base.LibGit2.GitRepo, ::String) at ./<missing>:0
[15] #apply_deprecations#11(::Int64, ::Function, ::GitHub.GitHubWebAPI, ::Base.LibGit2.GitRepo, ::String, ::Base.LibGit2.Signature, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:215
[16] apply_deprecations_if_updated(::GitHub.GitHubWebAPI, ::Base.LibGit2.GitRepo, ::String, ::String, ::String, ::Base.LibGit2.Signature, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:282
[17] with_cloned_repo(::FemtoCleaner.##59#65{GitHub.GitHubWebAPI,Base.LibGit2.Signature,GitHub.WebhookEvent}, ::GitHub.GitHubWebAPI, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:25
[18] event_callback(::GitHub.GitHubWebAPI, ::String, ::MbedTLS.PKContext, ::Int64, ::Int64, ::Base.LibGit2.Signature, ::GitHub.EventListener, ::String, ::GitHub.WebhookEvent) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:444
[19] #handle_event_request#169(::GitHub.AnonymousAuth, ::String, ::Void, ::Void, ::Void, ::Function, ::HTTP.Messages.Request, ::FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}) at /opt/pkgs/v0.6/GitHub/src/activity/events.jl:112
[20] (::GitHub.#kw##handle_event_request)(::Array{Any,1}, ::GitHub.#handle_event_request, ::HTTP.Messages.Request, ::Function) at ./<missing>:0
[21] handle_request(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:525
[22] handle_stream(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:501
[23] (::HTTP.Servers.##54#55{GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##67#68{MbedTLS.PKContext,Int64,Int64,String}},HTTP.ConnectionPool.Transaction{TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}})() at ./task.jl:335
I am just writing this down, I think it is maybe not a good use of anyones time to implement it.
But I want it down for my thought process.
For all of the below, assume T != Void
(for T=Void
it is likely better to fix by hand)
Nulltable{T}
--> Union{Nothing, T}
get(x)
with x::Nullable
(knowing type required) --> x
get(null)
throws), but generally usefulisnull(x)
--> x==nothing
e.g.
import Compat: replace, popfirst!, @error, @info, occursin
Omitting a space between the condition and the question mark in ternaries is deprecated as of JuliaLang/julia#22523 (0.7.0-DEV.797). Further, as of JuliaLang/julia#22712 (0.7.0-DEV.1004), omitting spaces on either side of ?
and :
is deprecated in ternaries. It would be great if this was something that could be recognized and handled appropriately.
Reorders the vectors of a generalized Schur decomposition. `select` specifies
the eigenvalues in each cluster.
"""
-tgsen!(select::AbstractVector{BlasInt}, S::AbstractMatrix, T::AbstractMatrix, Q::AbstractMatrix, Z::AbstractMatrix)
+tgsen!(partialsort::AbstractVector{BlasInt}, S::AbstractMatrix, T::AbstractMatrix, Q::AbstractMatrix, Z::AbstractMatrix)
julia> Deprecations.edit_text("""
function foo{T}(::T)::Array{T}
return T[]
end
""")
(false, "function foo{T}(::T)::Array{T}\n return T[]\nend\n")
round(5.55, 2)
is changed to round(5.55, digits=2)
, which is correct.
But round(Int, 5.55)
is also changed to round(Int, digits=5.55)
, which is not correct.
Hope this helps!
Will keep adding to this:
Ptr{Void} -> Ptr{Cvoid}
Void
-> Nothing
unshift!
-> pushfirst!
, shift!
-> popfirst!
CartesianRange
-> CartesianIndices
sub2ind
-> CartesianIndices
, ind2sub
-> LinearIndices
JULIA_HOME
-> Sys.BINDIR
ipermute!
-> invpermute!
spones(A)
-> fillstored!(copy(A), 1)
info, warn
to macro versions (might be a bit tricky).Display
-> AbstractDisplay
linspace(a, b)
-> linspace(a, b, 50)
, logspace(a, b)
-> logspace(a, b, 50)
.(x...)
-> (x...,)
strwidth
, charwidth
-> textwidth
Array{T, N}(m::Int, ...::Int)
-> Array{T, N}(uninitialized, m, ...)
logm
-> log
, expm
-> exp
, sqrtm
-> sqrt
union()
-> Set()
.A_mul_B!
-> mul!
and coisleaftype
-> isconcretetype
JuliaLang/julia#25496isabstract
-> isabstracttype
JuliaLang/julia#25496doc" "
-> @doc doc""
iteratorsize
-> IteratorSize
digits
keyword argument to round
.parse
-> Meta.parse
prod
, sum
needs to take dims
keywordlinspace
to range
with keyword argumentseval
-> Core.evalatan2
-> atan
Compat.@__MODULE__
-> @__MODULE__
parse(Int, s, b)
-> parse(Int, s, base=b)
.is_unix
-> Sys.isunix
Some of these might be unsafe to do without semantic analysis. Look into using https://github.com/ZacLN/StaticLint.jl and see how well it can be used to figure out where the binding originate from.
Such that e.g. the following would get changed in an md doc:
Base.typemin
Base.typemax
Base.realmin
Base.realmax
Base.maxintfloat
Base.ulp(::Type{<:AbstractFloat})
Base.ulp(::AbstractFloat)
Base.instances
See JuliaText/NameToGender.jl@828c066
I had a constant at top-level within my module and Femtocleaner suggested removing it.
Probably related to
5f7c6dd
for
JuliaComputing/FemtoCleaner.jl#91
E.g. VERSION >= v"0.4.0-dev+6641" && __precompile__()
was not removed in JuliaCollections/AbstractTrees.jl#16
In file /tmp/tmpH3kn24/src/intervals/functions.jl starting at line 152:
isinteger(r) && return atomic(Interval{T}, a^round(S,r))
It would have been useful to be told that the problem was the round
function, and preferably what the new syntax was.
i.e., fix this
ArgumentError("stream is closed or WARNING: Iterations did not converge for file io.jl
WARNING: Iterations did not converge for file regex.jl
WARNING: Iterations did not converge for file util.jl
ARNING: Exception thrown when fixing file basic.jl. Exception was:
UnicodeError: invalid character index 1 (0x80 is a continuation byte)
Stacktrace:
[1] getindex(::String, ::UnitRange{Int64}) at ./strings/string.jl:239
[2] parse_string_or_cmd(::CSTParser.ParseState, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/components/strings.jl:89
[3] parse_string_or_cmd(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/strings.jl:25
[4] CSTParser.LITERAL(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/spec.jl:83
[5] INSTANCE(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/spec.jl:156
[6] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:68
[7] macro expansion at /opt/pkgs/v0.6/CSTParser/src/components/functions.jl:119 [inlined]
[8] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
[9] parse_comma_sep(::CSTParser.ParseState, ::Array{Any,1}, ::Bool, ::Bool, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/components/functions.jl:116
[10] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
[11] parse_paren(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:257
[12] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
[13] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:59
[14] macro expansion at /opt/pkgs/v0.6/CSTParser/src/components/functions.jl:119 [inlined]
[15] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
[16] parse_comma_sep(::CSTParser.ParseState, ::Array{Any,1}, ::Bool, ::Bool, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/components/functions.jl:116
[17] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
[18] parse_paren(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:257
[19] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
[20] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:59
[21] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:85 [inlined]
[22] parse_comp_operator(::CSTParser.ParseState, ::Any, ::CSTParser.OPERATOR) at /opt/pkgs/v0.6/CSTParser/src/components/operators.jl:218
[23] parse_operator(::CSTParser.ParseState, ::Any, ::CSTParser.OPERATOR) at /opt/pkgs/v0.6/CSTParser/src/components/operators.jl:377
[24] parse_compound(::CSTParser.ParseState, ::Any) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:198
[25] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
[26] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:89
[27] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
[28] parse_ranges(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/loops.jl:13
[29] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:166 [inlined]
[30] parse_for(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/loops.jl:3
[31] parse_kw(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:110
[32] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
[33] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:57
[34] parse_doc(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:304
[35] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
[36] parse_block(::CSTParser.ParseState, ::Array{Any,1}, ::Tuple{Tokenize.Tokens.Kind}, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/components/genericblocks.jl:38
[37] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:166 [inlined]
[38] parse_begin(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/genericblocks.jl:4
[39] parse_kw(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:106
[40] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
[41] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:57
[42] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:54 [inlined]
[43] macro expansion at /opt/pkgs/v0.6/CSTParser/src/components/macros.jl:48 [inlined]
[44] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:166 [inlined]
[45] parse_macrocall(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/components/macros.jl:47
[46] macro expansion at /opt/pkgs/v0.6/CSTParser/src/utils.jl:179 [inlined]
[47] parse_expression(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:74
[48] parse_doc(::CSTParser.ParseState) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:304
[49] parse(::CSTParser.ParseState, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:325
[50] parse(::String, ::Bool) at /opt/pkgs/v0.6/CSTParser/src/CSTParser.jl:277
[51] overlay_parse at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:87 [inlined] (repeats 2 times)
[52] edit_text(::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:117
[53] edit_file(::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:172
[54] #process_deprecations#6(::Bool, ::Function, ::Base.LibGit2.GitRepo, ::String) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:64
[55] (::FemtoCleaner.#kw##process_deprecations)(::Array{Any,1}, ::FemtoCleaner.#process_deprecations, ::Base.LibGit2.GitRepo, ::String) at ./<missing>:0
[56] #apply_deprecations#8(::Int64, ::Function, ::GitHub.GitHubWebAPI, ::Base.LibGit2.GitRepo, ::String, ::Base.LibGit2.Signature, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:95
[57] with_cloned_repo(::FemtoCleaner.##53#57{GitHub.GitHubWebAPI,Base.LibGit2.Signature}, ::GitHub.GitHubWebAPI, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:23
[58] event_callback(::GitHub.GitHubWebAPI, ::String, ::MbedTLS.PKContext, ::Int64, ::Int64, ::Base.LibGit2.Signature, ::GitHub.EventListener, ::String, ::GitHub.WebhookEvent) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:221
[59] #handle_event_request#169(::GitHub.AnonymousAuth, ::String, ::Void, ::Void, ::Void, ::Function, ::HTTP.Messages.Request, ::FemtoCleaner.##60#61{MbedTLS.PKContext,Int64,Int64,String}) at /opt/pkgs/v0.6/GitHub/src/activity/events.jl:112
[60] (::GitHub.#kw##handle_event_request)(::Array{Any,1}, ::GitHub.#handle_event_request, ::HTTP.Messages.Request, ::Function) at ./<missing>:0
[61] handle_request(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##60#61{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:498
[62] handle_stream(::GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##60#61{MbedTLS.PKContext,Int64,Int64,String}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}) at /opt/pkgs/v0.6/HTTP/src/Servers.jl:474
[63] (::HTTP.Servers.##54#55{GitHub.##166#168{GitHub.AnonymousAuth,String,Void,FemtoCleaner.##60#61{MbedTLS.PKContext,Int64,Int64,String}},HTTP.ConnectionPool.Transaction{TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{TCPSocket}}})() at ./task.jl:335
I noticed that femtocleaner ignored ReverseDiffSparse, so I tried to run this myself. From inside ReverseDiffSparse/src
, I get:
julia> Deprecations.edit_file("forward.jl")
ERROR: UnicodeError: invalid character index
Stacktrace:
[1] slow_utf8_next(::Ptr{UInt8}, ::UInt8, ::Int64, ::Int64) at ./strings/string.jl:172
[2] next at ./strings/string.jl:204 [inlined]
[3] getindex(::String, ::Int64) at ./strings/basic.jl:32
[4] findprev(::Deprecations.##3#4, ::String, ::Int64) at ./array.jl:1466
[5] line_pos at /home/mlubin/.julia/v0.6/Deprecations/src/formatting.jl:40 [inlined]
[6] rewrite_param_syntax(::Deprecations.OverlayNode{CSTParser.FunctionDef}, ::Array{Deprecations.TextReplacement,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/database/parametric.jl:189
[7] (::Deprecations.##24#28)(::Tuple{Deprecations.OldParametricSyntax,Deprecations.OverlayNode{CSTParser.FunctionDef},Array{Deprecations.TextReplacement,1},Deprecations.Context}) at /home/mlubin/.julia/v0.6/Deprecations/src/database/parametric.jl:212
[8] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FunctionDef}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:133
[9] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:162
[10] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:119
[11] edit_text(::String, ::Array{Any,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:166
[12] edit_file(::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:172
[13] edit_file(::String) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:171
julia> Deprecations.edit_file("reverse.jl")
ERROR: UnicodeError: invalid character index
Stacktrace:
[1] slow_utf8_next(::Ptr{UInt8}, ::UInt8, ::Int64, ::Int64) at ./strings/string.jl:172
[2] next at ./strings/string.jl:204 [inlined]
[3] getindex(::String, ::Int64) at ./strings/basic.jl:32
[4] findprev(::Deprecations.##3#4, ::String, ::Int64) at ./array.jl:1466
[5] line_pos at /home/mlubin/.julia/v0.6/Deprecations/src/formatting.jl:40 [inlined]
[6] rewrite_param_syntax(::Deprecations.OverlayNode{CSTParser.FunctionDef}, ::Array{Deprecations.TextReplacement,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/database/parametric.jl:189
[7] (::Deprecations.##24#28)(::Tuple{Deprecations.OldParametricSyntax,Deprecations.OverlayNode{CSTParser.FunctionDef},Array{Deprecations.TextReplacement,1},Deprecations.Context}) at /home/mlubin/.julia/v0.6/Deprecations/src/database/parametric.jl:212
[8] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FunctionDef}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:133
[9] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:162
[10] (::Deprecations.#find_replacements#76{Array{Any,1}})(::Deprecations.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:119
[11] edit_text(::String, ::Array{Any,1}) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:166
[12] edit_file(::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:172
[13] edit_file(::String) at /home/mlubin/.julia/v0.6/Deprecations/src/Deprecations.jl:171
Compat.Random
should be just Random
, just like Compat.Test
is changed to Test
.
(Relevant version: https://github.com/JuliaLang/Compat.jl/blob/416ea4b80dc8baac4d94bff8e4792b4748193d3f/src/Compat.jl#L812)
Trying to do the ismatch(reg, str)
-> contains(str, reg)
deprecations I am having some troubles:
Using
match(IsMatchRegex,
"ismatch(\$r,\$s)",
"contains(\$s!, \$r!)",
)
I get:
ismatch(a, b)
-> ismatch( a,b)
. I would have assumed that the !
would strip the initial and trailing whitespace from the matched expression and use the whitespace I put in for the replacement. Is there another way to do what I want?
For my packages, I've been using the convention that the where
keyword is always accompanied by curlies. Thus:
# yes
function foo(x::T) where {T<:Int}
end
# no
function foo(x::T) where T<:Int
end
To get a second opinion I looked in Base
with some rough grepping. The results are, unfortunately, inconclusive, but slightly prefer including the curlies:
# Without curiles
~/src/julia-git/base$ grep '\<where\> *[^ {][^`,}]*.*$' $(find -name \*.jl) | wc -l
942 # a little inflated by false positives due to docs
# With curlies
~/src/julia-git/base$ grep '\<where\> *{[^ {][^`,}]*}.*$' $(find -name \*.jl) | wc -l
1123
Should Deprecations be updated to always produce curlies for consistency? This might be a contentious issue, but I thought I'd ask :-)
For string:
function f()
if VERSION < v"0.6.0-dev.2840"
print("Hello")
end
if VERSION < v"0.7.0-DEV.880"
print("World")
end
end
produces:
function f()
if VERSION < v"0.7.0-DEV.880"
print("World")
end
end
First if
statement is not correctly indented.
julia> struct S{T}
foo
S(v::Vector{T}) = 42
end
WARNING: deprecated syntax "inner constructor S(...) around REPL[6]:3".
Use "S{T}(...) where T" instead.
julia> edit_text("""
struct S{T}
foo
S(v::Vector{T}) = 42
end
"""
)
(false, "struct S{T}\n foo\n S(v::Vector{T}) = 42\nend\n")
It seems that the atan2
-> atan
deprecation was not picked up.
- tmp = f.(tmp...)
+ tmp = f.(tmp...,)
For example here https://github.com/JuliaDocs/Documenter.jl/blob/916386343a54b8041078bb0bfcf83d213ed6f4f7/src/Writers/HTMLWriter.jl#L316 we get
a number of identifiers were renamed
In file /tmp/tmpbqwXRj/src/Writers/HTMLWriter.jl starting at line 316:
@tags a form h1 img input nav div select option
and in the same function https://github.com/JuliaDocs/Documenter.jl/blob/916386343a54b8041078bb0bfcf83d213ed6f4f7/src/Writers/HTMLWriter.jl#L333 we get
a number of identifiers were renamed
In file /tmp/tmpbqwXRj/src/Writers/HTMLWriter.jl starting at line 333:
let version_selector = select["#version-selector", :onChange => "window.location.href=this.value"]()
type MissingBinding has no field t
Stacktrace:
[1] filter_not_likely_type(::Tuple{Deprecations.CSTAnalyzer.State{Deprecations.CSTAnalyzer.FileSystem},Deprecations.CSTAnalyzer.Scope}, ::Deprecations.KeywordsUnlocked, ::Deprecations.CSTUtils.OverlayNode{CSTParser.Call}, ::Dict{Any,Any}) at /opt/pkgs/v0.6/Deprecations/src/database/simple.jl:438
[2] (::Deprecations.##74#76)(::Tuple{Deprecations.CSTAnalyzer.State{Deprecations.CSTAnalyzer.FileSystem},Deprecations.CSTAnalyzer.Scope}, ::Vararg{Any,N} where N) at /opt/pkgs/v0.6/Deprecations/src/database/simple.jl:557
[3] (::Deprecations.#find_replacements#103)(::Deprecations.CSTUtils.OverlayNode{CSTParser.Call}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:145
[4] (::Deprecations.#find_replacements#103)(::Deprecations.CSTUtils.OverlayNode{CSTParser.Call}, ::Array{Deprecations.TextReplacement,1}, ::Deprecations.Context) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:185 (repeats 4 times)
[5] (::Deprecations.#find_replacements#103)(::Deprecations.CSTUtils.OverlayNode{CSTParser.FileH}, ::Array{Deprecations.TextReplacement,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:140
[6] #text_replacements#100(::Tuple{Deprecations.CSTAnalyzer.State{Deprecations.CSTAnalyzer.FileSystem},Deprecations.CSTAnalyzer.Scope}, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:189
[7] (::Deprecations.#kw##text_replacements)(::Array{Any,1}, ::Deprecations.#text_replacements, ::String, ::Array{Any,1}) at ./<missing>:0
[8] #edit_text#104(::Array{Any,1}, ::Function, ::String, ::Array{Any,1}) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:194
[9] (::Deprecations.#kw##edit_text)(::Array{Any,1}, ::Deprecations.#edit_text, ::String, ::Array{Any,1}) at ./<missing>:0
[10] #edit_file#109(::Array{Any,1}, ::Function, ::String, ::Array{Any,1}, ::Deprecations.#edit_text) at /opt/pkgs/v0.6/Deprecations/src/Deprecations.jl:199
[11] (::Deprecations.#kw##edit_file)(::Array{Any,1}, ::Deprecations.#edit_file, ::String, ::Array{Any,1}, ::Function) at ./<missing>:0
[12] #process_deprecations#8(::Bool, ::Function, ::Base.LibGit2.GitRepo, ::String) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:83
[13] (::FemtoCleaner.#kw##process_deprecations)(::Array{Any,1}, ::FemtoCleaner.#process_deprecations, ::Base.LibGit2.GitRepo, ::String) at ./<missing>:0
[14] (::FemtoCleaner.##46#47{GitHub.GitHubWebAPI,GitHub.Repo,GitHub.OAuth2,Base.LibGit2.Signature})(::Tuple{Base.LibGit2.GitRepo,String}) at /opt/pkgs/v0.6/FemtoCleaner/src/autodeployment.jl:15
[15] with_cloned_repo(::FemtoCleaner.##46#47{GitHub.GitHubWebAPI,GitHub.Repo,GitHub.OAuth2,Base.LibGit2.Signature}, ::GitHub.GitHubWebAPI, ::GitHub.Repo, ::GitHub.OAuth2) at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:28
[16] foreach(::FemtoCleaner.##48#50{GitHub.GitHubWebAPI,Base.LibGit2.Signature}, ::Array{GitHub.Repo,1}) at ./abstractarray.jl:1733
[17] update_existing_repos(::GitHub.GitHubWebAPI, ::Base.LibGit2.Signature, ::Int64) at /opt/pkgs/v0.6/FemtoCleaner/src/autodeployment.jl:54
[18] macro expansion at /opt/pkgs/v0.6/FemtoCleaner/src/FemtoCleaner.jl:495 [inlined]
[19] (::FemtoCleaner.##70#74{Int64})() at ./distributed/macros.jl:25
[20] #103 at ./distributed/process_messages.jl:264 [inlined]
[21] run_work_thunk(::Base.Distributed.##103#104{Base.Distributed.CallMsg{:call}}, ::Bool) at ./distributed/process_messages.jl:56
[22] run_work_thunk at ./distributed/process_messages.jl:65 [inlined]
[23] (::Base.Distributed.##96#98{Base.Distributed.RemoteValue,Base.Distributed.##103#104{Base.Distributed.CallMsg{:call}}})() at ./event.jl:73
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.