var infers a nullable type (#3097)

This commit is contained in:
Julien Couvreur 2020-01-21 22:49:40 -08:00 committed by GitHub
parent d832b361bb
commit 6f24703c82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,14 +70,8 @@ The postfix `!` operator has no runtime effect - it evaluates to the result of t
### nullable implicitly typed local variables
Alongside `var` it is now permitted to write `var?`.
```antlr
local_variable_type
: ...
| 'var' '?'
;
```
`var` infers an annotated type for reference types.
For instance, in `var s = "";` the `var` is inferred as `string?`.
### Nullable compiler directives