'Nothing' sometimes evalutes to 0, 0.0, False, ChrW(0), or other value type defaults when a null value is expected
Open
Scenario
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
Nothing is a target-typed literal whose actual value depends on the type it's being converted to. Most users think of `Nothing` as synonymous with a null value so when this isn't the case it's often a surprise or surprisingly causes undesirable behavior:
```VB.NET
' User thinks x has null value but x has value 0.
Dim x As Boolean? = If(False, 1, Nothing)
```
```VB.NET
' User thinks x has type Integer? (nullable) but x has type Integer (non-nullable).
Dim x = If(False, 1, Nothing)
```
This requires special handling to explicitly casting to produce a null value.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.