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

Type inference regression with try / finally #26743

Closed
ghost opened this issue Apr 7, 2018 · 1 comment
Closed

Type inference regression with try / finally #26743

ghost opened this issue Apr 7, 2018 · 1 comment
Assignees
Labels
compiler:inference Type inference compiler:lowering Syntax lowering (compiler front end, 2nd stage) regression Regression in behavior compared to a previous version

Comments

@ghost
Copy link

ghost commented Apr 7, 2018

function f()
    try
        return 5
    finally
    end
end

Base.Test.@inferred f()

Works on v0.5 and v0.6 but fails on v0.7 with:

ERROR: return type Int64 does not match inferred return type Union{Nothing, Int64}
@Keno Keno added compiler:inference Type inference regression Regression in behavior compared to a previous version labels Apr 7, 2018
@JeffBezanson JeffBezanson self-assigned this Apr 9, 2018
@JeffBezanson JeffBezanson added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Apr 9, 2018
@JeffBezanson
Copy link
Sponsor Member

I believe this was caused by #24075, which made the lowering of try/finally more complex. Fortunately cases like the one here can be fixed.

mbauman added a commit that referenced this issue Apr 12, 2018
* origin/master:
  A few more #26670 fixes (#26773)
  Revert "deprecate using the value of `.=`. fixes #25954" (#26754)
  change dim arguments for `diff` and `unique` to keyword args (#26776)
  reorder pmap arguments to allow do-block syntax (#26783)
  correct deprecated parametric method syntax (#26789)
  [NewOptimizer] handle new IR nodes correctly in binary format
  [NewOptimizer] support line number emission from new IR format
  fix #26453, require obviously-concrete lower bound for a var to be diagonal (#26567)
  fix #26743, spurious `return` path in try-finally in tail position (#26753)
  Also lift SelectInst addrspaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference compiler:lowering Syntax lowering (compiler front end, 2nd stage) regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

2 participants