-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inference: allows conditional object to propagate constraint multiple…
… times (#39936) Currently we always `widenconditional` conditional var state, which makes us unable to propagate constraints from conditional object multiple times: ```julia @test Base.return_types((Union{Nothing,Int},)) do a b = a === nothing c = b ? 0 : a # c::Int d = !b ? a : 0 # d::Int ideally, but Union{Int,Nothing} c, d end == Any[Tuple{Int,Int}] # fail ``` This PR keeps conditional var state when the update is came from a conditional branching, and allows a conditional object to propagate constraint multiple times as far as the subject of condition doesn't change. AFAIU this is safe because the update from conditional branching doesn't change the condition itself.
- Loading branch information
Showing
3 changed files
with
55 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters