-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Confusing printing of Expr #9474
Comments
This is definitely an issue sometimes. We should probably just parenthesize more aggressively when showing typed ASTs since that's really mainly for debugging use anyway. |
We do have parentheses based on operator precedence, but maybe :: hasn't The second issue comes from the fact that <: is represented differently in |
For the first one I don't really mind seeing more parenthesis than necessary (which only makes it closer to lisp) although only adding them when necessary would be better. I thought the operator precedence is also defined in julia itself. Is the printing getting that information from somewhere else instead? For the second one, maybe |
The second one confuses me when I try to construct a type declaration in a macro with I guess a better error message when |
Another example I've noticed while tracking down another bug report (not for julia> AbstractArray{TypeVar(:T), 1}.name
AbstractArray
julia> Base.SetPartitions.parameters[1].ub
AbstractArray{T,1}
julia> AbstractArray{TypeVar(:T), 1}
AbstractArray{T,1}
julia> typeof(Base.SetPartitions.parameters[1].ub)
TypeConstructor
julia> typeof(AbstractArray{TypeVar(:T), 1})
DataType |
No wait, the |
I'm confused by the second example. What is the problem with the |
With the first example, it is a trivial fix: we have the operator precedence but weren't using it:
This is presumably because the Or rather, the |
Oh, I see the problem with |
A related bug:
|
The misparenthesized infix output should be fixed. I've opened a separate issue for the |
Thanks for the fix. As long as there's no concern about backward compatibility etc, I would prefer parsing |
While exploring the AST, I've found a few cases where the printed Expr is really confusing
A few examples that I can remember now are
I agree that the best way to see the content of a
Expr
is probably usingdump
orMeta.show_sexpr
but it'll be nice if the default display in REPL is not misleading...The text was updated successfully, but these errors were encountered: