Skip to content

Commit 92b4df7

Browse files
committed
Fixed Failing Tests
1 parent 2046356 commit 92b4df7

3 files changed

Lines changed: 35 additions & 48 deletions

File tree

src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenStructsAndEnum.cs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,7 +2288,7 @@ public static void Eval(object obj1, object obj2)
22882288
compilation.VerifyIL("NullableTest.EqualEqual",
22892289
@"
22902290
{
2291-
// Code size 112 (0x70)
2291+
// Code size 104 (0x68)
22922292
.maxstack 2
22932293
.locals init (decimal? V_0)
22942294
IL_0000: ldc.i4.0
@@ -2302,27 +2302,24 @@ .locals init (decimal? V_0)
23022302
IL_001c: ldloca.s V_0
23032303
IL_001e: call ""decimal decimal?.GetValueOrDefault()""
23042304
IL_0023: call ""bool decimal.op_Equality(decimal, decimal)""
2305-
IL_0028: ldloca.s V_0
2306-
IL_002a: call ""bool decimal?.HasValue.get""
2307-
IL_002f: and
2308-
IL_0030: box ""bool""
2309-
IL_0035: ldc.i4.0
2310-
IL_0036: box ""bool""
2311-
IL_003b: call ""void Test.Eval(object, object)""
2312-
IL_0040: ldsfld ""decimal decimal.Zero""
2313-
IL_0045: ldsfld ""decimal? NullableTest.NULL""
2314-
IL_004a: stloc.0
2315-
IL_004b: ldloca.s V_0
2316-
IL_004d: call ""decimal decimal?.GetValueOrDefault()""
2317-
IL_0052: call ""bool decimal.op_Equality(decimal, decimal)""
2318-
IL_0057: ldloca.s V_0
2319-
IL_0059: call ""bool decimal?.HasValue.get""
2320-
IL_005e: and
2321-
IL_005f: box ""bool""
2322-
IL_0064: ldc.i4.0
2323-
IL_0065: box ""bool""
2324-
IL_006a: call ""void Test.Eval(object, object)""
2325-
IL_006f: ret
2305+
IL_0028: box ""bool""
2306+
IL_002d: ldc.i4.0
2307+
IL_002e: box ""bool""
2308+
IL_0033: call ""void Test.Eval(object, object)""
2309+
IL_0038: ldsfld ""decimal decimal.Zero""
2310+
IL_003d: ldsfld ""decimal? NullableTest.NULL""
2311+
IL_0042: stloc.0
2312+
IL_0043: ldloca.s V_0
2313+
IL_0045: call ""decimal decimal?.GetValueOrDefault()""
2314+
IL_004a: call ""bool decimal.op_Equality(decimal, decimal)""
2315+
IL_004f: ldloca.s V_0
2316+
IL_0051: call ""bool decimal?.HasValue.get""
2317+
IL_0056: and
2318+
IL_0057: box ""bool""
2319+
IL_005c: ldc.i4.0
2320+
IL_005d: box ""bool""
2321+
IL_0062: call ""void Test.Eval(object, object)""
2322+
IL_0067: ret
23262323
}
23272324
");
23282325
}

src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleEqualityTests.cs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ static bool M((int?, bool?) t1)
534534
comp.VerifyDiagnostics();
535535

536536
comp.VerifyIL("C.M", @"{
537-
// Code size 63 (0x3f)
537+
// Code size 45 (0x2d)
538538
.maxstack 2
539539
.locals init (System.ValueTuple<int?, bool?> V_0,
540540
int? V_1,
@@ -551,26 +551,19 @@ .locals init (System.ValueTuple<int?, bool?> V_0,
551551
IL_000b: ldloca.s V_1
552552
IL_000d: call ""int int?.GetValueOrDefault()""
553553
IL_0012: ldloc.2
554-
IL_0013: ceq
555-
IL_0015: ldloca.s V_1
556-
IL_0017: call ""bool int?.HasValue.get""
557-
IL_001c: and
558-
IL_001d: brfalse.s IL_003d
559-
IL_001f: ldloc.0
560-
IL_0020: ldfld ""bool? System.ValueTuple<int?, bool?>.Item2""
561-
IL_0025: stloc.3
562-
IL_0026: ldc.i4.1
563-
IL_0027: stloc.s V_4
564-
IL_0029: ldloca.s V_3
565-
IL_002b: call ""bool bool?.GetValueOrDefault()""
566-
IL_0030: ldloc.s V_4
567-
IL_0032: ceq
568-
IL_0034: ldloca.s V_3
569-
IL_0036: call ""bool bool?.HasValue.get""
570-
IL_003b: and
571-
IL_003c: ret
572-
IL_003d: ldc.i4.0
573-
IL_003e: ret
554+
IL_0013: bne.un.s IL_002b
555+
IL_0015: ldloc.0
556+
IL_0016: ldfld ""bool? System.ValueTuple<int?, bool?>.Item2""
557+
IL_001b: stloc.3
558+
IL_001c: ldc.i4.1
559+
IL_001d: stloc.s V_4
560+
IL_001f: ldloca.s V_3
561+
IL_0021: call ""bool bool?.GetValueOrDefault()""
562+
IL_0026: ldloc.s V_4
563+
IL_0028: ceq
564+
IL_002a: ret
565+
IL_002b: ldc.i4.0
566+
IL_002c: ret
574567
}");
575568
}
576569

src/Compilers/CSharp/Test/Emit/CodeGen/PatternTests.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4266,7 +4266,7 @@ .maxstack 2
42664266
");
42674267
compVerifier.VerifyIL("C.M2(int?)", @"
42684268
{
4269-
// Code size 23 (0x17)
4269+
// Code size 15 (0xf)
42704270
.maxstack 2
42714271
.locals init (int? V_0,
42724272
int V_1)
@@ -4278,10 +4278,7 @@ .locals init (int? V_0,
42784278
IL_0006: call ""int int?.GetValueOrDefault()""
42794279
IL_000b: ldloc.1
42804280
IL_000c: ceq
4281-
IL_000e: ldloca.s V_0
4282-
IL_0010: call ""bool int?.HasValue.get""
4283-
IL_0015: and
4284-
IL_0016: ret
4281+
IL_000e: ret
42854282
}
42864283
");
42874284
}

0 commit comments

Comments
 (0)