Fix build errors with new compiler
authorSantiago Fernandez Madero <safern@microsoft.com>
Mon, 8 Apr 2019 18:51:45 +0000 (11:51 -0700)
committerSantiago Fernandez Madero <safern@microsoft.com>
Mon, 8 Apr 2019 18:51:45 +0000 (11:51 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/a6f3bedb00f551190fa14c35108cf49143adde4b

src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs
src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs

index f6684cd..49f4ff4 100644 (file)
@@ -281,7 +281,7 @@ namespace System
                 for (index = 0; index < length; index++)
                 {
                     lookUp = Unsafe.Add(ref searchSpace, index);
-                    if ((object)lookUp is null)
+                    if ((object?)lookUp is null)
                     {
                         if ((object?)value0 is null || (object?)value1 is null)
                         {
@@ -386,7 +386,7 @@ namespace System
                 for (index = 0; index < length; index++)
                 {
                     lookUp = Unsafe.Add(ref searchSpace, index);
-                    if ((object)lookUp is null)
+                    if ((object?)lookUp is null)
                     {
                         if ((object?)value0 is null || (object?)value1 is null || (object?)value2 is null)
                         {
@@ -632,7 +632,7 @@ namespace System
                 for (length--; length >= 0; length--)
                 {
                     lookUp = Unsafe.Add(ref searchSpace, length);
-                    if ((object)lookUp is null)
+                    if ((object?)lookUp is null)
                     {
                         if ((object?)value0 is null || (object?)value1 is null)
                         {
@@ -736,7 +736,7 @@ namespace System
                 for (length--; length >= 0; length--)
                 {
                     lookUp = Unsafe.Add(ref searchSpace, length);
-                    if ((object)lookUp is null)
+                    if ((object?)lookUp is null)
                     {
                         if ((object?)value0 is null || (object?)value1 is null || (object?)value2 is null)
                         {
@@ -806,35 +806,35 @@ namespace System
 
                 lookUp0 = Unsafe.Add(ref first, index);
                 lookUp1 = Unsafe.Add(ref second, index);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 1);
                 lookUp1 = Unsafe.Add(ref second, index + 1);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 2);
                 lookUp1 = Unsafe.Add(ref second, index + 2);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 3);
                 lookUp1 = Unsafe.Add(ref second, index + 3);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 4);
                 lookUp1 = Unsafe.Add(ref second, index + 4);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 5);
                 lookUp1 = Unsafe.Add(ref second, index + 5);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 6);
                 lookUp1 = Unsafe.Add(ref second, index + 6);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 7);
                 lookUp1 = Unsafe.Add(ref second, index + 7);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
 
                 index += 8;
@@ -846,19 +846,19 @@ namespace System
 
                 lookUp0 = Unsafe.Add(ref first, index);
                 lookUp1 = Unsafe.Add(ref second, index);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 1);
                 lookUp1 = Unsafe.Add(ref second, index + 1);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 2);
                 lookUp1 = Unsafe.Add(ref second, index + 2);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 lookUp0 = Unsafe.Add(ref first, index + 3);
                 lookUp1 = Unsafe.Add(ref second, index + 3);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
 
                 index += 4;
@@ -868,7 +868,7 @@ namespace System
             {
                 lookUp0 = Unsafe.Add(ref first, index);
                 lookUp1 = Unsafe.Add(ref second, index);
-                if (!(lookUp0?.Equals(lookUp1) ?? (object)lookUp1 is null))
+                if (!(lookUp0?.Equals(lookUp1) ?? (object?)lookUp1 is null))
                     goto NotEqual;
                 index += 1;
                 length--;
@@ -893,7 +893,7 @@ namespace System
             for (int i = 0; i < minLength; i++)
             {
                 T lookUp = Unsafe.Add(ref second, i);
-                int result = (Unsafe.Add(ref first, i)?.CompareTo(lookUp) ?? (((object)lookUp is null) ? 0 : -1));
+                int result = (Unsafe.Add(ref first, i)?.CompareTo(lookUp) ?? (((object?)lookUp is null) ? 0 : -1));
                 if (result != 0)
                     return result;
             }
index 4197175..e05e966 100644 (file)
@@ -1924,9 +1924,9 @@ namespace System.Text
                     }
                     else if (replacementsCount >= replacements.Length)
                     {
-                        Array.Resize(ref replacements, replacements.Length * 3 / 2 + 4); // Grow by ~1.5x, but more in the begining
+                        Array.Resize(ref replacements!, replacements.Length * 3 / 2 + 4); // Grow by ~1.5x, but more in the begining
                     }
-                    replacements[replacementsCount++] = indexInChunk;
+                    replacements![replacementsCount++] = indexInChunk; // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/26761
                     indexInChunk += oldValue.Length;
                     count -= oldValue.Length;
                 }