@@ -2657,7 +2657,7 @@ public static int M()
26572657 [ InlineData ( "string" , "11" ) ]
26582658 [ InlineData ( "object" , "18" ) ]
26592659 [ InlineData ( "C" , "18" ) ]
2660- public void ReadOnlySpanFromArryOfConstants_Null ( string type , string typeCode )
2660+ public void ReadOnlySpanFromArrayOfConstants_Null ( string type , string typeCode )
26612661 {
26622662 var src = $$ """
26632663var values = C.M();
@@ -2698,8 +2698,51 @@ .maxstack 2
26982698 verifier . VerifyIL ( "C.M" , expectedIL ) ;
26992699 }
27002700
2701+ [ Theory , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2702+ [ InlineData ( "string" , "11" ) ]
2703+ [ InlineData ( "object" , "18" ) ]
2704+ [ InlineData ( "C" , "18" ) ]
2705+ public void ReadOnlySpanFromArrayOfConstants_Null_CollectionExpression ( string type , string typeCode )
2706+ {
2707+ var src = $$ """
2708+ System.Console.Write(C.M());
2709+
2710+ public class C
2711+ {
2712+ public static int M()
2713+ {
2714+ System.ReadOnlySpan<{{ type }} > values = [ null, null ];
2715+ return values.Length;
2716+ }
2717+ }
2718+ """ ;
2719+ var compilation = CreateCompilationWithMscorlibAndSpan ( src ) ;
2720+ var verifier = CompileAndVerify ( compilation , expectedOutput : "2" , verify : Verification . Skipped ) ;
2721+
2722+ verifier . VerifyIL ( "C.M" , $$ """
2723+ {
2724+ // Code size 35 (0x23)
2725+ .maxstack 2
2726+ .locals init (System.ReadOnlySpan<{{ type }} > V_0) //values
2727+ IL_0000: ldsfld "{{ type }} [] <PrivateImplementationDetails>.96A296D224F285C67BEE93C30F8A309157F0DAA35DC5B87E410B78630A09CFC7_B{{ typeCode }} "
2728+ IL_0005: dup
2729+ IL_0006: brtrue.s IL_0015
2730+ IL_0008: pop
2731+ IL_0009: ldc.i4.2
2732+ IL_000a: newarr "{{ type }} "
2733+ IL_000f: dup
2734+ IL_0010: stsfld "{{ type }} [] <PrivateImplementationDetails>.96A296D224F285C67BEE93C30F8A309157F0DAA35DC5B87E410B78630A09CFC7_B{{ typeCode }} "
2735+ IL_0015: newobj "System.ReadOnlySpan<{{ type }} >..ctor({{ type }} [])"
2736+ IL_001a: stloc.0
2737+ IL_001b: ldloca.s V_0
2738+ IL_001d: call "int System.ReadOnlySpan<{{ type }} >.Length.get"
2739+ IL_0022: ret
2740+ }
2741+ """ ) ;
2742+ }
2743+
27012744 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2702- public void ReadOnlySpanFromArryOfConstants_OtherStrings ( )
2745+ public void ReadOnlySpanFromArrayOfConstants_OtherStrings ( )
27032746 {
27042747 var src = """
27052748var values = C.M();
@@ -2769,7 +2812,7 @@ .maxstack 4
27692812 }
27702813
27712814 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2772- public void ReadOnlySpanFromArryOfConstants_VariableStrings ( )
2815+ public void ReadOnlySpanFromArrayOfConstants_VariableStrings ( )
27732816 {
27742817 var src = """
27752818public class C
@@ -2811,7 +2854,7 @@ .locals init (string V_0, //hello
28112854 }
28122855
28132856 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2814- public void ReadOnlySpanFromArryOfConstants_NoInitializer ( )
2857+ public void ReadOnlySpanFromArrayOfConstants_NoInitializer ( )
28152858 {
28162859 var src = """
28172860public class C
@@ -2828,7 +2871,7 @@ public class C
28282871 }
28292872
28302873 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2831- public void ReadOnlySpanFromArryOfConstants_NativeInts ( )
2874+ public void ReadOnlySpanFromArrayOfConstants_NativeInts ( )
28322875 {
28332876 var src = """
28342877var values = C.M();
@@ -2871,7 +2914,7 @@ .maxstack 4
28712914 }
28722915
28732916 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2874- public void ReadOnlySpanFromArryOfConstants_NativeUnsignedInts ( )
2917+ public void ReadOnlySpanFromArrayOfConstants_NativeUnsignedInts ( )
28752918 {
28762919 var src = """
28772920var values = C.M();
@@ -2914,7 +2957,7 @@ .maxstack 4
29142957 }
29152958
29162959 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2917- public void ReadOnlySpanFromArryOfConstants_Decimals ( )
2960+ public void ReadOnlySpanFromArrayOfConstants_Decimals ( )
29182961 {
29192962 var src = """
29202963var values = C.M();
@@ -2956,7 +2999,7 @@ .maxstack 4
29562999 }
29573000
29583001 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2959- public void ReadOnlySpanFromArryOfConstants_DateTime_NotConstant ( )
3002+ public void ReadOnlySpanFromArrayOfConstants_DateTime_NotConstant ( )
29603003 {
29613004 var src = """
29623005using System;
@@ -2990,7 +3033,7 @@ .maxstack 4
29903033 }
29913034
29923035 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
2993- public void ReadOnlySpanFromArryOfConstants_DateTime_WithConst ( )
3036+ public void ReadOnlySpanFromArrayOfConstants_DateTime_WithConst ( )
29943037 {
29953038 var src = """
29963039using System;
@@ -3013,7 +3056,7 @@ public class C
30133056 }
30143057
30153058 [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/69472" ) ]
3016- public void ReadOnlySpanFromArryOfConstants_WithoutConst ( )
3059+ public void ReadOnlySpanFromArrayOfConstants_WithoutConst ( )
30173060 {
30183061 var src = """
30193062public struct S { public int i; }
0 commit comments