Nullable analysis fails to understand complicated is (pattern) expression #31881
Labels
Area-Compilers
Bug
Feature - Nullable Reference Types
Nullable Reference Types
Resolution-Fixed
The bug has been fixed and/or the requested behavior has been implemented
Milestone
Version Used: Latest supported by SharpLap and VS 2019 Preview 1.1
Steps to Reproduce:
https://sharplab.io/#v2:EYLgZgpghgLgrgJwgZwLQQCYEsYHsEDGuAdmFgOapbGpEC2ADlgDYQIA0MIAbm1mAE92GEAGoAPgAEADAAJJARgDcAWABQAYmJxmzKMFayIxfa3XrJAZnkAmWQGF1Ab3UBIK7NzAAVhAIwAflkAQQAFBFwGNhgBWSdZcggYJVlkJJSAX3VZHPlrSQAWWQBZAAp7IOoGOBgASmzclzVc2Vd+WVKqmoCAOjCIqIQY2SxkeQU5ZBgEeuaWxob51sUATlKphB6AFVwAZWnqclLa2tU5pfcFNa7AvvDI6IFtvYPiI5OzpZzL6+JqmDuA0ez32CEOx1Oi3mP06fxqINe70h53mWTUrjRGSAA==
Note that changing the is pattern to a normal is expression does not make a difference.
Expected Behavior:
No warning is produced.
Actual Behavior:
The compiler emits three CS8602 warnings in the code.
Because of the if statement we know that input?.AProperty is not null. This implies that both input and input.AProperty are not null. So none on these statements should produce a warning.
The text was updated successfully, but these errors were encountered: