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

Combo of begin block and return type annotation breaks closure inference #29326

Closed
marius311 opened this issue Sep 23, 2018 · 1 comment
Closed
Assignees
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) performance Must go faster

Comments

@marius311
Copy link
Contributor

I know there's still ongoing work in making closures fast / fixing #15276, but this seemed weird enough that I thought it could be a bug and would be worth reporting:

function inferred1() :: Any
    a = 1
    (() -> a)()
end

function inferred2()
    begin
        a = 1
        (() -> a)()
    end
end

function not_inferred() :: Any
    begin
        a = 1
        (() -> a)()
    end
end

@code_warntype inferred1()
@code_warntype inferred2()
@code_warntype not_inferred()

As you can see, once you have both the begin block and the return type annotation, it breaks the closure inference, although either alone is fine. I'm seeing this on 0.6.4 and 0.7/1.0.

@yuyichao
Copy link
Contributor

Still dup of #15276 . Hopefully simple enough to be fixed though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) performance Must go faster
Projects
None yet
Development

No branches or pull requests

3 participants