ExplicitImports.jl
ExplicitImports.jl copied to clipboard
false positive in stale names with default value for function args
spotted since ExplicitImports says norm is stale in DataFrames, when it is not: https://github.com/JuliaData/DataFrames.jl/blob/027650418ab08bbe6b94f2cf42743839aa7a593e/src/abstractdataframe/abstractdataframe.jl#L524
Repro:
using LinearAlgebra: stale
f(norm=norm) = 1
This is pretty tricky, since the second norm (the default arg) should not really be see as inside the scope of f. BUT if we had f(norm=norm, b=norm) = b, then the norm in b=norm actually refers to the left-hand-side of the first arg, i.e. f("hi") = "hi". So in that sense, the default arg is in scope of f, in that it sees earlier default args. So the ordering in f(name1=name2, name3=name4) is basically name2, name1, name4, name3, in that we want to resolve each default arg, then the arg name, then the next default arg, etc.