Add nullable spec for nested functions

This commit is contained in:
Andy Gocke 2020-06-22 15:07:55 -07:00 committed by GitHub
parent 26966202e8
commit 7c44a62f9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -162,6 +162,13 @@ Type parameters additionally take their constraints into account:
For a type parameter `T`, `T?` is only allowed if `T` is known to be a value type or known to be a reference type.
### Nested functions
Nested functions (lambdas and local functions) are treated like methods, except in regards to their captured variables.
The default state of a captured variable inside a lambda or local function is the intersection of the nullable state
of the variable at all the "uses" of that nested function. A use of a function is either a call to that function, or
where it is converted to a delegate.
### Oblivious vs nonnullable
A `type` is deemed to occur in a given annotation context when the last token of the type is within that context.