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

dotted getindex has wrong error in the REPL #26739

Closed
KristofferC opened this issue Apr 7, 2018 · 6 comments · Fixed by #26878
Closed

dotted getindex has wrong error in the REPL #26739

KristofferC opened this issue Apr 7, 2018 · 6 comments · Fixed by #26878
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@KristofferC
Copy link
Member

KristofferC commented Apr 7, 2018

This looks odd (this has now been fixed):

jjulia> sum.[1]
ERROR: MethodError: no method matching getproperty(::typeof(sum), ::Expr)
Closest candidates are:
  getproperty(::Any, ::Symbol) at sysimg.jl:18

julia> Base.getproperty(::typeof(sum), ::Expr) = "Hello"

julia> sum.[1]
"Hello"

julia> foo() = sum.[1]
ERROR: syntax: invalid syntax sum.[1]

Also (not fixed):

julia> sum.[1]
ERROR: MethodError: no method matching getproperty(::typeof(sum), ::Expr)
Closest candidates are:
  getproperty(::Any, ::Symbol) at sysimg.jl:18

julia> Base.getproperty(::typeof(sum), ::Expr) = "Hello"

julia> sum.[1]
"Hello"

julia> foo() = sum.[1]
ERROR: syntax: invalid syntax sum.[1]
@stevengj
Copy link
Member

stevengj commented Apr 7, 2018

Possibly a recently introduced problem? 4d71641 works fine for me. Running a bisect now.

@stevengj stevengj added parser Language parsing and surface syntax bug Indicates an unexpected problem or unintended behavior labels Apr 7, 2018
@KristofferC
Copy link
Member Author

KristofferC commented Apr 7, 2018

#26723 maybe, just a guess

@stevengj
Copy link
Member

stevengj commented Apr 7, 2018

Bisect is blaming d6c78ab, cc @Keno

Actually there is a build failure at that point on my machine. It looks like the bug is anywhere from that commit to 10776d9. But in any case it looks like the problem was introduced by #26726 (which probably should have been squashed so as not to break bisect).

@Keno
Copy link
Member

Keno commented Apr 7, 2018

Taking a look. A bit of a confusing failure mode for that change to have introduced.

@Keno
Copy link
Member

Keno commented Apr 7, 2018

Looks like, this was caused by #26486, particularly the . fast-path in the interpreter.

Keno added a commit that referenced this issue Apr 7, 2018
Broadcast calls like `sin.(x)` are parsed to

    Expr(:(.), :sin, Expr(:tuple, :x))

before lowering. As a result, they got caught in the
top-level interpreters fast path for lowering calls
like that to getfield/getproperty, causing #26739.

Fixes 26739
@KristofferC
Copy link
Member Author

Reopening due to #26742 (comment)

@KristofferC KristofferC reopened this Apr 11, 2018
@KristofferC KristofferC changed the title dot calling functions doesn't work in the REPL dotted getindex has wrong error in the REPL Apr 13, 2018
@JeffBezanson JeffBezanson added compiler:lowering Syntax lowering (compiler front end, 2nd stage) and removed parser Language parsing and surface syntax labels Apr 21, 2018
JeffBezanson added a commit that referenced this issue Apr 21, 2018
fix #26739, error for `sum.[1]`
fix #26873, should have no error for `f."a"`
JeffBezanson added a commit that referenced this issue Apr 23, 2018
fix #26739, error for `sum.[1]`
fix #26873, should have no error for `f."a"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants