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

Return statement on assignment rhs should work or give better error message #33720

Closed
andreasnoack opened this issue Oct 30, 2019 · 3 comments
Closed
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@andreasnoack
Copy link
Member

julia> __tmp1 = let
         a = 1
         a
       end
1

julia> __tmp1
1

julia> __tmp2 = let
         a = 1
         return a
       end
1

julia> __tmp2
ERROR: UndefVarError: __tmp2 not defined

I noticed this when trying to assign to a dict which gave

julia> d["a"] = let
        a = 1
        return a
       end
ERROR: syntax: ssavalue with no def

I don't know if it makes sense to allow return in a let block but if it doesn't then it would be great with a better error message.

@yuyichao
Copy link
Contributor

yuyichao commented Oct 30, 2019

It does work (edit: as intended). Dup of #30499

@JeffBezanson JeffBezanson changed the title Return statement in let block should work or give better error message Return statement on assignment rhs should work or give better error message Oct 30, 2019
@JeffBezanson JeffBezanson reopened this Oct 30, 2019
@JeffBezanson
Copy link
Member

This shouldn't give ssavalue with no def.

@JeffBezanson JeffBezanson added compiler:lowering Syntax lowering (compiler front end, 2nd stage) bug Indicates an unexpected problem or unintended behavior labels Oct 30, 2019
@JeffBezanson JeffBezanson self-assigned this Jan 16, 2020
@JeffBezanson
Copy link
Member

Dup of #31238

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

No branches or pull requests

3 participants