Temporarily add back old TryParse signatures (#14893)
authorStephen Toub <stoub@microsoft.com>
Tue, 7 Nov 2017 13:53:25 +0000 (08:53 -0500)
committerGitHub <noreply@github.com>
Tue, 7 Nov 2017 13:53:25 +0000 (08:53 -0500)
My previous change updated the primitive TryParse signatures based on
the new design, but until corefx consumes that change, live corefx bits
won't work with the latest coreclr bits.  Until it can be consumed, I'm
putting back the old signatures as well.

12 files changed:
src/mscorlib/shared/System/Byte.cs
src/mscorlib/shared/System/Double.cs
src/mscorlib/shared/System/Int16.cs
src/mscorlib/shared/System/Int32.cs
src/mscorlib/shared/System/Int64.cs
src/mscorlib/shared/System/SByte.cs
src/mscorlib/shared/System/Single.cs
src/mscorlib/shared/System/TimeSpan.cs
src/mscorlib/shared/System/UInt16.cs
src/mscorlib/shared/System/UInt32.cs
src/mscorlib/shared/System/UInt64.cs
src/mscorlib/src/System/Decimal.cs

index c16b2246a3bc36480ded1584d35c9d767dcfea67..e32ab2b11dd07300340767766e6a9b1f19712b10 100644 (file)
@@ -137,6 +137,10 @@ namespace System
             return TryParse(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParse(ReadOnlySpan<char> s, out byte result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         public static bool TryParse(String s, NumberStyles style, IFormatProvider provider, out Byte result)
         {
             NumberFormatInfo.ValidateParseStyleInteger(style);
index 949ac6ddd7cd270bd4be61635ebc16d7eefaec2c..610aa61fc27c020c4ff2705391891a7ad19a65f6 100644 (file)
@@ -324,6 +324,10 @@ namespace System
             return TryParse(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParse(ReadOnlySpan<char> s, out double result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out double result)
         {
             NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
index fd567cd74d6b105a720c9e29d878cb08a4d0beb9..fb0aa1110e52fa152081049d8eb56088fdef3419 100644 (file)
@@ -185,6 +185,10 @@ namespace System
             return TryParse(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParse(ReadOnlySpan<char> s, out Int16 result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out short result)
         {
             NumberFormatInfo.ValidateParseStyleInteger(style);
index 33061137c6cf4ca67b79643315a71edb7ec63a43..cb5db68fa1860ae74819ca9afc29f2aa84f4ad89 100644 (file)
@@ -171,6 +171,10 @@ namespace System
             return Number.TryParseInt32(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParse(ReadOnlySpan<char> s, out int result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out int result)
         {
             NumberFormatInfo.ValidateParseStyleInteger(style);
index 5db9fe19294f1e32525fef7dd0ae4c6acfc1739a..b6275f4609971fd177fbf2de6bc0be1440a4c01d 100644 (file)
@@ -159,6 +159,10 @@ namespace System
             return Number.TryParseInt64(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParse(ReadOnlySpan<char> s, out long result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out long result)
         {
             NumberFormatInfo.ValidateParseStyleInteger(style);
index b0d32ad9cdc44d1edc9e69fc26cc48dfbb63f7c5..1d3fded79fc22537fdd67a98d98d1bd07d9fc0ab 100644 (file)
@@ -205,6 +205,11 @@ namespace System
             return TryParse(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        [CLSCompliant(false)]
+        public static bool TryParse(ReadOnlySpan<char> s, out sbyte result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         [CLSCompliant(false)]
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out sbyte result)
         {
index 83684770f32c494c88120f230f50b2d8f4074894..fe5f5701e17c1cd1d67949a9b49e1defd4620e90 100644 (file)
@@ -314,6 +314,10 @@ namespace System
             return TryParse(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static Boolean TryParse(ReadOnlySpan<char> s, out Single result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out float result)
         {
             NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
index 180f015f1f0f629d2ee7513dae40c4b3b40bf186..b933538cc8e0f50ef57df581f89376fa326fbdb7 100644 (file)
@@ -370,6 +370,11 @@ namespace System
         {
             return TimeSpanParse.TryParse(s, null, out result);
         }
+
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParse(ReadOnlySpan<char> input, out TimeSpan result, IFormatProvider formatProvider = null) =>
+            TryParse(input, formatProvider, out result);
+
         public static Boolean TryParse(String input, IFormatProvider formatProvider, out TimeSpan result)
         {
             if (input == null)
@@ -409,6 +414,11 @@ namespace System
         {
             return TimeSpanParse.TryParseExactMultiple(input, formats, formatProvider, TimeSpanStyles.None, out result);
         }
+
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParseExact(ReadOnlySpan<char> input, string format, IFormatProvider formatProvider, out TimeSpan result, TimeSpanStyles styles = TimeSpanStyles.None) =>
+            TryParseExact(input, format, formatProvider, styles, out result);
+
         public static Boolean TryParseExact(String input, String format, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
         {
             ValidateStyles(styles, nameof(styles));
@@ -434,6 +444,11 @@ namespace System
             }
             return TimeSpanParse.TryParseExactMultiple(input.AsReadOnlySpan(), formats, formatProvider, styles, out result);
         }
+
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParseExact(ReadOnlySpan<char> input, string[] formats, IFormatProvider formatProvider, out TimeSpan result, TimeSpanStyles styles = TimeSpanStyles.None) =>
+            TryParseExact(input, formats, formatProvider, styles, out result);
+
         public static bool TryParseExact(ReadOnlySpan<char> input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
         {
             ValidateStyles(styles, nameof(styles));
index e9e250e4fc4cd064fcca523c31f709ce45d402fe..b06b62556961da93f39417863833dd2c9d58e2d2 100644 (file)
@@ -174,6 +174,11 @@ namespace System
             return TryParse(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        [CLSCompliant(false)]
+        public static bool TryParse(ReadOnlySpan<char> s, out ushort result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         [CLSCompliant(false)]
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out ushort result)
         {
index 9235f68ee6276ff21a070d148a805570658d2a74..04f459d21d5d1bf1d73f4040f6b56531d8c254c1 100644 (file)
@@ -166,6 +166,11 @@ namespace System
             return Number.TryParseUInt32(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        [CLSCompliant(false)]
+        public static bool TryParse(ReadOnlySpan<char> s, out UInt32 result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         [CLSCompliant(false)]
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out uint result)
         {
index ccb21e817cba186cff91252a2698e6c3b70d033c..fbaf54200fff9a8640d4ae83a8331ec9980b8655 100644 (file)
@@ -163,6 +163,11 @@ namespace System
             return Number.TryParseUInt64(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        [CLSCompliant(false)]
+        public static Boolean TryParse(ReadOnlySpan<char> s, out UInt64 result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         [CLSCompliant(false)]
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out ulong result)
         {
index c64ff590560098a5f5e279537af6e8a16250d7ff..c2b67d68d6697ad797cae185879b28240738bc56 100644 (file)
@@ -563,6 +563,10 @@ namespace System
             return Number.TryParseDecimal(s.AsReadOnlySpan(), style, NumberFormatInfo.GetInstance(provider), out result);
         }
 
+        // TODO https://github.com/dotnet/corefx/issues/23642: Remove once corefx has been updated with new overloads.
+        public static bool TryParse(ReadOnlySpan<char> s, out decimal result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) =>
+            TryParse(s, style, provider, out result);
+
         public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, out decimal result)
         {
             NumberFormatInfo.ValidateParseStyleFloatingPoint(style);