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

"Multiple definitions" error message on begin ... end is misleading #3061

Closed
laggvar opened this issue Oct 15, 2024 · 5 comments · Fixed by JuliaPluto/PlutoDependencyExplorer.jl#12
Labels
bug Something isn't working error display How errors and stack traces are presented

Comments

@laggvar
Copy link

laggvar commented Oct 15, 2024

This error message is quite confusing:

image

By renaming a in one of the two cells, the error disappears, so there is nothing wrong with Base. But this can be quite difficult to troubleshoot in more complex scenarios.

It gets even stranger when renaming the variable to c Then the error only mentions Base and not the variable with the actual error. This seems to happen when using the names c or e but not a, b , d or f.

image

Tested in Pluto 0.20.0 / Julia 1.11 and partially in Pluto 0.19.40 / Julia 1.9.3.

@Pangoraw Pangoraw added bug Something isn't working error display How errors and stack traces are presented labels Oct 16, 2024
@fonsp
Copy link
Owner

fonsp commented Oct 21, 2024

Woww so weird that it depends on which letter you use!! What is that about 🙈

@fonsp
Copy link
Owner

fonsp commented Oct 21, 2024

It looks like the problem is with the . in Base.zero: here is one message where cee shows, and one where ceee does not show:

image

The randomness is caused by set ordering of the symbol names :)

@fonsp fonsp closed this as completed in b1cacd8 Oct 21, 2024
@fonsp
Copy link
Owner

fonsp commented Oct 21, 2024

I fixed the error message display, it now looks like this (no matter the variable name):

image

Now it also shows Base.zero instead of just Base

@fonsp
Copy link
Owner

fonsp commented Oct 21, 2024

About the confusing error message, in your example the improvement would be to detect that a is doubly defined, but the Base.zero definitions don't matter.

Our code understands this. But when the error is generated, a different (simpler) algorithm determines which variable names to show in the error:

https://github.com/JuliaPluto/PlutoDependencyExplorer.jl/blob/b998a9c771cc5e23b1bd235dfbeb34304c122e5c/src/Errors.jl#L22

And this one catches the Base.zero by accident.

@fonsp
Copy link
Owner

fonsp commented Oct 21, 2024

I improved the error message in #3061

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working error display How errors and stack traces are presented
Projects
None yet
3 participants