1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-28 04:28:01 +02:00

Fixed nullable null coalescing short circuiting

This commit is contained in:
Brian Fiete 2022-08-03 07:54:35 -07:00
parent 0bedd77f0a
commit e6352571c1
3 changed files with 34 additions and 30 deletions

View file

@ -1,6 +1,7 @@
#pragma warning disable 168
using System;
using System.Collections;
namespace Tests
{
@ -97,6 +98,22 @@ namespace Tests
String str = "Abc";
StringView? svn = str;
iNull = null;
int? iNull2 = 123;
List<int> l = null;
List<int> l2 = scope .();
int a = iNull2 ?? l.Count;
int b = iNull ?? l2.Count;
var c = iNull ?? iNull2;
Test.Assert(a == 123);
Test.Assert(b == 0);
Test.Assert(typeof(decltype(c)) == typeof(int?));
iNull ??= iNull2;
Test.Assert(iNull == 123);
}
}
}