Repository navigation
[-Yexplicit-nulls flow typing] Recognize when variable is monotonically not null #27494
Replies: 2 comments 2 replies
|
The flow-sensitive analysis needs to happen during typing, when the compiler does not yet know the types of other expressions and therefore does not know whether assignments may write The technical core of the earlier solution was to use type bounds to give the variable a type that is nullable when the variable is read but non-null when the variable is written. Such a type would then allow the flow-sensitive analysis to conclude that, once it has already observed a non-null value in the variable, that value will not then be overwritten with null in the future. This was achieved in the earlier solution by a declaration |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This proposal applies to:
Variable is monotonically not null if it starts as null, but once it is set to non-null, it can never become null again.
All reactions