Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false positive in stale names with default value for function args #62

Open
ericphanson opened this issue Jun 9, 2024 · 1 comment
Open

Comments

@ericphanson
Copy link
Owner

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
@ericphanson
Copy link
Owner Author

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.

ericphanson added a commit that referenced this issue Jun 9, 2024
* document bug

* import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant