Adjust DefiniteAssignmentPass.WriteConsideredUse for UTF8 String Literals.#60326
Conversation
|
@cston, @RikkiGibson, @dotnet/roslyn-compiler Please review |
|
|
||
| if ((object)type != null && type.IsReferenceType && | ||
| type.SpecialType != SpecialType.System_String && | ||
| (type is not ArrayTypeSymbol { IsSZArray: true } arrayType || arrayType.ElementType.SpecialType != SpecialType.System_Byte)) |
There was a problem hiding this comment.
Consider combining into a single pattern like type is not ArrayTypeSymbol { IsSZArray: true, ElementType.SpecialType: SpecialType.System_Byte } #Resolved
| const string stringNull = null; | ||
|
|
||
| var x1 = ""123""U8; | ||
| Span<byte> x2 = ""124""U8; |
There was a problem hiding this comment.
Is it intentional that the warning is not given here even though it is given on 'z2'? #Resolved
There was a problem hiding this comment.
Is it intentional that the warning is not given here even though it is given on 'z2'?
This is similar to System.ReadOnlySpan<char> x3 = "abc";. A user defined conversion considered as a usage.
On z2 there is no user-defined conversion from the language point of view, there is a built-in conversion.
|
@cston, @dotnet/roslyn-compiler For the second review. |
|
@cston, @dotnet/roslyn-compiler For the second review. |
Fixes #60319.