diff --git a/src/Compilers/CSharp/Test/Emit2/Emit/NumericIntPtrTests.cs b/src/Compilers/CSharp/Test/Emit2/Emit/NumericIntPtrTests.cs index a7b6985ef1c00..d2d1668e55709 100644 --- a/src/Compilers/CSharp/Test/Emit2/Emit/NumericIntPtrTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Emit/NumericIntPtrTests.cs @@ -9997,19 +9997,19 @@ public static void M6(uint{{s2Nullable}} x) { } public static void M7(nint{{s1Nullable}} x) { Write("M7 "); } public static void M7(ulong{{s2Nullable}} x) { } - public static void M8(nint{{s1Nullable}} x) { Write("M8"); } + public static void M8(nint{{s1Nullable}} x) { Write("M8 "); } public static void M8(nuint{{s2Nullable}} x) { } - public static void M9(nint{{s1Nullable}} x) { Write("M9"); } - public static void M9(byte{{s2Nullable}} x) { } + public static void M9(nint{{s1Nullable}} x) { Write("M9(nint)"); } + public static void M9(byte{{s2Nullable}} x) { Write("M9(byte)"); } } """; var comp = CreateNumericIntPtrCompilation(source, references: new[] { MscorlibRefWithoutSharingCachedSymbols }); // Note: conversions ushort->nint, ushort?->nint?, ushort->nint? are implicit (so rule 1 kicks in), but ushort?->nint is explicit (so rule 3 kicks in) var expected = (nullable1, nullable2) is (false, true) - ? "M1 M2 M3 M4 M5(nint) M6 M7 M8 M9" - : "M1 M2 M3 M4 M5(ushort) M6 M7 M8 M9"; + ? "M1 M2 M3 M4 M5(nint) M6 M7 M8 M9(nint)" + : "M1 M2 M3 M4 M5(ushort) M6 M7 M8 M9(byte)"; CompileAndVerify(comp, expectedOutput: expected); } @@ -10037,6 +10037,7 @@ public void BetterConversionTarget_IntPtr(bool nullable1, bool nullable2) C.M7(0); C.M8(0); C.M9(0); +C.M10(0); public class C { @@ -10064,16 +10065,19 @@ public static void M7(uint{{s2Nullable}} x) { } public static void M8(IntPtr{{s1Nullable}} x) { Write("M8 "); } public static void M8(ulong{{s2Nullable}} x) { } - public static void M9(IntPtr{{s1Nullable}} x) { Write("M9"); } + public static void M9(IntPtr{{s1Nullable}} x) { Write("M9 "); } public static void M9(nuint{{s2Nullable}} x) { } + + public static void M10(IntPtr{{s1Nullable}} x) { Write("M10(IntPtr)"); } + public static void M10(byte{{s2Nullable}} x) { Write("M10(byte)"); } } """; var comp = CreateNumericIntPtrCompilation(source, references: new[] { MscorlibRefWithoutSharingCachedSymbols }); // Note: conversions ushort->nint, ushort?->nint?, ushort->nint? are implicit (so rule 1 kicks in), but ushort?->nint is explicit (so rule 3 kicks in) var expected = (nullable1, nullable2) is (false, true) - ? "M1 M2 M3 M4 M5 M6(IntPtr) M7 M8 M9" - : "M1 M2 M3 M4 M5 M6(ushort) M7 M8 M9"; + ? "M1 M2 M3 M4 M5 M6(IntPtr) M7 M8 M9 M10(IntPtr)" + : "M1 M2 M3 M4 M5 M6(ushort) M7 M8 M9 M10(byte)"; CompileAndVerify(comp, expectedOutput: expected); }