- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.7k
Closed
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)performanceMust go fasterMust go faster
Description
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.
Metadata
Metadata
Assignees
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)performanceMust go fasterMust go faster