You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Branch master (21 Jun 2019)
Latest commit 898bed by Heejae Chang:
added NFW to get some data on incremental parsing bug where source si� (#36620)
* added NFW to get some data on incremental parsing bug where source size and tree size is different
* more comments
Steps to Reproduce:
Compile the following code:
#nullable enable
classC{staticvoidMain(){(B b1, B b2)=new C();}publicexternvoidDeconstruct(outA?a1,outAa2);}classA{}classB{publicstaticexternimplicitoperator B(Aa);}
Expected Behavior: warning CS8600: Converting null literal or possible null value to non-nullable type. reported for the deconstruction source i.e. new C().
I believe it would be possible to suppress the warning if it is reported for new C()
Update:: Actually, I believe Roslyn should report CS8604: Possible null reference argument for parameter 'a' in 'B.implicit B'. instead of CS8600 here. This is what it reports without deconstruction e.g. (b1, _) = (a, "");
Actual Behavior:
The following two warnings are reported for the declaration expression B b1
warning CS8600: Converting null literal or possible null value to non-nullable type.
warning CS8624: Argument of type 'B' cannot be used as an output of type 'A' for parameter 'a1' in 'void C.Deconstruct(out A? a1, out A a2)' due to differences in the nullability of reference types.
The following warning is reported for the declaration expression B b2
warning CS8624: Argument of type 'B' cannot be used as an output of type 'A' for parameter 'a2' in 'void C.Deconstruct(out A? a1, out A a2)' due to differences in the nullability of reference types.
It's impossible to suppress any of these warnings as placing the suppression operator ! anywhere on the left side of the assignment results in compilation errors.
Notes
Reporting CS8600: Converting null literal or possible null value to non-nullable type. for the declaration expression B b1 seems strange and misleading as it's a declaration of a variable and null value cannot be assigned to it according to the conversion operator signature.
I'm pretty sure CS8624 warnings shouldn't be reported at all as there's no nullability mismatch between these types - they just aren't equal regardless of nullability annotations. Note that this warning is not reported if the conversion/assignment happens outside of a deconstruction e.g. B b = (A) null; // CS8600 only.
Note that current location for these warnings also makes it completely impossible to suppress them via the suppression operator !
The text was updated successfully, but these errors were encountered:
Version Used:
Steps to Reproduce:
Compile the following code:
Expected Behavior:
warning CS8600: Converting null literal or possible null value to non-nullable type.
reported for the deconstruction source i.e.new C()
.I believe it would be possible to suppress the warning if it is reported for
new C()
Update:: Actually, I believe Roslyn should report
CS8604: Possible null reference argument for parameter 'a' in 'B.implicit B'.
instead of CS8600 here. This is what it reports without deconstruction e.g.(b1, _) = (a, "");
Actual Behavior:
The following two warnings are reported for the declaration expression
B b1
The following warning is reported for the declaration expression
B b2
It's impossible to suppress any of these warnings as placing the suppression operator
!
anywhere on the left side of the assignment results in compilation errors.Notes
Reporting
CS8600: Converting null literal or possible null value to non-nullable type.
for the declaration expressionB b1
seems strange and misleading as it's a declaration of a variable and null value cannot be assigned to it according to the conversion operator signature.I'm pretty sure
CS8624
warnings shouldn't be reported at all as there's no nullability mismatch between these types - they just aren't equal regardless of nullability annotations. Note that this warning is not reported if the conversion/assignment happens outside of a deconstruction e.g.B b = (A) null; // CS8600 only
.Note that current location for these warnings also makes it completely impossible to suppress them via the suppression operator
!
The text was updated successfully, but these errors were encountered: