forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix scala#21619: Refactor NotNullInfo to record every reference which…
… is retracted once. (scala#21624) This PR improves the flow typing for returning and exceptions. The `NotNullInfo` is defined as following now: ```scala case class NotNullInfo(asserted: Set[TermRef] | Null, retracted: Set[TermRef]): ``` * `retracted` contains variable references that are ever assigned to null; * if `asserted` is not `null`, it contains `val` or `var` references that are known to be not null, after the tree finishes executing normally (non-exceptionally); * if `asserted` is `null`, the tree is know to terminate, by throwing, returning, or calling a function with `Nothing` type. Hence, it acts like a universal set. `alt` is defined as `<a1,r1>.alt(<a2,r2>) = <a1 intersect a2, r1 union r2>`. The difficult part is the `try ... catch ... finally ...`. We don't know at which point an exception is thrown in the body, and the catch cases may be not exhaustive, we have to collect any reference that is once retracted. Fix scala#21619
- Loading branch information
Showing
9 changed files
with
257 additions
and
78 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
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
Oops, something went wrong.