- We know that Julia subtyping is undecidable.
- Can we restrict lower bounds to make subtyping decidable, at the same time allowing all the practical uses of lower bounds in the existing Julia code?
Using static analysis, we find uses of lower bounds in Julia packages and manually inspect them.
As of Julia 1.5.3, there are only two accepted patterns of lower bounds in the full form of where-types,
where T >: Int
where Int <: T <: Number
as well as one shorthand form Vector{>:Int}
(which means Vector{T} where T>:Int
).
Everything else (e.g. where Int <: T
) doesn't work,
and test/lb-analysis.jl
tests for that
in the tests set "lb-analysis :: type bounds format"
.
The three patterns can be found in extractLowerBound
function,
src/lb-analysis/process-code.jl
.
Note. Not all lower bounds that we find are in function definitions
because we don't specifically match where
, just T >: LB
.
Thus, we also find run-time checks for lower bounds.
Assuming the directory structure:
.
|
-- julia-sub
-- utils
|
-- JuliaPkgsList.jl
-- JuliaPkgDownloader
Old stuff below
and jl-wa
with a clonning script
$ ../../utils/JuliaPkgsList.jl/gen-pkgs-list.jl 0 -o pkgs-list/pkgs-list.txt -r
$ julia -p 8 ../../jl-wa/src/utils/clone.jl -s pkgs-list/pkgs-list.txt -d pkgs/4886/
$ julia analysis-script.jl <pkgs>
where <pkgs
is a folder with Julia packages.
lia analysis-script.jl
where `<pkgs` is a folder with Julia packages.