summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Directed/nullabletypes
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-11-23 10:09:09 (GMT)
committerJiyoung Yun <jy910.yun@samsung.com>2016-11-23 10:09:09 (GMT)
commit4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch)
tree98110734c91668dfdbb126fcc0e15ddbd93738ca /tests/src/JIT/Directed/nullabletypes
parentfa45f57ed55137c75ac870356a1b8f76c84b229c (diff)
downloadcoreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'tests/src/JIT/Directed/nullabletypes')
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/StructDefinitions.cs407
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs4758
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison.cs1617
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxenum.cs158
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxenum_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxenum_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxenum_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxenum_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxinterface.cs836
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxinterface_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxinterface_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxinterface_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/boxunboxinterface_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassenum.cs158
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassenum_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassenum_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassenum_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassenum_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassinterface.cs818
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassinterface_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassinterface_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassinterface_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassinterface_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassvaluetype.cs4755
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassvaluetype_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassvaluetype_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassvaluetype_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/castclassvaluetype_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/constructor.cs55
-rw-r--r--tests/src/JIT/Directed/nullabletypes/constructor_d.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/constructor_do.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/constructor_r.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/constructor_ro.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hashcode.cs68
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hashcode_d.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hashcode_do.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hashcode_r.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hashcode_ro.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hasvalue.cs77
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hasvalue_d.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hasvalue_do.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hasvalue_r.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/hasvalue_ro.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/invocation.cs86
-rw-r--r--tests/src/JIT/Directed/nullabletypes/invocation_d.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/invocation_do.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/invocation_r.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/invocation_ro.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/invokecommon.cs66
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst.cs15378
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst2.cs17296
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst2_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst2_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst2_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst2_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinst_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstboxed.cs14494
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstboxed_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstboxed_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstboxed_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstboxed_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstenum.cs657
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstenum_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstenum_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstenum_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstenum_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstgenerics.cs16336
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstgenerics_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstgenerics_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstgenerics_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstgenerics_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstinterface.cs7017
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstinterface_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstinterface_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstinterface_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstinterface_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstvaluetype.cs19754
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstvaluetype_d.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstvaluetype_do.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstvaluetype_r.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/isinstvaluetype_ro.csproj46
-rw-r--r--tests/src/JIT/Directed/nullabletypes/tostring.cs69
-rw-r--r--tests/src/JIT/Directed/nullabletypes/tostring_d.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/tostring_do.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/tostring_r.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/tostring_ro.csproj49
-rw-r--r--tests/src/JIT/Directed/nullabletypes/unboxnullable.cs32
-rw-r--r--tests/src/JIT/Directed/nullabletypes/unboxnullable_d.csproj50
-rw-r--r--tests/src/JIT/Directed/nullabletypes/unboxnullable_do.csproj50
-rw-r--r--tests/src/JIT/Directed/nullabletypes/unboxnullable_r.csproj50
-rw-r--r--tests/src/JIT/Directed/nullabletypes/unboxnullable_ro.csproj50
-rw-r--r--tests/src/JIT/Directed/nullabletypes/value.cs107
-rw-r--r--tests/src/JIT/Directed/nullabletypes/value_d.csproj51
-rw-r--r--tests/src/JIT/Directed/nullabletypes/value_do.csproj51
-rw-r--r--tests/src/JIT/Directed/nullabletypes/value_r.csproj51
-rw-r--r--tests/src/JIT/Directed/nullabletypes/value_ro.csproj51
106 files changed, 108913 insertions, 0 deletions
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/StructDefinitions.cs b/tests/src/JIT/Directed/nullabletypes/Desktop/StructDefinitions.cs
new file mode 100644
index 0000000..66bd192
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/StructDefinitions.cs
@@ -0,0 +1,407 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System;
+using System.ComponentModel;
+
+#pragma warning disable 0183
+
+public static class Assert
+{
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static void IsTrue(bool value)
+ {
+ if (!value)
+ throw new Exception("Expected true value");
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static void IsFalse(bool value)
+ {
+ if (value)
+ throw new Exception("Expected false value");
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static void AreEqual(bool result, bool expected, string comment)
+ {
+ if (result != expected)
+ throw new Exception(String.Format("[{0}]!=[{1}]: {2}", result, expected, comment));
+ }
+}
+
+public interface IEmpty { }
+public interface INotEmpty
+{
+ void DoNothing();
+}
+
+public interface IEmptyGen<T> { }
+public interface INotEmptyGen<T>
+{
+ void DoNothing();
+}
+
+public struct EmptyStruct { }
+public struct NotEmptyStruct
+{
+ public int Field;
+}
+
+public struct NotEmptyStructQ
+{
+ public int? Field;
+}
+
+public struct NotEmptyStructA
+{
+ public int[] Field;
+}
+
+public struct NotEmptyStructQA
+{
+ public int?[] Field;
+}
+
+public struct EmptyStructGen<T> { }
+public struct NotEmptyStructGen<T>
+{
+ public T Field;
+}
+
+public struct NotEmptyStructConstrainedGen<T> where T : struct
+{
+ public T Field;
+}
+
+public struct NotEmptyStructConstrainedGenA<T> where T : struct
+{
+ public T[] Field;
+}
+
+public struct NotEmptyStructConstrainedGenQ<T> where T : struct
+{
+ public T? Field;
+}
+
+public struct NotEmptyStructConstrainedGenQA<T> where T : struct
+{
+ public T?[] Field;
+}
+
+public struct NestedStruct
+{
+ public struct Nested { }
+}
+
+public struct NestedStructGen<T>
+{
+ public struct Nested { }
+}
+
+
+[StructLayout(LayoutKind.Explicit)]
+public struct ExplicitFieldOffsetStruct
+{
+ [FieldOffset(0)]
+ public int Field00;
+ [FieldOffset(0x0f)]
+ public int Field15;
+}
+
+public struct MarshalAsStruct
+{
+ [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
+ public string StringField;
+}
+
+public struct ImplementOneInterface : IEmpty { }
+
+public struct ImplementTwoInterface : IEmpty, INotEmpty
+{
+ public void DoNothing() { }
+}
+
+public struct ImplementOneInterfaceGen<T> : IEmptyGen<T> { }
+
+public struct ImplementTwoInterfaceGen<T> : IEmptyGen<T>, INotEmptyGen<T>
+{
+ public void DoNothing() { }
+}
+
+public struct ImplementAllInterface<T> : IEmpty, INotEmpty, IEmptyGen<T>, INotEmptyGen<T>
+{
+ public void DoNothing() { }
+ void INotEmptyGen<T>.DoNothing() { }
+}
+
+public enum IntE { start = 1, }
+public enum ByteE : byte { start = 1, }
+public enum LongE : long { start = 1, }
+
+
+public struct WithMultipleGCHandleStruct
+{
+ public GCHandle H1;
+ public GCHandle H2;
+ public GCHandle H3;
+ public GCHandle H4;
+ public GCHandle H5;
+}
+
+public struct WithOnlyFXTypeStruct
+{
+ public Guid GUID;
+ public decimal DECIMAL;
+}
+
+
+public struct MixedAllStruct
+{
+ public int INT;
+ public int? IntQ;
+ public int?[] IntQA;
+ public string STRING;
+ public IntE INTE;
+ public EmptyClass EMPTYCLASS;
+ public IEmpty IEMPTY;
+ public EmptyStruct EMPTYSTRUCT;
+ public IEmptyGen<int> IEMPTYGEN;
+ public EmptyStructGen<int> EMPTYSTRUCTGEN;
+ public WithOnlyFXTypeStruct WITHONLYFXTYPESTRUCT;
+ public GCHandle GCHANDLE;
+}
+
+
+public struct EmptyClass { }
+public struct NotEmptyClass
+{
+ public int Field;
+}
+
+public struct EmptyClassGen<T> { }
+public struct NotEmptyClassGen<T>
+{
+ public T Field;
+}
+
+public struct NotEmptyClassConstrainedGen<T> where T : class
+{
+ public T Field;
+}
+public struct NestedClass
+{
+ public struct Nested { }
+}
+
+public struct NestedClassGen<T>
+{
+ public struct Nested { }
+}
+
+internal class ImplementOneInterfaceC : IEmpty { }
+
+internal class ImplementTwoInterfaceC : IEmpty, INotEmpty
+{
+ public void DoNothing() { }
+}
+
+internal class ImplementOneInterfaceGenC<T> : IEmptyGen<T> { }
+
+internal class ImplementTwoInterfaceGenC<T> : IEmptyGen<T>, INotEmptyGen<T>
+{
+ public void DoNothing() { }
+}
+
+internal class ImplementAllInterfaceC<T> : IEmpty, INotEmpty, IEmptyGen<T>, INotEmptyGen<T>
+{
+ public void DoNothing() { }
+ void INotEmptyGen<T>.DoNothing() { }
+}
+
+public sealed class SealedClass { }
+
+public delegate void SimpleDelegate();
+public delegate void GenericDelegate<T>();
+
+
+internal static class Helper
+{
+ public static GCHandle GCHANDLE;
+ static Helper()
+ {
+ GCHANDLE = GCHandle.Alloc(Console.Out);
+ }
+
+ public static char Create(char val) { return 'c'; }
+ public static bool Create(bool val) { return true; }
+ public static byte Create(byte val) { return 0x08; }
+ public static sbyte Create(sbyte val) { return -0x0e; }
+ public static short Create(short val) { return -0x0f; }
+ public static ushort Create(ushort val) { return 0xff; }
+ public static int Create(int val) { return 100; }
+ public static uint Create(uint val) { return 200; }
+ public static long Create(long val) { return int.MaxValue; }
+ public static ulong Create(ulong val) { return 300; }
+ public static float Create(float val) { return 1.15f; }
+ public static double Create(double val) { return 0.05; }
+ public static decimal Create(decimal val) { return 1.0M; }
+
+ public static IntPtr Create(IntPtr val) { return (IntPtr)1000; }
+ public static UIntPtr Create(UIntPtr val) { return (UIntPtr)2000; }
+ public static Guid Create(Guid val) { return new Guid("00020810-0001-0000-C000-000000000046"); }
+ public static GCHandle Create(GCHandle val) { return GCHANDLE; }
+ public static ByteE Create(ByteE val) { return (ByteE)9; }
+ public static IntE Create(IntE val) { return (IntE)55; }
+ public static LongE Create(LongE val) { return (LongE)34; }
+ public static EmptyStruct Create(EmptyStruct val) { return new EmptyStruct(); }
+ public static NotEmptyStruct Create(NotEmptyStruct val) { NotEmptyStruct ne = new NotEmptyStruct(); ne.Field = 100; return ne; }
+ public static NotEmptyStructQ Create(NotEmptyStructQ val) { NotEmptyStructQ neq = new NotEmptyStructQ(); neq.Field = 101; return neq; }
+ public static NotEmptyStructA Create(NotEmptyStructA val) { NotEmptyStructA nea = new NotEmptyStructA(); nea.Field = new int[] { 10 }; return nea; }
+ public static NotEmptyStructQA Create(NotEmptyStructQA val) { NotEmptyStructQA neq = new NotEmptyStructQA(); neq.Field = new int?[] { 10 }; return neq; }
+ public static EmptyStructGen<int> Create(EmptyStructGen<int> val) { return new EmptyStructGen<int>(); }
+ public static NotEmptyStructGen<int> Create(NotEmptyStructGen<int> val) { NotEmptyStructGen<int> ne = new NotEmptyStructGen<int>(); ne.Field = 88; return ne; }
+ public static NotEmptyStructConstrainedGen<int> Create(NotEmptyStructConstrainedGen<int> val) { NotEmptyStructConstrainedGen<int> ne = new NotEmptyStructConstrainedGen<int>(); ne.Field = 1010; return ne; }
+ public static NotEmptyStructConstrainedGenA<int> Create(NotEmptyStructConstrainedGenA<int> val) { NotEmptyStructConstrainedGenA<int> neq = new NotEmptyStructConstrainedGenA<int>(); neq.Field = new int[] { 11 }; return neq; }
+ public static NotEmptyStructConstrainedGenQ<int> Create(NotEmptyStructConstrainedGenQ<int> val) { NotEmptyStructConstrainedGenQ<int> neq = new NotEmptyStructConstrainedGenQ<int>(); neq.Field = 12; return neq; }
+ public static NotEmptyStructConstrainedGenQA<int> Create(NotEmptyStructConstrainedGenQA<int> val) { NotEmptyStructConstrainedGenQA<int> neq = new NotEmptyStructConstrainedGenQA<int>(); neq.Field = new int?[] { 17 }; return neq; }
+ public static NestedStruct Create(NestedStruct val) { NestedStruct ns = new NestedStruct(); return ns; }
+ public static NestedStructGen<int> Create(NestedStructGen<int> val) { NestedStructGen<int> nsg = new NestedStructGen<int>(); return nsg; }
+ public static ExplicitFieldOffsetStruct Create(ExplicitFieldOffsetStruct val) { ExplicitFieldOffsetStruct epl = new ExplicitFieldOffsetStruct(); epl.Field00 = 40; epl.Field15 = 15; return epl; }
+ public static MarshalAsStruct Create(MarshalAsStruct val) { MarshalAsStruct ma = new MarshalAsStruct(); ma.StringField = "Nullable"; return ma; }
+ public static ImplementOneInterface Create(ImplementOneInterface val) { ImplementOneInterface imp = new ImplementOneInterface(); return imp; }
+ public static ImplementTwoInterface Create(ImplementTwoInterface val) { ImplementTwoInterface imp = new ImplementTwoInterface(); return imp; }
+ public static ImplementOneInterfaceGen<int> Create(ImplementOneInterfaceGen<int> val) { ImplementOneInterfaceGen<int> imp = new ImplementOneInterfaceGen<int>(); return imp; }
+ public static ImplementTwoInterfaceGen<int> Create(ImplementTwoInterfaceGen<int> val) { ImplementTwoInterfaceGen<int> imp = new ImplementTwoInterfaceGen<int>(); return imp; }
+ public static ImplementAllInterface<int> Create(ImplementAllInterface<int> val) { ImplementAllInterface<int> imp = new ImplementAllInterface<int>(); return imp; }
+ public static WithMultipleGCHandleStruct Create(WithMultipleGCHandleStruct val)
+ { WithMultipleGCHandleStruct mgch = new WithMultipleGCHandleStruct(); mgch.H1 = GCHANDLE; mgch.H2 = GCHANDLE; mgch.H3 = GCHANDLE; mgch.H4 = GCHANDLE; mgch.H5 = GCHANDLE; return mgch; }
+ public static WithOnlyFXTypeStruct Create(WithOnlyFXTypeStruct val) { WithOnlyFXTypeStruct wofx = new WithOnlyFXTypeStruct(); wofx.DECIMAL = 50.0m; wofx.GUID = Create(default(Guid)); return wofx; }
+ public static MixedAllStruct Create(MixedAllStruct val)
+ {
+ MixedAllStruct mas;
+ mas.INT = 10;
+ mas.IntQ = null;
+ mas.IntQA = new int?[] { 10 };
+ mas.STRING = "Nullable";
+ mas.INTE = Create(default(IntE));
+ mas.EMPTYCLASS = new EmptyClass();
+ mas.IEMPTY = Create(default(ImplementOneInterface));
+ mas.EMPTYSTRUCT = Create(default(EmptyStruct));
+ mas.IEMPTYGEN = Create(default(ImplementOneInterfaceGen<int>));
+ mas.EMPTYSTRUCTGEN = Create(default(EmptyStructGen<int>));
+ mas.WITHONLYFXTYPESTRUCT = Create(default(WithOnlyFXTypeStruct));
+ mas.GCHANDLE = Create(default(GCHandle));
+
+ return mas;
+ }
+
+ public static bool Compare(char val, char val1) { return val == val1; }
+ public static bool Compare(bool val, bool val1) { return val == val1; }
+ public static bool Compare(byte val, byte val1) { return val == val1; }
+ public static bool Compare(sbyte val, sbyte val1) { return val == val1; }
+ public static bool Compare(short val, short val1) { return val == val1; }
+ public static bool Compare(ushort val, ushort val1) { return val == val1; }
+ public static bool Compare(int val, int val1) { return val == val1; }
+ public static bool Compare(uint val, uint val1) { return val == val1; }
+ public static bool Compare(long val, long val1) { return val == val1; }
+ public static bool Compare(ulong val, ulong val1) { return val == val1; }
+ public static bool Compare(float val, float val1) { return val == val1; }
+ public static bool Compare(double val, double val1) { return val == val1; }
+ public static bool Compare(decimal val, decimal val1) { return val == val1; }
+
+ public static bool Compare(IntPtr val, IntPtr val1) { return val == val1; }
+ public static bool Compare(UIntPtr val, UIntPtr val1) { return val == val1; }
+ public static bool Compare(Guid val, Guid val1) { return val == val1; }
+ public static bool Compare(GCHandle val, GCHandle val1) { return val == val1; }
+ public static bool Compare(ByteE val, ByteE val1) { return val == val1; }
+ public static bool Compare(IntE val, IntE val1) { return val == val1; }
+ public static bool Compare(LongE val, LongE val1) { return val == val1; }
+ public static bool Compare(EmptyStruct val, EmptyStruct val1) { return val.Equals(val1); }
+ public static bool Compare(NotEmptyStruct val, NotEmptyStruct val1) { return val.Field == val1.Field; }
+ public static bool Compare(NotEmptyStructQ val, NotEmptyStructQ val1) { return val.Field == val1.Field; }
+ public static bool Compare(NotEmptyStructA val, NotEmptyStructA val1) { return val.Field[0] == val1.Field[0]; }
+ public static bool Compare(NotEmptyStructQA val, NotEmptyStructQA val1) { return val.Field[0] == val1.Field[0]; }
+ public static bool Compare(EmptyStructGen<int> val, EmptyStructGen<int> val1) { return val.Equals(val1); }
+ public static bool Compare(NotEmptyStructGen<int> val, NotEmptyStructGen<int> val1) { return val.Field == val1.Field; }
+ public static bool Compare(NotEmptyStructConstrainedGen<int> val, NotEmptyStructConstrainedGen<int> val1) { return val.Field == val1.Field; }
+ public static bool Compare(NotEmptyStructConstrainedGenA<int> val, NotEmptyStructConstrainedGenA<int> val1) { return val.Field[0] == val1.Field[0]; }
+ public static bool Compare(NotEmptyStructConstrainedGenQ<int> val, NotEmptyStructConstrainedGenQ<int> val1) { return val.Field == val1.Field; }
+ public static bool Compare(NotEmptyStructConstrainedGenQA<int> val, NotEmptyStructConstrainedGenQA<int> val1) { return val.Field[0] == val1.Field[0]; }
+ public static bool Compare(NestedStruct val, NestedStruct val1) { return val.Equals(val1); }
+ public static bool Compare(NestedStructGen<int> val, NestedStructGen<int> val1) { return val.Equals(val1); }
+ public static bool Compare(ExplicitFieldOffsetStruct val, ExplicitFieldOffsetStruct val1) { return (val.Field00 == val1.Field00) && (val.Field15 == val1.Field15); }
+ public static bool Compare(MarshalAsStruct val, MarshalAsStruct val1) { return val.Equals(val1); }
+ public static bool Compare(ImplementOneInterface val, ImplementOneInterface val1) { return (val is IEmpty) && val.Equals(val1); }
+ public static bool Compare(ImplementTwoInterface val, ImplementTwoInterface val1) { return (val is IEmpty) && val is INotEmpty && val.Equals(val1); }
+ public static bool Compare(ImplementOneInterfaceGen<int> val, ImplementOneInterfaceGen<int> val1) { return val is IEmptyGen<int> && val.Equals(val1); }
+ public static bool Compare(ImplementTwoInterfaceGen<int> val, ImplementTwoInterfaceGen<int> val1) { return val is IEmptyGen<int> && val is INotEmptyGen<int> && val.Equals(val1); }
+ public static bool Compare(ImplementAllInterface<int> val, ImplementAllInterface<int> val1) { return val is IEmpty && val is INotEmpty && val is IEmptyGen<int> && val is INotEmptyGen<int> && val.Equals(val1); }
+ public static bool Compare(WithMultipleGCHandleStruct val, WithMultipleGCHandleStruct val1)
+ { return val.H1 == val1.H1 && val.H2 == val1.H2 && val.H3 == val1.H3 && val.H4 == val1.H4 && val.H5 == val1.H5; }
+ public static bool Compare(WithOnlyFXTypeStruct val, WithOnlyFXTypeStruct val1) { return val.GUID == val1.GUID && val.DECIMAL == val1.DECIMAL; }
+ public static bool Compare(MixedAllStruct val, MixedAllStruct val1)
+ {
+ return val.INT == val1.INT &&
+ val.IntQ == val1.IntQ &&
+ val.IntQA[0] == val1.IntQA[0] &&
+ val.STRING == val1.STRING &&
+ val.INTE == val1.INTE &&
+ val.EMPTYCLASS.Equals(val1.EMPTYCLASS) &&
+ val.IEMPTY.Equals(val1.IEMPTY) &&
+ Compare(val.EMPTYSTRUCT, val1.EMPTYSTRUCT) &&
+ val.IEMPTYGEN.Equals(val1.IEMPTYGEN) &&
+ Compare(val.EMPTYSTRUCTGEN, val1.EMPTYSTRUCTGEN) &&
+ Compare(val.WITHONLYFXTYPESTRUCT, val1.WITHONLYFXTYPESTRUCT) &&
+ Compare(val.GCHANDLE, val1.GCHANDLE);
+ }
+
+ public static bool Compare(char? val, char val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(bool? val, bool val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(byte? val, byte val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(sbyte? val, sbyte val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(short? val, short val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ushort? val, ushort val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(int? val, int val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(uint? val, uint val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(long? val, long val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ulong? val, ulong val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(float? val, float val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(double? val, double val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(decimal? val, decimal val1) { return val == null ? false : Compare(val.Value, val1); }
+
+ public static bool Compare(IntPtr? val, IntPtr val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(UIntPtr? val, UIntPtr val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(Guid? val, Guid val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(GCHandle? val, GCHandle val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ByteE? val, ByteE val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(IntE? val, IntE val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(LongE? val, LongE val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(EmptyStruct? val, EmptyStruct val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStruct? val, NotEmptyStruct val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStructQ? val, NotEmptyStructQ val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStructA? val, NotEmptyStructA val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStructQA? val, NotEmptyStructQA val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(EmptyStructGen<int>? val, EmptyStructGen<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStructGen<int>? val, NotEmptyStructGen<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStructConstrainedGen<int>? val, NotEmptyStructConstrainedGen<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStructConstrainedGenA<int>? val, NotEmptyStructConstrainedGenA<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStructConstrainedGenQ<int>? val, NotEmptyStructConstrainedGenQ<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NotEmptyStructConstrainedGenQA<int>? val, NotEmptyStructConstrainedGenQA<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NestedStruct? val, NestedStruct val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(NestedStructGen<int>? val, NestedStructGen<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ExplicitFieldOffsetStruct? val, ExplicitFieldOffsetStruct val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(MarshalAsStruct? val, MarshalAsStruct val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ImplementOneInterface? val, ImplementOneInterface val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ImplementTwoInterface? val, ImplementTwoInterface val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ImplementOneInterfaceGen<int>? val, ImplementOneInterfaceGen<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ImplementTwoInterfaceGen<int>? val, ImplementTwoInterfaceGen<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(ImplementAllInterface<int>? val, ImplementAllInterface<int> val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(WithMultipleGCHandleStruct? val, WithMultipleGCHandleStruct val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(WithOnlyFXTypeStruct? val, WithOnlyFXTypeStruct val1) { return val == null ? false : Compare(val.Value, val1); }
+ public static bool Compare(MixedAllStruct? val, MixedAllStruct val1) { return val == null ? false : Compare(val.Value, val1); }
+}
+#pragma warning restore 0183
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs b/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs
new file mode 100644
index 0000000..2a963a0
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype.cs
@@ -0,0 +1,4758 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Runtime.InteropServices;
+using System;
+
+
+internal class NullableTest1
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((char)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((char?)o, Helper.Create(default(char)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((char)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((char?)o, Helper.Create(default(char)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((char)(object)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((char?)(object)o, Helper.Create(default(char)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((char)(object)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((char?)(object)o, Helper.Create(default(char)));
+ }
+
+ public static void Run()
+ {
+ char? s = Helper.Create(default(char));
+
+ Console.WriteLine("--- char? s = Helper.Create(default(char)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- char? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- char u = Helper.Create(default(char)) ---");
+ char u = Helper.Create(default(char));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<char>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<char>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest2
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((bool)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((bool?)o, Helper.Create(default(bool)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((bool)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((bool?)o, Helper.Create(default(bool)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((bool)(object)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((bool?)(object)o, Helper.Create(default(bool)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((bool)(object)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((bool?)(object)o, Helper.Create(default(bool)));
+ }
+
+ public static void Run()
+ {
+ bool? s = Helper.Create(default(bool));
+
+ Console.WriteLine("--- bool? s = Helper.Create(default(bool)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- bool? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- bool u = Helper.Create(default(bool)) ---");
+ bool u = Helper.Create(default(bool));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<bool>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<bool>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest3
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((byte)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((byte?)o, Helper.Create(default(byte)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((byte)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((byte?)o, Helper.Create(default(byte)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((byte)(object)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((byte?)(object)o, Helper.Create(default(byte)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((byte)(object)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((byte?)(object)o, Helper.Create(default(byte)));
+ }
+
+ public static void Run()
+ {
+ byte? s = Helper.Create(default(byte));
+
+ Console.WriteLine("--- byte? s = Helper.Create(default(byte)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- byte? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- byte u = Helper.Create(default(byte)) ---");
+ byte u = Helper.Create(default(byte));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<byte>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<byte>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest4
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((sbyte)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((sbyte?)o, Helper.Create(default(sbyte)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((sbyte)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((sbyte?)o, Helper.Create(default(sbyte)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((sbyte)(object)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((sbyte?)(object)o, Helper.Create(default(sbyte)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((sbyte)(object)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((sbyte?)(object)o, Helper.Create(default(sbyte)));
+ }
+
+ public static void Run()
+ {
+ sbyte? s = Helper.Create(default(sbyte));
+
+ Console.WriteLine("--- sbyte? s = Helper.Create(default(sbyte)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- sbyte? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- sbyte u = Helper.Create(default(sbyte)) ---");
+ sbyte u = Helper.Create(default(sbyte));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<sbyte>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<sbyte>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest5
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((short)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((short?)o, Helper.Create(default(short)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((short)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((short?)o, Helper.Create(default(short)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((short)(object)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((short?)(object)o, Helper.Create(default(short)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((short)(object)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((short?)(object)o, Helper.Create(default(short)));
+ }
+
+ public static void Run()
+ {
+ short? s = Helper.Create(default(short));
+
+ Console.WriteLine("--- short? s = Helper.Create(default(short)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- short? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- short u = Helper.Create(default(short)) ---");
+ short u = Helper.Create(default(short));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<short>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<short>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest6
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ushort)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ushort?)o, Helper.Create(default(ushort)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ushort)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ushort?)o, Helper.Create(default(ushort)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ushort)(object)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ushort?)(object)o, Helper.Create(default(ushort)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ushort)(object)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ushort?)(object)o, Helper.Create(default(ushort)));
+ }
+
+ public static void Run()
+ {
+ ushort? s = Helper.Create(default(ushort));
+
+ Console.WriteLine("--- ushort? s = Helper.Create(default(ushort)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ushort? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ushort u = Helper.Create(default(ushort)) ---");
+ ushort u = Helper.Create(default(ushort));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ushort>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ushort>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest7
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((int)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((int?)o, Helper.Create(default(int)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((int)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((int?)o, Helper.Create(default(int)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((int)(object)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((int?)(object)o, Helper.Create(default(int)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((int)(object)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((int?)(object)o, Helper.Create(default(int)));
+ }
+
+ public static void Run()
+ {
+ int? s = Helper.Create(default(int));
+
+ Console.WriteLine("--- int? s = Helper.Create(default(int)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- int? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- int u = Helper.Create(default(int)) ---");
+ int u = Helper.Create(default(int));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<int>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<int>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest8
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((uint)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((uint?)o, Helper.Create(default(uint)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((uint)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((uint?)o, Helper.Create(default(uint)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((uint)(object)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((uint?)(object)o, Helper.Create(default(uint)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((uint)(object)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((uint?)(object)o, Helper.Create(default(uint)));
+ }
+
+ public static void Run()
+ {
+ uint? s = Helper.Create(default(uint));
+
+ Console.WriteLine("--- uint? s = Helper.Create(default(uint)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- uint? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- uint u = Helper.Create(default(uint)) ---");
+ uint u = Helper.Create(default(uint));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<uint>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<uint>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest9
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((long)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((long?)o, Helper.Create(default(long)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((long)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((long?)o, Helper.Create(default(long)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((long)(object)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((long?)(object)o, Helper.Create(default(long)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((long)(object)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((long?)(object)o, Helper.Create(default(long)));
+ }
+
+ public static void Run()
+ {
+ long? s = Helper.Create(default(long));
+
+ Console.WriteLine("--- long? s = Helper.Create(default(long)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- long? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- long u = Helper.Create(default(long)) ---");
+ long u = Helper.Create(default(long));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<long>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<long>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest10
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ulong)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ulong?)o, Helper.Create(default(ulong)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ulong)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ulong?)o, Helper.Create(default(ulong)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ulong)(object)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ulong?)(object)o, Helper.Create(default(ulong)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ulong)(object)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ulong?)(object)o, Helper.Create(default(ulong)));
+ }
+
+ public static void Run()
+ {
+ ulong? s = Helper.Create(default(ulong));
+
+ Console.WriteLine("--- ulong? s = Helper.Create(default(ulong)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ulong? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ulong u = Helper.Create(default(ulong)) ---");
+ ulong u = Helper.Create(default(ulong));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ulong>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ulong>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest11
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((float)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((float?)o, Helper.Create(default(float)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((float)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((float?)o, Helper.Create(default(float)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((float)(object)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((float?)(object)o, Helper.Create(default(float)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((float)(object)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((float?)(object)o, Helper.Create(default(float)));
+ }
+
+ public static void Run()
+ {
+ float? s = Helper.Create(default(float));
+
+ Console.WriteLine("--- float? s = Helper.Create(default(float)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- float? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- float u = Helper.Create(default(float)) ---");
+ float u = Helper.Create(default(float));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<float>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<float>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest12
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((double)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((double?)o, Helper.Create(default(double)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((double)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((double?)o, Helper.Create(default(double)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((double)(object)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((double?)(object)o, Helper.Create(default(double)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((double)(object)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((double?)(object)o, Helper.Create(default(double)));
+ }
+
+ public static void Run()
+ {
+ double? s = Helper.Create(default(double));
+
+ Console.WriteLine("--- double? s = Helper.Create(default(double)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- double? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- double u = Helper.Create(default(double)) ---");
+ double u = Helper.Create(default(double));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<double>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<double>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest13
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((decimal)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((decimal?)o, Helper.Create(default(decimal)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((decimal)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((decimal?)o, Helper.Create(default(decimal)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((decimal)(object)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((decimal?)(object)o, Helper.Create(default(decimal)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((decimal)(object)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((decimal?)(object)o, Helper.Create(default(decimal)));
+ }
+
+ public static void Run()
+ {
+ decimal? s = Helper.Create(default(decimal));
+
+ Console.WriteLine("--- decimal? s = Helper.Create(default(decimal)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- decimal? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- decimal u = Helper.Create(default(decimal)) ---");
+ decimal u = Helper.Create(default(decimal));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<decimal>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<decimal>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest14
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((IntPtr)o, Helper.Create(default(IntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((IntPtr?)o, Helper.Create(default(IntPtr)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((IntPtr)o, Helper.Create(default(IntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((IntPtr?)o, Helper.Create(default(IntPtr)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((IntPtr)(object)o, Helper.Create(default(IntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((IntPtr?)(object)o, Helper.Create(default(IntPtr)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((IntPtr)(object)o, Helper.Create(default(IntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((IntPtr?)(object)o, Helper.Create(default(IntPtr)));
+ }
+
+ public static void Run()
+ {
+ IntPtr? s = Helper.Create(default(IntPtr));
+
+ Console.WriteLine("--- IntPtr? s = Helper.Create(default(IntPtr)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- IntPtr? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- IntPtr u = Helper.Create(default(IntPtr)) ---");
+ IntPtr u = Helper.Create(default(IntPtr));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<IntPtr>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<IntPtr>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest15
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((UIntPtr)o, Helper.Create(default(UIntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((UIntPtr?)o, Helper.Create(default(UIntPtr)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((UIntPtr)o, Helper.Create(default(UIntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((UIntPtr?)o, Helper.Create(default(UIntPtr)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((UIntPtr)(object)o, Helper.Create(default(UIntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((UIntPtr?)(object)o, Helper.Create(default(UIntPtr)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((UIntPtr)(object)o, Helper.Create(default(UIntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((UIntPtr?)(object)o, Helper.Create(default(UIntPtr)));
+ }
+
+ public static void Run()
+ {
+ UIntPtr? s = Helper.Create(default(UIntPtr));
+
+ Console.WriteLine("--- UIntPtr? s = Helper.Create(default(UIntPtr)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- UIntPtr? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- UIntPtr u = Helper.Create(default(UIntPtr)) ---");
+ UIntPtr u = Helper.Create(default(UIntPtr));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<UIntPtr>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<UIntPtr>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest16
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((Guid)o, Helper.Create(default(Guid)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((Guid?)o, Helper.Create(default(Guid)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((Guid)o, Helper.Create(default(Guid)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((Guid?)o, Helper.Create(default(Guid)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((Guid)(object)o, Helper.Create(default(Guid)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((Guid?)(object)o, Helper.Create(default(Guid)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((Guid)(object)o, Helper.Create(default(Guid)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((Guid?)(object)o, Helper.Create(default(Guid)));
+ }
+
+ public static void Run()
+ {
+ Guid? s = Helper.Create(default(Guid));
+
+ Console.WriteLine("--- Guid? s = Helper.Create(default(Guid)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- Guid? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- Guid u = Helper.Create(default(Guid)) ---");
+ Guid u = Helper.Create(default(Guid));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<Guid>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<Guid>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest17
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((GCHandle)o, Helper.Create(default(GCHandle)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((GCHandle?)o, Helper.Create(default(GCHandle)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((GCHandle)o, Helper.Create(default(GCHandle)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((GCHandle?)o, Helper.Create(default(GCHandle)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((GCHandle)(object)o, Helper.Create(default(GCHandle)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((GCHandle?)(object)o, Helper.Create(default(GCHandle)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((GCHandle)(object)o, Helper.Create(default(GCHandle)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((GCHandle?)(object)o, Helper.Create(default(GCHandle)));
+ }
+
+ public static void Run()
+ {
+ GCHandle? s = Helper.Create(default(GCHandle));
+
+ Console.WriteLine("--- GCHandle? s = Helper.Create(default(GCHandle)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- GCHandle? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- GCHandle u = Helper.Create(default(GCHandle)) ---");
+ GCHandle u = Helper.Create(default(GCHandle));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<GCHandle>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<GCHandle>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest18
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ByteE)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ByteE?)o, Helper.Create(default(ByteE)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ByteE)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ByteE?)o, Helper.Create(default(ByteE)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ByteE)(object)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ByteE?)(object)o, Helper.Create(default(ByteE)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ByteE)(object)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ByteE?)(object)o, Helper.Create(default(ByteE)));
+ }
+
+ public static void Run()
+ {
+ ByteE? s = Helper.Create(default(ByteE));
+
+ Console.WriteLine("--- ByteE? s = Helper.Create(default(ByteE)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ByteE? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ByteE u = Helper.Create(default(ByteE)) ---");
+ ByteE u = Helper.Create(default(ByteE));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ByteE>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ByteE>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest19
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((IntE)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((IntE?)o, Helper.Create(default(IntE)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((IntE)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((IntE?)o, Helper.Create(default(IntE)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((IntE)(object)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((IntE?)(object)o, Helper.Create(default(IntE)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((IntE)(object)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((IntE?)(object)o, Helper.Create(default(IntE)));
+ }
+
+ public static void Run()
+ {
+ IntE? s = Helper.Create(default(IntE));
+
+ Console.WriteLine("--- IntE? s = Helper.Create(default(IntE)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- IntE? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- IntE u = Helper.Create(default(IntE)) ---");
+ IntE u = Helper.Create(default(IntE));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<IntE>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<IntE>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest20
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((LongE)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((LongE?)o, Helper.Create(default(LongE)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((LongE)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((LongE?)o, Helper.Create(default(LongE)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((LongE)(object)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((LongE?)(object)o, Helper.Create(default(LongE)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((LongE)(object)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((LongE?)(object)o, Helper.Create(default(LongE)));
+ }
+
+ public static void Run()
+ {
+ LongE? s = Helper.Create(default(LongE));
+
+ Console.WriteLine("--- LongE? s = Helper.Create(default(LongE)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- LongE? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- LongE u = Helper.Create(default(LongE)) ---");
+ LongE u = Helper.Create(default(LongE));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<LongE>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<LongE>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest21
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStruct)o, Helper.Create(default(EmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((EmptyStruct?)o, Helper.Create(default(EmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStruct)o, Helper.Create(default(EmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((EmptyStruct?)o, Helper.Create(default(EmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStruct)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((EmptyStruct?)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((EmptyStruct)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((EmptyStruct?)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+
+ public static void Run()
+ {
+ EmptyStruct? s = Helper.Create(default(EmptyStruct));
+
+ Console.WriteLine("--- EmptyStruct? s = Helper.Create(default(EmptyStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- EmptyStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- EmptyStruct u = Helper.Create(default(EmptyStruct)) ---");
+ EmptyStruct u = Helper.Create(default(EmptyStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<EmptyStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<EmptyStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest22
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStruct)o, Helper.Create(default(NotEmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStruct?)o, Helper.Create(default(NotEmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStruct)o, Helper.Create(default(NotEmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStruct?)o, Helper.Create(default(NotEmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStruct)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStruct?)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStruct)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStruct?)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStruct? s = Helper.Create(default(NotEmptyStruct));
+
+ Console.WriteLine("--- NotEmptyStruct? s = Helper.Create(default(NotEmptyStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStruct u = Helper.Create(default(NotEmptyStruct)) ---");
+ NotEmptyStruct u = Helper.Create(default(NotEmptyStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest23
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQ)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructQ?)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQ)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructQ?)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQ)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructQ?)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQ)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructQ?)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructQ? s = Helper.Create(default(NotEmptyStructQ));
+
+ Console.WriteLine("--- NotEmptyStructQ? s = Helper.Create(default(NotEmptyStructQ)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructQ? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructQ u = Helper.Create(default(NotEmptyStructQ)) ---");
+ NotEmptyStructQ u = Helper.Create(default(NotEmptyStructQ));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructQ>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructQ>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest24
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructA)o, Helper.Create(default(NotEmptyStructA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructA?)o, Helper.Create(default(NotEmptyStructA)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructA)o, Helper.Create(default(NotEmptyStructA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructA?)o, Helper.Create(default(NotEmptyStructA)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructA)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructA?)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructA)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructA?)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructA? s = Helper.Create(default(NotEmptyStructA));
+
+ Console.WriteLine("--- NotEmptyStructA? s = Helper.Create(default(NotEmptyStructA)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructA? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructA u = Helper.Create(default(NotEmptyStructA)) ---");
+ NotEmptyStructA u = Helper.Create(default(NotEmptyStructA));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructA>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructA>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest25
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQA)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructQA?)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQA)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructQA?)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQA)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructQA?)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQA)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructQA?)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructQA? s = Helper.Create(default(NotEmptyStructQA));
+
+ Console.WriteLine("--- NotEmptyStructQA? s = Helper.Create(default(NotEmptyStructQA)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructQA? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructQA u = Helper.Create(default(NotEmptyStructQA)) ---");
+ NotEmptyStructQA u = Helper.Create(default(NotEmptyStructQA));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructQA>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructQA>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest26
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStructGen<int>)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((EmptyStructGen<int>?)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStructGen<int>)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((EmptyStructGen<int>?)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStructGen<int>)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((EmptyStructGen<int>?)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((EmptyStructGen<int>)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((EmptyStructGen<int>?)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+
+ public static void Run()
+ {
+ EmptyStructGen<int>? s = Helper.Create(default(EmptyStructGen<int>));
+
+ Console.WriteLine("--- EmptyStructGen<int>? s = Helper.Create(default(EmptyStructGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- EmptyStructGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- EmptyStructGen<int> u = Helper.Create(default(EmptyStructGen<int>)) ---");
+ EmptyStructGen<int> u = Helper.Create(default(EmptyStructGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<EmptyStructGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<EmptyStructGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest27
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructGen<int>)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructGen<int>?)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructGen<int>)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructGen<int>?)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructGen<int>)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructGen<int>?)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructGen<int>)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructGen<int>?)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructGen<int>? s = Helper.Create(default(NotEmptyStructGen<int>));
+
+ Console.WriteLine("--- NotEmptyStructGen<int>? s = Helper.Create(default(NotEmptyStructGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructGen<int> u = Helper.Create(default(NotEmptyStructGen<int>)) ---");
+ NotEmptyStructGen<int> u = Helper.Create(default(NotEmptyStructGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest28
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGen<int>? s = Helper.Create(default(NotEmptyStructConstrainedGen<int>));
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGen<int>? s = Helper.Create(default(NotEmptyStructConstrainedGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGen<int> u = Helper.Create(default(NotEmptyStructConstrainedGen<int>)) ---");
+ NotEmptyStructConstrainedGen<int> u = Helper.Create(default(NotEmptyStructConstrainedGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructConstrainedGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructConstrainedGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest29
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenA<int>));
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenA<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenA<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenA<int> u = Helper.Create(default(NotEmptyStructConstrainedGenA<int>)) ---");
+ NotEmptyStructConstrainedGenA<int> u = Helper.Create(default(NotEmptyStructConstrainedGenA<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructConstrainedGenA<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructConstrainedGenA<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest30
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenQ<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>));
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQ<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQ<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQ<int> u = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)) ---");
+ NotEmptyStructConstrainedGenQ<int> u = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructConstrainedGenQ<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructConstrainedGenQ<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest31
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenQA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>));
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQA<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQA<int> u = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)) ---");
+ NotEmptyStructConstrainedGenQA<int> u = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructConstrainedGenQA<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructConstrainedGenQA<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest32
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStruct)o, Helper.Create(default(NestedStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NestedStruct?)o, Helper.Create(default(NestedStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStruct)o, Helper.Create(default(NestedStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NestedStruct?)o, Helper.Create(default(NestedStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStruct)(object)o, Helper.Create(default(NestedStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NestedStruct?)(object)o, Helper.Create(default(NestedStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NestedStruct)(object)o, Helper.Create(default(NestedStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NestedStruct?)(object)o, Helper.Create(default(NestedStruct)));
+ }
+
+ public static void Run()
+ {
+ NestedStruct? s = Helper.Create(default(NestedStruct));
+
+ Console.WriteLine("--- NestedStruct? s = Helper.Create(default(NestedStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NestedStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NestedStruct u = Helper.Create(default(NestedStruct)) ---");
+ NestedStruct u = Helper.Create(default(NestedStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NestedStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NestedStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest33
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStructGen<int>)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NestedStructGen<int>?)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStructGen<int>)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NestedStructGen<int>?)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStructGen<int>)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NestedStructGen<int>?)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NestedStructGen<int>)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NestedStructGen<int>?)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+
+ public static void Run()
+ {
+ NestedStructGen<int>? s = Helper.Create(default(NestedStructGen<int>));
+
+ Console.WriteLine("--- NestedStructGen<int>? s = Helper.Create(default(NestedStructGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NestedStructGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NestedStructGen<int> u = Helper.Create(default(NestedStructGen<int>)) ---");
+ NestedStructGen<int> u = Helper.Create(default(NestedStructGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NestedStructGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NestedStructGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest34
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct?)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct?)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct?)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct?)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+
+ public static void Run()
+ {
+ ExplicitFieldOffsetStruct? s = Helper.Create(default(ExplicitFieldOffsetStruct));
+
+ Console.WriteLine("--- ExplicitFieldOffsetStruct? s = Helper.Create(default(ExplicitFieldOffsetStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ExplicitFieldOffsetStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ExplicitFieldOffsetStruct u = Helper.Create(default(ExplicitFieldOffsetStruct)) ---");
+ ExplicitFieldOffsetStruct u = Helper.Create(default(ExplicitFieldOffsetStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ExplicitFieldOffsetStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ExplicitFieldOffsetStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest37
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((MarshalAsStruct)o, Helper.Create(default(MarshalAsStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((MarshalAsStruct?)o, Helper.Create(default(MarshalAsStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((MarshalAsStruct)o, Helper.Create(default(MarshalAsStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((MarshalAsStruct?)o, Helper.Create(default(MarshalAsStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((MarshalAsStruct)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((MarshalAsStruct?)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((MarshalAsStruct)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((MarshalAsStruct?)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+
+ public static void Run()
+ {
+ MarshalAsStruct? s = Helper.Create(default(MarshalAsStruct));
+
+ Console.WriteLine("--- MarshalAsStruct? s = Helper.Create(default(MarshalAsStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- MarshalAsStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- MarshalAsStruct u = Helper.Create(default(MarshalAsStruct)) ---");
+ MarshalAsStruct u = Helper.Create(default(MarshalAsStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<MarshalAsStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<MarshalAsStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest38
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementOneInterface?)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementOneInterface?)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementOneInterface?)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementOneInterface?)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface));
+
+ Console.WriteLine("--- ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementOneInterface? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementOneInterface u = Helper.Create(default(ImplementOneInterface)) ---");
+ ImplementOneInterface u = Helper.Create(default(ImplementOneInterface));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementOneInterface>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementOneInterface>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest39
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementTwoInterface?)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementTwoInterface?)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementTwoInterface?)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementTwoInterface?)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface));
+
+ Console.WriteLine("--- ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementTwoInterface? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementTwoInterface u = Helper.Create(default(ImplementTwoInterface)) ---");
+ ImplementTwoInterface u = Helper.Create(default(ImplementTwoInterface));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementTwoInterface>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementTwoInterface>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest40
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int> u = Helper.Create(default(ImplementOneInterfaceGen<int>)) ---");
+ ImplementOneInterfaceGen<int> u = Helper.Create(default(ImplementOneInterfaceGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementOneInterfaceGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementOneInterfaceGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest41
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int> u = Helper.Create(default(ImplementTwoInterfaceGen<int>)) ---");
+ ImplementTwoInterfaceGen<int> u = Helper.Create(default(ImplementTwoInterfaceGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementTwoInterfaceGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementTwoInterfaceGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest42
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>));
+
+ Console.WriteLine("--- ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementAllInterface<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementAllInterface<int> u = Helper.Create(default(ImplementAllInterface<int>)) ---");
+ ImplementAllInterface<int> u = Helper.Create(default(ImplementAllInterface<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementAllInterface<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementAllInterface<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest43
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct?)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct?)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct?)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct?)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+
+ public static void Run()
+ {
+ WithMultipleGCHandleStruct? s = Helper.Create(default(WithMultipleGCHandleStruct));
+
+ Console.WriteLine("--- WithMultipleGCHandleStruct? s = Helper.Create(default(WithMultipleGCHandleStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- WithMultipleGCHandleStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- WithMultipleGCHandleStruct u = Helper.Create(default(WithMultipleGCHandleStruct)) ---");
+ WithMultipleGCHandleStruct u = Helper.Create(default(WithMultipleGCHandleStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<WithMultipleGCHandleStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<WithMultipleGCHandleStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest44
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct?)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct?)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct?)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct?)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+
+ public static void Run()
+ {
+ WithOnlyFXTypeStruct? s = Helper.Create(default(WithOnlyFXTypeStruct));
+
+ Console.WriteLine("--- WithOnlyFXTypeStruct? s = Helper.Create(default(WithOnlyFXTypeStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- WithOnlyFXTypeStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- WithOnlyFXTypeStruct u = Helper.Create(default(WithOnlyFXTypeStruct)) ---");
+ WithOnlyFXTypeStruct u = Helper.Create(default(WithOnlyFXTypeStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<WithOnlyFXTypeStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<WithOnlyFXTypeStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest45
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((MixedAllStruct)o, Helper.Create(default(MixedAllStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((MixedAllStruct?)o, Helper.Create(default(MixedAllStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((MixedAllStruct)o, Helper.Create(default(MixedAllStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((MixedAllStruct?)o, Helper.Create(default(MixedAllStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((MixedAllStruct)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((MixedAllStruct?)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((MixedAllStruct)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((MixedAllStruct?)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+
+ public static void Run()
+ {
+ MixedAllStruct? s = Helper.Create(default(MixedAllStruct));
+
+ Console.WriteLine("--- MixedAllStruct? s = Helper.Create(default(MixedAllStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- MixedAllStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- MixedAllStruct u = Helper.Create(default(MixedAllStruct)) ---");
+ MixedAllStruct u = Helper.Create(default(MixedAllStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<MixedAllStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<MixedAllStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class Test
+{
+ private static int Main()
+ {
+ try
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ NullableTest3.Run();
+ NullableTest4.Run();
+ NullableTest5.Run();
+ NullableTest6.Run();
+ NullableTest7.Run();
+ NullableTest8.Run();
+ NullableTest9.Run();
+ NullableTest10.Run();
+ NullableTest11.Run();
+ NullableTest12.Run();
+ NullableTest13.Run();
+ NullableTest14.Run();
+ NullableTest15.Run();
+ NullableTest16.Run();
+ NullableTest17.Run();
+ NullableTest18.Run();
+ NullableTest19.Run();
+ NullableTest20.Run();
+ NullableTest21.Run();
+ NullableTest22.Run();
+ NullableTest23.Run();
+ NullableTest24.Run();
+ NullableTest25.Run();
+ NullableTest26.Run();
+ NullableTest27.Run();
+ NullableTest28.Run();
+ NullableTest29.Run();
+ NullableTest30.Run();
+ NullableTest31.Run();
+ NullableTest32.Run();
+ NullableTest33.Run();
+ NullableTest34.Run();
+ NullableTest37.Run();
+ NullableTest38.Run();
+ NullableTest39.Run();
+ NullableTest40.Run();
+ NullableTest41.Run();
+ NullableTest42.Run();
+ NullableTest43.Run();
+ NullableTest44.Run();
+ NullableTest45.Run();
+ }
+ catch (System.Exception e)
+ {
+ Console.WriteLine("Test Failed" + e.ToString());
+ Console.WriteLine(e);
+ return 666;
+ }
+
+ Console.WriteLine("Test SUCCESS");
+ return 100;
+ }
+}
+
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_do.csproj b/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_do.csproj
new file mode 100644
index 0000000..9f3ad34
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_do.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxvaluetype.cs" />
+ <Compile Include="StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_r.csproj b/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_r.csproj
new file mode 100644
index 0000000..557245a
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_r.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxvaluetype.cs" />
+ <Compile Include="StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_ro.csproj b/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_ro.csproj
new file mode 100644
index 0000000..ccb575d
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/boxunboxvaluetype_ro.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxvaluetype.cs" />
+ <Compile Include="StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison.cs b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison.cs
new file mode 100644
index 0000000..7d8e353
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison.cs
@@ -0,0 +1,1617 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+using System;
+
+
+internal class NullableTest1
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((char?)o) == null;
+ }
+
+ public static void Run()
+ {
+ char? s = null;
+
+ Console.WriteLine("char");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest2
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((bool?)o) == null;
+ }
+
+ public static void Run()
+ {
+ bool? s = null;
+
+ Console.WriteLine("bool");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest3
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((byte?)o) == null;
+ }
+
+ public static void Run()
+ {
+ byte? s = null;
+
+ Console.WriteLine("byte");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest4
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((sbyte?)o) == null;
+ }
+
+ public static void Run()
+ {
+ sbyte? s = null;
+
+ Console.WriteLine("sbyte");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest5
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((short?)o) == null;
+ }
+
+ public static void Run()
+ {
+ short? s = null;
+
+ Console.WriteLine("short");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest6
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ushort?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ushort? s = null;
+
+ Console.WriteLine("ushort");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest7
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((int?)o) == null;
+ }
+
+ public static void Run()
+ {
+ int? s = null;
+
+ Console.WriteLine("int");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest8
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((uint?)o) == null;
+ }
+
+ public static void Run()
+ {
+ uint? s = null;
+
+ Console.WriteLine("uint");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest9
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((long?)o) == null;
+ }
+
+ public static void Run()
+ {
+ long? s = null;
+
+ Console.WriteLine("long");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest10
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ulong?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ulong? s = null;
+
+ Console.WriteLine("ulong");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest11
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((float?)o) == null;
+ }
+
+ public static void Run()
+ {
+ float? s = null;
+
+ Console.WriteLine("float");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest12
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((double?)o) == null;
+ }
+
+ public static void Run()
+ {
+ double? s = null;
+
+ Console.WriteLine("double");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest13
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((decimal?)o) == null;
+ }
+
+ public static void Run()
+ {
+ decimal? s = null;
+
+ Console.WriteLine("decimal");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest14
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((IntPtr?)o) == null;
+ }
+
+ public static void Run()
+ {
+ IntPtr? s = null;
+
+ Console.WriteLine("IntPtr");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest15
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((UIntPtr?)o) == null;
+ }
+
+ public static void Run()
+ {
+ UIntPtr? s = null;
+
+ Console.WriteLine("UIntPtr");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest16
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((Guid?)o) == null;
+ }
+
+ public static void Run()
+ {
+ Guid? s = null;
+
+ Console.WriteLine("Guid");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest17
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((GCHandle?)o) == null;
+ }
+
+ public static void Run()
+ {
+ GCHandle? s = null;
+
+ Console.WriteLine("GCHandle");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest18
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ByteE?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ByteE? s = null;
+
+ Console.WriteLine("ByteE");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest19
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((IntE?)o) == null;
+ }
+
+ public static void Run()
+ {
+ IntE? s = null;
+
+ Console.WriteLine("IntE");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest20
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((LongE?)o) == null;
+ }
+
+ public static void Run()
+ {
+ LongE? s = null;
+
+ Console.WriteLine("LongE");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest21
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((EmptyStruct?)o) == null;
+ }
+
+ public static void Run()
+ {
+ EmptyStruct? s = null;
+
+ Console.WriteLine("EmptyStruct");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest22
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStruct?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStruct? s = null;
+
+ Console.WriteLine("NotEmptyStruct");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest23
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStructQ?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructQ? s = null;
+
+ Console.WriteLine("NotEmptyStructQ");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest24
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStructA?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructA? s = null;
+
+ Console.WriteLine("NotEmptyStructA");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest25
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStructQA?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructQA? s = null;
+
+ Console.WriteLine("NotEmptyStructQA");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest26
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((EmptyStructGen<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ EmptyStructGen<int>? s = null;
+
+ Console.WriteLine("EmptyStructGen<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest27
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStructGen<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructGen<int>? s = null;
+
+ Console.WriteLine("NotEmptyStructGen<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest28
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStructConstrainedGen<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGen<int>? s = null;
+
+ Console.WriteLine("NotEmptyStructConstrainedGen<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest29
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStructConstrainedGenA<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenA<int>? s = null;
+
+ Console.WriteLine("NotEmptyStructConstrainedGenA<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest30
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStructConstrainedGenQ<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenQ<int>? s = null;
+
+ Console.WriteLine("NotEmptyStructConstrainedGenQ<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest31
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NotEmptyStructConstrainedGenQA<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenQA<int>? s = null;
+
+ Console.WriteLine("NotEmptyStructConstrainedGenQA<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest32
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NestedStruct?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NestedStruct? s = null;
+
+ Console.WriteLine("NestedStruct");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest33
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((NestedStructGen<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ NestedStructGen<int>? s = null;
+
+ Console.WriteLine("NestedStructGen<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest34
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ExplicitFieldOffsetStruct?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ExplicitFieldOffsetStruct? s = null;
+
+ Console.WriteLine("ExplicitFieldOffsetStruct");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest37
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((MarshalAsStruct?)o) == null;
+ }
+
+ public static void Run()
+ {
+ MarshalAsStruct? s = null;
+
+ Console.WriteLine("MarshalAsStruct");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest38
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ImplementOneInterface?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterface? s = null;
+
+ Console.WriteLine("ImplementOneInterface");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest39
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ImplementTwoInterface?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterface? s = null;
+
+ Console.WriteLine("ImplementTwoInterface");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest40
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ImplementOneInterfaceGen<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterfaceGen<int>? s = null;
+
+ Console.WriteLine("ImplementOneInterfaceGen<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest41
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ImplementTwoInterfaceGen<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterfaceGen<int>? s = null;
+
+ Console.WriteLine("ImplementTwoInterfaceGen<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest42
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((ImplementAllInterface<int>?)o) == null;
+ }
+
+ public static void Run()
+ {
+ ImplementAllInterface<int>? s = null;
+
+ Console.WriteLine("ImplementAllInterface<int>");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest43
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((WithMultipleGCHandleStruct?)o) == null;
+ }
+
+ public static void Run()
+ {
+ WithMultipleGCHandleStruct? s = null;
+
+ Console.WriteLine("WithMultipleGCHandleStruct");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest44
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((WithOnlyFXTypeStruct?)o) == null;
+ }
+
+ public static void Run()
+ {
+ WithOnlyFXTypeStruct? s = null;
+
+ Console.WriteLine("WithOnlyFXTypeStruct");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class NullableTest45
+{
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ return ((object)o) == null;
+ }
+
+ private static bool BoxUnboxToQGen<T>(T? o) where T : struct
+ {
+ return ((T?)o) == null;
+ }
+
+ private static bool BoxUnboxToNQ(object o)
+ {
+ return o == null;
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return ((MixedAllStruct?)o) == null;
+ }
+
+ public static void Run()
+ {
+ MixedAllStruct? s = null;
+
+ Console.WriteLine("MixedAllStruct");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+ Assert.IsTrue(BoxUnboxToNQGen(s));
+ Assert.IsTrue(BoxUnboxToQGen(s));
+ }
+}
+
+
+
+internal class Test
+{
+ private static int Main()
+ {
+ try
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ NullableTest3.Run();
+ NullableTest4.Run();
+ NullableTest5.Run();
+ NullableTest6.Run();
+ NullableTest7.Run();
+ NullableTest8.Run();
+ NullableTest9.Run();
+ NullableTest10.Run();
+ NullableTest11.Run();
+ NullableTest12.Run();
+ NullableTest13.Run();
+ NullableTest14.Run();
+ NullableTest15.Run();
+ NullableTest16.Run();
+ NullableTest17.Run();
+ NullableTest18.Run();
+ NullableTest19.Run();
+ NullableTest20.Run();
+ NullableTest21.Run();
+ NullableTest22.Run();
+ NullableTest23.Run();
+ NullableTest24.Run();
+ NullableTest25.Run();
+ NullableTest26.Run();
+ NullableTest27.Run();
+ NullableTest28.Run();
+ NullableTest29.Run();
+ NullableTest30.Run();
+ NullableTest31.Run();
+ NullableTest32.Run();
+ NullableTest33.Run();
+ NullableTest34.Run();
+ NullableTest37.Run();
+ NullableTest38.Run();
+ NullableTest39.Run();
+ NullableTest40.Run();
+ NullableTest41.Run();
+ NullableTest42.Run();
+ NullableTest43.Run();
+ NullableTest44.Run();
+ NullableTest45.Run();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Test FAILED");
+ Console.WriteLine(ex);
+ return 666;
+ }
+ Console.WriteLine("Test SUCCESS");
+ return 100;
+ }
+}
+
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_d.csproj b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_d.csproj
new file mode 100644
index 0000000..8e8c9e6
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_d.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="nullcomparaison.cs" />
+ <Compile Include="StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_do.csproj b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_do.csproj
new file mode 100644
index 0000000..30cf499
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_do.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="nullcomparaison.cs" />
+ <Compile Include="StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_r.csproj b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_r.csproj
new file mode 100644
index 0000000..6efda5a
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_r.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="nullcomparaison.cs" />
+ <Compile Include="StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_ro.csproj b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_ro.csproj
new file mode 100644
index 0000000..5ca46ee
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/Desktop/nullcomparaison_ro.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="nullcomparaison.cs" />
+ <Compile Include="StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxenum.cs b/tests/src/JIT/Directed/nullabletypes/boxunboxenum.cs
new file mode 100644
index 0000000..d8779b7
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxenum.cs
@@ -0,0 +1,158 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+using System;
+
+
+internal class NullableTest1
+{
+ private static bool BoxUnboxToNQ(Enum o)
+ {
+ try
+ {
+ return Helper.Compare((IntE)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(Enum o)
+ {
+ return Helper.Compare((IntE?)o, Helper.Create(default(IntE)));
+ }
+
+ public static void Run()
+ {
+ IntE? s = Helper.Create(default(IntE));
+
+ Console.WriteLine("--- IntE? s = Helper.Create(default(IntE)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- IntE? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ IntE u = Helper.Create(default(IntE));
+
+ Console.WriteLine("--- IntE u = Helper.Create(default(IntE)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest2
+{
+ private static bool BoxUnboxToNQ(Enum o)
+ {
+ try
+ {
+ return Helper.Compare((ByteE)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(Enum o)
+ {
+ return Helper.Compare((ByteE?)o, Helper.Create(default(ByteE)));
+ }
+
+ public static void Run()
+ {
+ ByteE? s = Helper.Create(default(ByteE));
+
+ Console.WriteLine("--- ByteE? s = Helper.Create(default(ByteE)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ByteE? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ByteE u = Helper.Create(default(ByteE));
+
+ Console.WriteLine("--- ByteE u = Helper.Create(default(ByteE)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest3
+{
+ private static bool BoxUnboxToNQ(Enum o)
+ {
+ try
+ {
+ return Helper.Compare((LongE)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(Enum o)
+ {
+ return Helper.Compare((LongE?)o, Helper.Create(default(LongE)));
+ }
+
+ public static void Run()
+ {
+ LongE? s = Helper.Create(default(LongE));
+
+ Console.WriteLine("--- LongE? s = Helper.Create(default(LongE)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- LongE? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ LongE u = Helper.Create(default(LongE));
+
+ Console.WriteLine("--- LongE u = Helper.Create(default(LongE)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class Test
+{
+ private static int Main()
+ {
+ try
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ NullableTest3.Run();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Test FAILED");
+ Console.WriteLine(ex);
+ return 666;
+ }
+ Console.WriteLine("Test SUCCESS");
+ return 100;
+ }
+}
+
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxenum_d.csproj b/tests/src/JIT/Directed/nullabletypes/boxunboxenum_d.csproj
new file mode 100644
index 0000000..b707967
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxenum_d.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxenum.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxenum_do.csproj b/tests/src/JIT/Directed/nullabletypes/boxunboxenum_do.csproj
new file mode 100644
index 0000000..548ec39
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxenum_do.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxenum.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxenum_r.csproj b/tests/src/JIT/Directed/nullabletypes/boxunboxenum_r.csproj
new file mode 100644
index 0000000..d3b991a
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxenum_r.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxenum.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxenum_ro.csproj b/tests/src/JIT/Directed/nullabletypes/boxunboxenum_ro.csproj
new file mode 100644
index 0000000..a8ac0b5
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxenum_ro.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxenum.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxinterface.cs b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface.cs
new file mode 100644
index 0000000..ef2a086
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface.cs
@@ -0,0 +1,836 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+using System;
+
+
+internal class NullableTest1
+{
+ private static bool BoxUnboxToNQ(IEmpty o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmpty o)
+ {
+ return Helper.Compare((ImplementOneInterface?)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface));
+
+ Console.WriteLine("--- ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementOneInterface? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementOneInterface u = Helper.Create(default(ImplementOneInterface));
+
+ Console.WriteLine("--- ImplementOneInterface u = Helper.Create(default(ImplementOneInterface)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest2
+{
+ private static bool BoxUnboxToNQ(IEmpty o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmpty o)
+ {
+ return Helper.Compare((ImplementTwoInterface?)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface));
+
+ Console.WriteLine("--- ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementTwoInterface? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementTwoInterface u = Helper.Create(default(ImplementTwoInterface));
+
+ Console.WriteLine("--- ImplementTwoInterface u = Helper.Create(default(ImplementTwoInterface)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest3
+{
+ private static bool BoxUnboxToNQ(IEmptyGen<int> o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmptyGen<int> o)
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int>? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementOneInterfaceGen<int> u = Helper.Create(default(ImplementOneInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int> u = Helper.Create(default(ImplementOneInterfaceGen<int>)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest4
+{
+ private static bool BoxUnboxToNQ(IEmptyGen<int> o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmptyGen<int> o)
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int>? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementTwoInterfaceGen<int> u = Helper.Create(default(ImplementTwoInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int> u = Helper.Create(default(ImplementTwoInterfaceGen<int>)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest5
+{
+ private static bool BoxUnboxToNQ(IEmpty o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmpty o)
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>));
+
+ Console.WriteLine("--- ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementAllInterface<int>? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementAllInterface<int> u = Helper.Create(default(ImplementAllInterface<int>));
+
+ Console.WriteLine("--- ImplementAllInterface<int> u = Helper.Create(default(ImplementAllInterface<int>)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest6
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((char)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((char?)o, Helper.Create(default(char)));
+ }
+
+ public static void Run()
+ {
+ char? s = Helper.Create(default(char));
+
+ Console.WriteLine("--- char? s = Helper.Create(default(char)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- char? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ char u = Helper.Create(default(char));
+
+ Console.WriteLine("--- char u = Helper.Create(default(char)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest7
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((bool)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((bool?)o, Helper.Create(default(bool)));
+ }
+
+ public static void Run()
+ {
+ bool? s = Helper.Create(default(bool));
+
+ Console.WriteLine("--- bool? s = Helper.Create(default(bool)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- bool? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ bool u = Helper.Create(default(bool));
+
+ Console.WriteLine("--- bool u = Helper.Create(default(bool)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest8
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((byte)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((byte?)o, Helper.Create(default(byte)));
+ }
+
+ public static void Run()
+ {
+ byte? s = Helper.Create(default(byte));
+
+ Console.WriteLine("--- byte? s = Helper.Create(default(byte)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- byte? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ byte u = Helper.Create(default(byte));
+
+ Console.WriteLine("--- byte u = Helper.Create(default(byte)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest9
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((sbyte)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((sbyte?)o, Helper.Create(default(sbyte)));
+ }
+
+ public static void Run()
+ {
+ sbyte? s = Helper.Create(default(sbyte));
+
+ Console.WriteLine("--- sbyte? s = Helper.Create(default(sbyte)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- sbyte? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ sbyte u = Helper.Create(default(sbyte));
+
+ Console.WriteLine("--- sbyte u = Helper.Create(default(sbyte)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest10
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((short)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((short?)o, Helper.Create(default(short)));
+ }
+
+ public static void Run()
+ {
+ short? s = Helper.Create(default(short));
+
+ Console.WriteLine("--- short? s = Helper.Create(default(short)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- short? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ short u = Helper.Create(default(short));
+
+ Console.WriteLine("--- short u = Helper.Create(default(short)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest11
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((ushort)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((ushort?)o, Helper.Create(default(ushort)));
+ }
+
+ public static void Run()
+ {
+ ushort? s = Helper.Create(default(ushort));
+
+ Console.WriteLine("--- ushort? s = Helper.Create(default(ushort)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ushort? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ushort u = Helper.Create(default(ushort));
+
+ Console.WriteLine("--- ushort u = Helper.Create(default(ushort)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest12
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((int)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((int?)o, Helper.Create(default(int)));
+ }
+
+ public static void Run()
+ {
+ int? s = Helper.Create(default(int));
+
+ Console.WriteLine("--- int? s = Helper.Create(default(int)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- int? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ int u = Helper.Create(default(int));
+
+ Console.WriteLine("--- int u = Helper.Create(default(int)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest13
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((uint)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((uint?)o, Helper.Create(default(uint)));
+ }
+
+ public static void Run()
+ {
+ uint? s = Helper.Create(default(uint));
+
+ Console.WriteLine("--- uint? s = Helper.Create(default(uint)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- uint? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ uint u = Helper.Create(default(uint));
+
+ Console.WriteLine("--- uint u = Helper.Create(default(uint)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest14
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((long)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((long?)o, Helper.Create(default(long)));
+ }
+
+ public static void Run()
+ {
+ long? s = Helper.Create(default(long));
+
+ Console.WriteLine("--- long? s = Helper.Create(default(long)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- long? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ long u = Helper.Create(default(long));
+
+ Console.WriteLine("--- long u = Helper.Create(default(long)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest15
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((ulong)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((ulong?)o, Helper.Create(default(ulong)));
+ }
+
+ public static void Run()
+ {
+ ulong? s = Helper.Create(default(ulong));
+
+ Console.WriteLine("--- ulong? s = Helper.Create(default(ulong)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ulong? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ulong u = Helper.Create(default(ulong));
+
+ Console.WriteLine("--- ulong u = Helper.Create(default(ulong)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest16
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((float)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((float?)o, Helper.Create(default(float)));
+ }
+
+ public static void Run()
+ {
+ float? s = Helper.Create(default(float));
+
+ Console.WriteLine("--- float? s = Helper.Create(default(float)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- float? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ float u = Helper.Create(default(float));
+
+ Console.WriteLine("--- float u = Helper.Create(default(float)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest17
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((double)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((double?)o, Helper.Create(default(double)));
+ }
+
+ public static void Run()
+ {
+ double? s = Helper.Create(default(double));
+
+ Console.WriteLine("--- double? s = Helper.Create(default(double)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- double? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ double u = Helper.Create(default(double));
+
+ Console.WriteLine("--- double u = Helper.Create(default(double)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest18
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((decimal)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((decimal?)o, Helper.Create(default(decimal)));
+ }
+
+ public static void Run()
+ {
+ decimal? s = Helper.Create(default(decimal));
+
+ Console.WriteLine("--- decimal? s = Helper.Create(default(decimal)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- decimal? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ decimal u = Helper.Create(default(decimal));
+
+ Console.WriteLine("--- decimal u = Helper.Create(default(decimal)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class Test
+{
+ private static int Main()
+ {
+ try
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ NullableTest3.Run();
+ NullableTest4.Run();
+ NullableTest5.Run();
+ NullableTest6.Run();
+ NullableTest7.Run();
+ NullableTest8.Run();
+ NullableTest9.Run();
+ NullableTest10.Run();
+ NullableTest11.Run();
+ NullableTest12.Run();
+ NullableTest13.Run();
+ NullableTest14.Run();
+ NullableTest15.Run();
+ NullableTest16.Run();
+ NullableTest17.Run();
+ NullableTest18.Run();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Test FAILED");
+ Console.WriteLine(ex);
+ return 666;
+ }
+ Console.WriteLine("Test SUCCESS");
+ return 100;
+ }
+}
+
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_d.csproj b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_d.csproj
new file mode 100644
index 0000000..dd04ece
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_d.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxinterface.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_do.csproj b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_do.csproj
new file mode 100644
index 0000000..ce3c880
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_do.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxinterface.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_r.csproj b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_r.csproj
new file mode 100644
index 0000000..b64525b
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_r.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxinterface.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_ro.csproj b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_ro.csproj
new file mode 100644
index 0000000..9b65d14
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/boxunboxinterface_ro.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="boxunboxinterface.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassenum.cs b/tests/src/JIT/Directed/nullabletypes/castclassenum.cs
new file mode 100644
index 0000000..4d3ad28
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassenum.cs
@@ -0,0 +1,158 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+using System;
+
+
+internal class NullableTest1
+{
+ private static bool BoxUnboxToNQ(Enum o)
+ {
+ try
+ {
+ return Helper.Compare((IntE)(ValueType)(object)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(Enum o)
+ {
+ return Helper.Compare((IntE?)(ValueType)(object)o, Helper.Create(default(IntE)));
+ }
+
+ public static void Run()
+ {
+ IntE? s = Helper.Create(default(IntE));
+
+ Console.WriteLine("--- IntE? s = Helper.Create(default(IntE)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- IntE? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ IntE u = Helper.Create(default(IntE));
+
+ Console.WriteLine("--- IntE u = Helper.Create(default(IntE)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest2
+{
+ private static bool BoxUnboxToNQ(Enum o)
+ {
+ try
+ {
+ return Helper.Compare((ByteE)(ValueType)(object)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(Enum o)
+ {
+ return Helper.Compare((ByteE?)(ValueType)(object)o, Helper.Create(default(ByteE)));
+ }
+
+ public static void Run()
+ {
+ ByteE? s = Helper.Create(default(ByteE));
+
+ Console.WriteLine("--- ByteE? s = Helper.Create(default(ByteE)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ByteE? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ByteE u = Helper.Create(default(ByteE));
+
+ Console.WriteLine("--- ByteE u = Helper.Create(default(ByteE)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest3
+{
+ private static bool BoxUnboxToNQ(Enum o)
+ {
+ try
+ {
+ return Helper.Compare((LongE)(ValueType)(object)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(Enum o)
+ {
+ return Helper.Compare((LongE?)(ValueType)(object)o, Helper.Create(default(LongE)));
+ }
+
+ public static void Run()
+ {
+ LongE? s = Helper.Create(default(LongE));
+
+ Console.WriteLine("--- LongE? s = Helper.Create(default(LongE)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- LongE? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ LongE u = Helper.Create(default(LongE));
+
+ Console.WriteLine("--- LongE u = Helper.Create(default(LongE)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class Test
+{
+ private static int Main()
+ {
+ try
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ NullableTest3.Run();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Test FAILED");
+ Console.WriteLine(ex);
+ return 666;
+ }
+ Console.WriteLine("Test SUCCESS");
+ return 100;
+ }
+}
+
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassenum_d.csproj b/tests/src/JIT/Directed/nullabletypes/castclassenum_d.csproj
new file mode 100644
index 0000000..62ee76b
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassenum_d.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassenum.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassenum_do.csproj b/tests/src/JIT/Directed/nullabletypes/castclassenum_do.csproj
new file mode 100644
index 0000000..9b7cd29
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassenum_do.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassenum.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassenum_r.csproj b/tests/src/JIT/Directed/nullabletypes/castclassenum_r.csproj
new file mode 100644
index 0000000..e90f844
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassenum_r.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassenum.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassenum_ro.csproj b/tests/src/JIT/Directed/nullabletypes/castclassenum_ro.csproj
new file mode 100644
index 0000000..1f59571
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassenum_ro.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassenum.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassinterface.cs b/tests/src/JIT/Directed/nullabletypes/castclassinterface.cs
new file mode 100644
index 0000000..8b9287c
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassinterface.cs
@@ -0,0 +1,818 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+using System;
+
+
+internal class NullableTest1
+{
+ private static bool BoxUnboxToNQ(IEmpty o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)(ValueType)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmpty o)
+ {
+ return Helper.Compare((ImplementOneInterface?)(ValueType)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface));
+
+ Console.WriteLine("--- ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementOneInterface? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementOneInterface u = Helper.Create(default(ImplementOneInterface));
+
+ Console.WriteLine("--- ImplementOneInterface u = Helper.Create(default(ImplementOneInterface)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest2
+{
+ private static bool BoxUnboxToNQ(IEmpty o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmpty o)
+ {
+ return Helper.Compare((ImplementTwoInterface?)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface));
+
+ Console.WriteLine("--- ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementTwoInterface? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementTwoInterface u = Helper.Create(default(ImplementTwoInterface));
+
+ Console.WriteLine("--- ImplementTwoInterface u = Helper.Create(default(ImplementTwoInterface)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest3
+{
+ private static bool BoxUnboxToNQ(IEmptyGen<int> o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)(ValueType)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmptyGen<int> o)
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)(ValueType)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int>? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementOneInterfaceGen<int> u = Helper.Create(default(ImplementOneInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int> u = Helper.Create(default(ImplementOneInterfaceGen<int>)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest4
+{
+ private static bool BoxUnboxToNQ(IEmptyGen<int> o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmptyGen<int> o)
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int>? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementTwoInterfaceGen<int> u = Helper.Create(default(ImplementTwoInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int> u = Helper.Create(default(ImplementTwoInterfaceGen<int>)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest5
+{
+ private static bool BoxUnboxToNQ(IEmpty o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)(ValueType)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IEmpty o)
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)(ValueType)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>));
+
+ Console.WriteLine("--- ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ImplementAllInterface<int>? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ImplementAllInterface<int> u = Helper.Create(default(ImplementAllInterface<int>));
+
+ Console.WriteLine("--- ImplementAllInterface<int> u = Helper.Create(default(ImplementAllInterface<int>)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest6
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((char)(ValueType)(object)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((char?)(ValueType)(object)o, Helper.Create(default(char)));
+ }
+
+ public static void Run()
+ {
+ char? s = Helper.Create(default(char));
+
+ Console.WriteLine("--- char? s = Helper.Create(default(char)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- char? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ char u = Helper.Create(default(char));
+
+ Console.WriteLine("--- char u = Helper.Create(default(char)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest7
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((bool)(ValueType)(object)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((bool?)(ValueType)(object)o, Helper.Create(default(bool)));
+ }
+
+ public static void Run()
+ {
+ bool? s = Helper.Create(default(bool));
+
+ Console.WriteLine("--- bool? s = Helper.Create(default(bool)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- bool? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ bool u = Helper.Create(default(bool));
+
+ Console.WriteLine("--- bool u = Helper.Create(default(bool)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest8
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((byte)(ValueType)(object)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((byte?)(ValueType)(object)o, Helper.Create(default(byte)));
+ }
+
+ public static void Run()
+ {
+ byte? s = Helper.Create(default(byte));
+
+ Console.WriteLine("--- byte? s = Helper.Create(default(byte)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- byte? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ byte u = Helper.Create(default(byte));
+
+ Console.WriteLine("--- byte u = Helper.Create(default(byte)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest9
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((sbyte)(ValueType)(object)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((sbyte?)(ValueType)(object)o, Helper.Create(default(sbyte)));
+ }
+
+ public static void Run()
+ {
+ sbyte? s = Helper.Create(default(sbyte));
+
+ Console.WriteLine("--- sbyte? s = Helper.Create(default(sbyte)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- sbyte? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ sbyte u = Helper.Create(default(sbyte));
+
+ Console.WriteLine("--- sbyte u = Helper.Create(default(sbyte)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest10
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((short)(ValueType)(object)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((short?)(ValueType)(object)o, Helper.Create(default(short)));
+ }
+
+ public static void Run()
+ {
+ short? s = Helper.Create(default(short));
+
+ Console.WriteLine("--- short? s = Helper.Create(default(short)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- short? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ short u = Helper.Create(default(short));
+
+ Console.WriteLine("--- short u = Helper.Create(default(short)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest11
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((ushort)(ValueType)(object)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((ushort?)(ValueType)(object)o, Helper.Create(default(ushort)));
+ }
+
+ public static void Run()
+ {
+ ushort? s = Helper.Create(default(ushort));
+
+ Console.WriteLine("--- ushort? s = Helper.Create(default(ushort)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ushort? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ushort u = Helper.Create(default(ushort));
+
+ Console.WriteLine("--- ushort u = Helper.Create(default(ushort)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest12
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((int)(ValueType)(object)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((int?)(ValueType)(object)o, Helper.Create(default(int)));
+ }
+
+ public static void Run()
+ {
+ int? s = Helper.Create(default(int));
+
+ Console.WriteLine("--- int? s = Helper.Create(default(int)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- int? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ int u = Helper.Create(default(int));
+
+ Console.WriteLine("--- int u = Helper.Create(default(int)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest13
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((uint)(ValueType)(object)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((uint?)(ValueType)(object)o, Helper.Create(default(uint)));
+ }
+
+ public static void Run()
+ {
+ uint? s = Helper.Create(default(uint));
+
+ Console.WriteLine("--- uint? s = Helper.Create(default(uint)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- uint? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ uint u = Helper.Create(default(uint));
+
+ Console.WriteLine("--- uint u = Helper.Create(default(uint)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest14
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((long)(ValueType)(object)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((long?)(ValueType)(object)o, Helper.Create(default(long)));
+ }
+
+ public static void Run()
+ {
+ long? s = Helper.Create(default(long));
+
+ Console.WriteLine("--- long? s = Helper.Create(default(long)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- long? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ long u = Helper.Create(default(long));
+
+ Console.WriteLine("--- long u = Helper.Create(default(long)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest15
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((ulong)(ValueType)(object)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((ulong?)(ValueType)(object)o, Helper.Create(default(ulong)));
+ }
+
+ public static void Run()
+ {
+ ulong? s = Helper.Create(default(ulong));
+
+ Console.WriteLine("--- ulong? s = Helper.Create(default(ulong)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- ulong? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ ulong u = Helper.Create(default(ulong));
+
+ Console.WriteLine("--- ulong u = Helper.Create(default(ulong)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest16
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((float)(ValueType)(object)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((float?)(ValueType)(object)o, Helper.Create(default(float)));
+ }
+
+ public static void Run()
+ {
+ float? s = Helper.Create(default(float));
+
+ Console.WriteLine("--- float? s = Helper.Create(default(float)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- float? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ float u = Helper.Create(default(float));
+
+ Console.WriteLine("--- float u = Helper.Create(default(float)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest17
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((double)(ValueType)(object)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((double?)(ValueType)(object)o, Helper.Create(default(double)));
+ }
+
+ public static void Run()
+ {
+ double? s = Helper.Create(default(double));
+
+ Console.WriteLine("--- double? s = Helper.Create(default(double)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- double? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ double u = Helper.Create(default(double));
+
+ Console.WriteLine("--- double u = Helper.Create(default(double)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class NullableTest18
+{
+ private static bool BoxUnboxToNQ(IComparable o)
+ {
+ try
+ {
+ return Helper.Compare((decimal)(ValueType)(object)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(IComparable o)
+ {
+ return Helper.Compare((decimal?)(ValueType)(object)o, Helper.Create(default(decimal)));
+ }
+
+ public static void Run()
+ {
+ decimal? s = Helper.Create(default(decimal));
+
+ Console.WriteLine("--- decimal? s = Helper.Create(default(decimal)) ---");
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsTrue(BoxUnboxToQ(s));
+
+ Console.WriteLine("--- decimal? s = null ---");
+ s = null;
+
+ Assert.IsTrue(BoxUnboxToNQ(s));
+ Assert.IsFalse(BoxUnboxToQ(s));
+
+ decimal u = Helper.Create(default(decimal));
+
+ Console.WriteLine("--- decimal u = Helper.Create(default(decimal)) ----");
+ Assert.IsTrue(BoxUnboxToNQ(u));
+ Assert.IsTrue(BoxUnboxToQ(u));
+ }
+}
+
+
+
+internal class Test
+{
+ private static int Main()
+ {
+ try
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ NullableTest3.Run();
+ NullableTest4.Run();
+ NullableTest5.Run();
+ NullableTest6.Run();
+ NullableTest7.Run();
+ NullableTest8.Run();
+ NullableTest9.Run();
+ NullableTest10.Run();
+ NullableTest11.Run();
+ NullableTest12.Run();
+ NullableTest13.Run();
+ NullableTest14.Run();
+ NullableTest15.Run();
+ NullableTest16.Run();
+ NullableTest17.Run();
+ NullableTest18.Run();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Test FAILED");
+ Console.WriteLine(ex);
+ return 666;
+ }
+ Console.WriteLine("Test SUCCESS");
+ return 100;
+ }
+}
+
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassinterface_d.csproj b/tests/src/JIT/Directed/nullabletypes/castclassinterface_d.csproj
new file mode 100644
index 0000000..6cd108b
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassinterface_d.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassinterface.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassinterface_do.csproj b/tests/src/JIT/Directed/nullabletypes/castclassinterface_do.csproj
new file mode 100644
index 0000000..0f46e58
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassinterface_do.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassinterface.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassinterface_r.csproj b/tests/src/JIT/Directed/nullabletypes/castclassinterface_r.csproj
new file mode 100644
index 0000000..2617645
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassinterface_r.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassinterface.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassinterface_ro.csproj b/tests/src/JIT/Directed/nullabletypes/castclassinterface_ro.csproj
new file mode 100644
index 0000000..d9b3322
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassinterface_ro.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassinterface.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassvaluetype.cs b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype.cs
new file mode 100644
index 0000000..8a52ca7
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype.cs
@@ -0,0 +1,4755 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+using System;
+
+
+internal class NullableTest1
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((char)(ValueType)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((char?)(ValueType)o, Helper.Create(default(char)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((char)(object)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((char?)(object)o, Helper.Create(default(char)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((char)(ValueType)(object)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((char?)(ValueType)(object)o, Helper.Create(default(char)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((char)(ValueType)(object)o, Helper.Create(default(char)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((char?)(ValueType)(object)o, Helper.Create(default(char)));
+ }
+
+ public static void Run()
+ {
+ char? s = Helper.Create(default(char));
+
+ Console.WriteLine("--- char? s = Helper.Create(default(char)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- char? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- char u = Helper.Create(default(char)) ---");
+ char u = Helper.Create(default(char));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<char>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<char>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest2
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((bool)(ValueType)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((bool?)(ValueType)o, Helper.Create(default(bool)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((bool)(object)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((bool?)(object)o, Helper.Create(default(bool)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((bool)(ValueType)(object)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((bool?)(ValueType)(object)o, Helper.Create(default(bool)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((bool)(ValueType)(object)o, Helper.Create(default(bool)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((bool?)(ValueType)(object)o, Helper.Create(default(bool)));
+ }
+
+ public static void Run()
+ {
+ bool? s = Helper.Create(default(bool));
+
+ Console.WriteLine("--- bool? s = Helper.Create(default(bool)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- bool? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- bool u = Helper.Create(default(bool)) ---");
+ bool u = Helper.Create(default(bool));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<bool>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<bool>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest3
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((byte)(ValueType)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((byte?)(ValueType)o, Helper.Create(default(byte)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((byte)(object)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((byte?)(object)o, Helper.Create(default(byte)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((byte)(ValueType)(object)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((byte?)(ValueType)(object)o, Helper.Create(default(byte)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((byte)(ValueType)(object)o, Helper.Create(default(byte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((byte?)(ValueType)(object)o, Helper.Create(default(byte)));
+ }
+
+ public static void Run()
+ {
+ byte? s = Helper.Create(default(byte));
+
+ Console.WriteLine("--- byte? s = Helper.Create(default(byte)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- byte? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- byte u = Helper.Create(default(byte)) ---");
+ byte u = Helper.Create(default(byte));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<byte>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<byte>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest4
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((sbyte)(ValueType)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((sbyte?)(ValueType)o, Helper.Create(default(sbyte)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((sbyte)(object)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((sbyte?)(object)o, Helper.Create(default(sbyte)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((sbyte)(ValueType)(object)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((sbyte?)(ValueType)(object)o, Helper.Create(default(sbyte)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((sbyte)(ValueType)(object)o, Helper.Create(default(sbyte)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((sbyte?)(ValueType)(object)o, Helper.Create(default(sbyte)));
+ }
+
+ public static void Run()
+ {
+ sbyte? s = Helper.Create(default(sbyte));
+
+ Console.WriteLine("--- sbyte? s = Helper.Create(default(sbyte)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- sbyte? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- sbyte u = Helper.Create(default(sbyte)) ---");
+ sbyte u = Helper.Create(default(sbyte));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<sbyte>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<sbyte>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest5
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((short)(ValueType)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((short?)(ValueType)o, Helper.Create(default(short)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((short)(object)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((short?)(object)o, Helper.Create(default(short)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((short)(ValueType)(object)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((short?)(ValueType)(object)o, Helper.Create(default(short)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((short)(ValueType)(object)o, Helper.Create(default(short)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((short?)(ValueType)(object)o, Helper.Create(default(short)));
+ }
+
+ public static void Run()
+ {
+ short? s = Helper.Create(default(short));
+
+ Console.WriteLine("--- short? s = Helper.Create(default(short)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- short? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- short u = Helper.Create(default(short)) ---");
+ short u = Helper.Create(default(short));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<short>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<short>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest6
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ushort)(ValueType)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ushort?)(ValueType)o, Helper.Create(default(ushort)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ushort)(object)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ushort?)(object)o, Helper.Create(default(ushort)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ushort)(ValueType)(object)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ushort?)(ValueType)(object)o, Helper.Create(default(ushort)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ushort)(ValueType)(object)o, Helper.Create(default(ushort)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ushort?)(ValueType)(object)o, Helper.Create(default(ushort)));
+ }
+
+ public static void Run()
+ {
+ ushort? s = Helper.Create(default(ushort));
+
+ Console.WriteLine("--- ushort? s = Helper.Create(default(ushort)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ushort? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ushort u = Helper.Create(default(ushort)) ---");
+ ushort u = Helper.Create(default(ushort));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ushort>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ushort>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest7
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((int)(ValueType)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((int?)(ValueType)o, Helper.Create(default(int)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((int)(object)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((int?)(object)o, Helper.Create(default(int)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((int)(ValueType)(object)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((int?)(ValueType)(object)o, Helper.Create(default(int)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((int)(ValueType)(object)o, Helper.Create(default(int)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((int?)(ValueType)(object)o, Helper.Create(default(int)));
+ }
+
+ public static void Run()
+ {
+ int? s = Helper.Create(default(int));
+
+ Console.WriteLine("--- int? s = Helper.Create(default(int)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- int? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- int u = Helper.Create(default(int)) ---");
+ int u = Helper.Create(default(int));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<int>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<int>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest8
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((uint)(ValueType)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((uint?)(ValueType)o, Helper.Create(default(uint)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((uint)(object)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((uint?)(object)o, Helper.Create(default(uint)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((uint)(ValueType)(object)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((uint?)(ValueType)(object)o, Helper.Create(default(uint)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((uint)(ValueType)(object)o, Helper.Create(default(uint)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((uint?)(ValueType)(object)o, Helper.Create(default(uint)));
+ }
+
+ public static void Run()
+ {
+ uint? s = Helper.Create(default(uint));
+
+ Console.WriteLine("--- uint? s = Helper.Create(default(uint)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- uint? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- uint u = Helper.Create(default(uint)) ---");
+ uint u = Helper.Create(default(uint));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<uint>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<uint>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest9
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((long)(ValueType)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((long?)(ValueType)o, Helper.Create(default(long)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((long)(object)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((long?)(object)o, Helper.Create(default(long)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((long)(ValueType)(object)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((long?)(ValueType)(object)o, Helper.Create(default(long)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((long)(ValueType)(object)o, Helper.Create(default(long)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((long?)(ValueType)(object)o, Helper.Create(default(long)));
+ }
+
+ public static void Run()
+ {
+ long? s = Helper.Create(default(long));
+
+ Console.WriteLine("--- long? s = Helper.Create(default(long)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- long? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- long u = Helper.Create(default(long)) ---");
+ long u = Helper.Create(default(long));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<long>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<long>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest10
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ulong)(ValueType)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ulong?)(ValueType)o, Helper.Create(default(ulong)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ulong)(object)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ulong?)(object)o, Helper.Create(default(ulong)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ulong)(ValueType)(object)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ulong?)(ValueType)(object)o, Helper.Create(default(ulong)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ulong)(ValueType)(object)o, Helper.Create(default(ulong)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ulong?)(ValueType)(object)o, Helper.Create(default(ulong)));
+ }
+
+ public static void Run()
+ {
+ ulong? s = Helper.Create(default(ulong));
+
+ Console.WriteLine("--- ulong? s = Helper.Create(default(ulong)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ulong? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ulong u = Helper.Create(default(ulong)) ---");
+ ulong u = Helper.Create(default(ulong));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ulong>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ulong>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest11
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((float)(ValueType)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((float?)(ValueType)o, Helper.Create(default(float)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((float)(object)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((float?)(object)o, Helper.Create(default(float)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((float)(ValueType)(object)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((float?)(ValueType)(object)o, Helper.Create(default(float)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((float)(ValueType)(object)o, Helper.Create(default(float)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((float?)(ValueType)(object)o, Helper.Create(default(float)));
+ }
+
+ public static void Run()
+ {
+ float? s = Helper.Create(default(float));
+
+ Console.WriteLine("--- float? s = Helper.Create(default(float)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- float? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- float u = Helper.Create(default(float)) ---");
+ float u = Helper.Create(default(float));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<float>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<float>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest12
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((double)(ValueType)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((double?)(ValueType)o, Helper.Create(default(double)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((double)(object)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((double?)(object)o, Helper.Create(default(double)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((double)(ValueType)(object)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((double?)(ValueType)(object)o, Helper.Create(default(double)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((double)(ValueType)(object)o, Helper.Create(default(double)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((double?)(ValueType)(object)o, Helper.Create(default(double)));
+ }
+
+ public static void Run()
+ {
+ double? s = Helper.Create(default(double));
+
+ Console.WriteLine("--- double? s = Helper.Create(default(double)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- double? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- double u = Helper.Create(default(double)) ---");
+ double u = Helper.Create(default(double));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<double>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<double>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest13
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((decimal)(ValueType)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((decimal?)(ValueType)o, Helper.Create(default(decimal)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((decimal)(object)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((decimal?)(object)o, Helper.Create(default(decimal)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((decimal)(ValueType)(object)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((decimal?)(ValueType)(object)o, Helper.Create(default(decimal)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((decimal)(ValueType)(object)o, Helper.Create(default(decimal)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((decimal?)(ValueType)(object)o, Helper.Create(default(decimal)));
+ }
+
+ public static void Run()
+ {
+ decimal? s = Helper.Create(default(decimal));
+
+ Console.WriteLine("--- decimal? s = Helper.Create(default(decimal)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- decimal? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- decimal u = Helper.Create(default(decimal)) ---");
+ decimal u = Helper.Create(default(decimal));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<decimal>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<decimal>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest14
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((IntPtr)(ValueType)o, Helper.Create(default(IntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((IntPtr?)(ValueType)o, Helper.Create(default(IntPtr)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((IntPtr)(object)o, Helper.Create(default(IntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((IntPtr?)(object)o, Helper.Create(default(IntPtr)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((IntPtr)(ValueType)(object)o, Helper.Create(default(IntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((IntPtr?)(ValueType)(object)o, Helper.Create(default(IntPtr)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((IntPtr)(ValueType)(object)o, Helper.Create(default(IntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((IntPtr?)(ValueType)(object)o, Helper.Create(default(IntPtr)));
+ }
+
+ public static void Run()
+ {
+ IntPtr? s = Helper.Create(default(IntPtr));
+
+ Console.WriteLine("--- IntPtr? s = Helper.Create(default(IntPtr)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- IntPtr? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- IntPtr u = Helper.Create(default(IntPtr)) ---");
+ IntPtr u = Helper.Create(default(IntPtr));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<IntPtr>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<IntPtr>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest15
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((UIntPtr)(ValueType)o, Helper.Create(default(UIntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((UIntPtr?)(ValueType)o, Helper.Create(default(UIntPtr)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((UIntPtr)(object)o, Helper.Create(default(UIntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((UIntPtr?)(object)o, Helper.Create(default(UIntPtr)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((UIntPtr)(ValueType)(object)o, Helper.Create(default(UIntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((UIntPtr?)(ValueType)(object)o, Helper.Create(default(UIntPtr)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((UIntPtr)(ValueType)(object)o, Helper.Create(default(UIntPtr)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((UIntPtr?)(ValueType)(object)o, Helper.Create(default(UIntPtr)));
+ }
+
+ public static void Run()
+ {
+ UIntPtr? s = Helper.Create(default(UIntPtr));
+
+ Console.WriteLine("--- UIntPtr? s = Helper.Create(default(UIntPtr)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- UIntPtr? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- UIntPtr u = Helper.Create(default(UIntPtr)) ---");
+ UIntPtr u = Helper.Create(default(UIntPtr));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<UIntPtr>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<UIntPtr>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest16
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((Guid)(ValueType)o, Helper.Create(default(Guid)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((Guid?)(ValueType)o, Helper.Create(default(Guid)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((Guid)(object)o, Helper.Create(default(Guid)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((Guid?)(object)o, Helper.Create(default(Guid)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((Guid)(ValueType)(object)o, Helper.Create(default(Guid)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((Guid?)(ValueType)(object)o, Helper.Create(default(Guid)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((Guid)(ValueType)(object)o, Helper.Create(default(Guid)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((Guid?)(ValueType)(object)o, Helper.Create(default(Guid)));
+ }
+
+ public static void Run()
+ {
+ Guid? s = Helper.Create(default(Guid));
+
+ Console.WriteLine("--- Guid? s = Helper.Create(default(Guid)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- Guid? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- Guid u = Helper.Create(default(Guid)) ---");
+ Guid u = Helper.Create(default(Guid));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<Guid>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<Guid>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest17
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((GCHandle)(ValueType)o, Helper.Create(default(GCHandle)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((GCHandle?)(ValueType)o, Helper.Create(default(GCHandle)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((GCHandle)(object)o, Helper.Create(default(GCHandle)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((GCHandle?)(object)o, Helper.Create(default(GCHandle)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((GCHandle)(ValueType)(object)o, Helper.Create(default(GCHandle)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((GCHandle?)(ValueType)(object)o, Helper.Create(default(GCHandle)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((GCHandle)(ValueType)(object)o, Helper.Create(default(GCHandle)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((GCHandle?)(ValueType)(object)o, Helper.Create(default(GCHandle)));
+ }
+
+ public static void Run()
+ {
+ GCHandle? s = Helper.Create(default(GCHandle));
+
+ Console.WriteLine("--- GCHandle? s = Helper.Create(default(GCHandle)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- GCHandle? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- GCHandle u = Helper.Create(default(GCHandle)) ---");
+ GCHandle u = Helper.Create(default(GCHandle));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<GCHandle>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<GCHandle>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest18
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ByteE)(ValueType)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ByteE?)(ValueType)o, Helper.Create(default(ByteE)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ByteE)(object)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ByteE?)(object)o, Helper.Create(default(ByteE)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ByteE)(ValueType)(object)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ByteE?)(ValueType)(object)o, Helper.Create(default(ByteE)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ByteE)(ValueType)(object)o, Helper.Create(default(ByteE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ByteE?)(ValueType)(object)o, Helper.Create(default(ByteE)));
+ }
+
+ public static void Run()
+ {
+ ByteE? s = Helper.Create(default(ByteE));
+
+ Console.WriteLine("--- ByteE? s = Helper.Create(default(ByteE)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ByteE? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ByteE u = Helper.Create(default(ByteE)) ---");
+ ByteE u = Helper.Create(default(ByteE));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ByteE>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ByteE>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest19
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((IntE)(ValueType)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((IntE?)(ValueType)o, Helper.Create(default(IntE)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((IntE)(object)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((IntE?)(object)o, Helper.Create(default(IntE)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((IntE)(ValueType)(object)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((IntE?)(ValueType)(object)o, Helper.Create(default(IntE)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((IntE)(ValueType)(object)o, Helper.Create(default(IntE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((IntE?)(ValueType)(object)o, Helper.Create(default(IntE)));
+ }
+
+ public static void Run()
+ {
+ IntE? s = Helper.Create(default(IntE));
+
+ Console.WriteLine("--- IntE? s = Helper.Create(default(IntE)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- IntE? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- IntE u = Helper.Create(default(IntE)) ---");
+ IntE u = Helper.Create(default(IntE));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<IntE>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<IntE>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest20
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((LongE)(ValueType)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((LongE?)(ValueType)o, Helper.Create(default(LongE)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((LongE)(object)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((LongE?)(object)o, Helper.Create(default(LongE)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((LongE)(ValueType)(object)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((LongE?)(ValueType)(object)o, Helper.Create(default(LongE)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((LongE)(ValueType)(object)o, Helper.Create(default(LongE)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((LongE?)(ValueType)(object)o, Helper.Create(default(LongE)));
+ }
+
+ public static void Run()
+ {
+ LongE? s = Helper.Create(default(LongE));
+
+ Console.WriteLine("--- LongE? s = Helper.Create(default(LongE)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- LongE? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- LongE u = Helper.Create(default(LongE)) ---");
+ LongE u = Helper.Create(default(LongE));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<LongE>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<LongE>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest21
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStruct)(ValueType)o, Helper.Create(default(EmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((EmptyStruct?)(ValueType)o, Helper.Create(default(EmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStruct)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((EmptyStruct?)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStruct)(ValueType)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((EmptyStruct?)(ValueType)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((EmptyStruct)(ValueType)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((EmptyStruct?)(ValueType)(object)o, Helper.Create(default(EmptyStruct)));
+ }
+
+ public static void Run()
+ {
+ EmptyStruct? s = Helper.Create(default(EmptyStruct));
+
+ Console.WriteLine("--- EmptyStruct? s = Helper.Create(default(EmptyStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- EmptyStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- EmptyStruct u = Helper.Create(default(EmptyStruct)) ---");
+ EmptyStruct u = Helper.Create(default(EmptyStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<EmptyStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<EmptyStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest22
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStruct)(ValueType)o, Helper.Create(default(NotEmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStruct?)(ValueType)o, Helper.Create(default(NotEmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStruct)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStruct?)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStruct)(ValueType)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStruct?)(ValueType)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStruct)(ValueType)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStruct?)(ValueType)(object)o, Helper.Create(default(NotEmptyStruct)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStruct? s = Helper.Create(default(NotEmptyStruct));
+
+ Console.WriteLine("--- NotEmptyStruct? s = Helper.Create(default(NotEmptyStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStruct u = Helper.Create(default(NotEmptyStruct)) ---");
+ NotEmptyStruct u = Helper.Create(default(NotEmptyStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest23
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQ)(ValueType)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructQ?)(ValueType)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQ)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructQ?)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQ)(ValueType)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructQ?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQ)(ValueType)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructQ?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructQ)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructQ? s = Helper.Create(default(NotEmptyStructQ));
+
+ Console.WriteLine("--- NotEmptyStructQ? s = Helper.Create(default(NotEmptyStructQ)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructQ? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructQ u = Helper.Create(default(NotEmptyStructQ)) ---");
+ NotEmptyStructQ u = Helper.Create(default(NotEmptyStructQ));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructQ>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructQ>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest24
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructA)(ValueType)o, Helper.Create(default(NotEmptyStructA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructA?)(ValueType)o, Helper.Create(default(NotEmptyStructA)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructA)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructA?)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructA)(ValueType)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructA?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructA)(ValueType)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructA?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructA)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructA? s = Helper.Create(default(NotEmptyStructA));
+
+ Console.WriteLine("--- NotEmptyStructA? s = Helper.Create(default(NotEmptyStructA)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructA? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructA u = Helper.Create(default(NotEmptyStructA)) ---");
+ NotEmptyStructA u = Helper.Create(default(NotEmptyStructA));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructA>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructA>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest25
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQA)(ValueType)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructQA?)(ValueType)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQA)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructQA?)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQA)(ValueType)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructQA?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructQA)(ValueType)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructQA?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructQA)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructQA? s = Helper.Create(default(NotEmptyStructQA));
+
+ Console.WriteLine("--- NotEmptyStructQA? s = Helper.Create(default(NotEmptyStructQA)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructQA? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructQA u = Helper.Create(default(NotEmptyStructQA)) ---");
+ NotEmptyStructQA u = Helper.Create(default(NotEmptyStructQA));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructQA>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructQA>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest26
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStructGen<int>)(ValueType)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((EmptyStructGen<int>?)(ValueType)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStructGen<int>)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((EmptyStructGen<int>?)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((EmptyStructGen<int>)(ValueType)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((EmptyStructGen<int>?)(ValueType)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((EmptyStructGen<int>)(ValueType)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((EmptyStructGen<int>?)(ValueType)(object)o, Helper.Create(default(EmptyStructGen<int>)));
+ }
+
+ public static void Run()
+ {
+ EmptyStructGen<int>? s = Helper.Create(default(EmptyStructGen<int>));
+
+ Console.WriteLine("--- EmptyStructGen<int>? s = Helper.Create(default(EmptyStructGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- EmptyStructGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- EmptyStructGen<int> u = Helper.Create(default(EmptyStructGen<int>)) ---");
+ EmptyStructGen<int> u = Helper.Create(default(EmptyStructGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<EmptyStructGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<EmptyStructGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest27
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructGen<int>)(ValueType)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructGen<int>?)(ValueType)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructGen<int>)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructGen<int>?)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructGen<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructGen<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructGen<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructGen<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructGen<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructGen<int>? s = Helper.Create(default(NotEmptyStructGen<int>));
+
+ Console.WriteLine("--- NotEmptyStructGen<int>? s = Helper.Create(default(NotEmptyStructGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructGen<int> u = Helper.Create(default(NotEmptyStructGen<int>)) ---");
+ NotEmptyStructGen<int> u = Helper.Create(default(NotEmptyStructGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest28
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>)(ValueType)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>?)(ValueType)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGen<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGen<int>? s = Helper.Create(default(NotEmptyStructConstrainedGen<int>));
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGen<int>? s = Helper.Create(default(NotEmptyStructConstrainedGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGen<int> u = Helper.Create(default(NotEmptyStructConstrainedGen<int>)) ---");
+ NotEmptyStructConstrainedGen<int> u = Helper.Create(default(NotEmptyStructConstrainedGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructConstrainedGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructConstrainedGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest29
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>)(ValueType)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)(ValueType)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenA<int>));
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenA<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenA<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenA<int> u = Helper.Create(default(NotEmptyStructConstrainedGenA<int>)) ---");
+ NotEmptyStructConstrainedGenA<int> u = Helper.Create(default(NotEmptyStructConstrainedGenA<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructConstrainedGenA<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructConstrainedGenA<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest30
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)(ValueType)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)(ValueType)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenQ<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>));
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQ<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQ<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQ<int> u = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)) ---");
+ NotEmptyStructConstrainedGenQ<int> u = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructConstrainedGenQ<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructConstrainedGenQ<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest31
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)(ValueType)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)(ValueType)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)(ValueType)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)));
+ }
+
+ public static void Run()
+ {
+ NotEmptyStructConstrainedGenQA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>));
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQA<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NotEmptyStructConstrainedGenQA<int> u = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)) ---");
+ NotEmptyStructConstrainedGenQA<int> u = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NotEmptyStructConstrainedGenQA<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NotEmptyStructConstrainedGenQA<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest32
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStruct)(ValueType)o, Helper.Create(default(NestedStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NestedStruct?)(ValueType)o, Helper.Create(default(NestedStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStruct)(object)o, Helper.Create(default(NestedStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NestedStruct?)(object)o, Helper.Create(default(NestedStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStruct)(ValueType)(object)o, Helper.Create(default(NestedStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NestedStruct?)(ValueType)(object)o, Helper.Create(default(NestedStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NestedStruct)(ValueType)(object)o, Helper.Create(default(NestedStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NestedStruct?)(ValueType)(object)o, Helper.Create(default(NestedStruct)));
+ }
+
+ public static void Run()
+ {
+ NestedStruct? s = Helper.Create(default(NestedStruct));
+
+ Console.WriteLine("--- NestedStruct? s = Helper.Create(default(NestedStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NestedStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NestedStruct u = Helper.Create(default(NestedStruct)) ---");
+ NestedStruct u = Helper.Create(default(NestedStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NestedStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NestedStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest33
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStructGen<int>)(ValueType)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((NestedStructGen<int>?)(ValueType)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStructGen<int>)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((NestedStructGen<int>?)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((NestedStructGen<int>)(ValueType)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((NestedStructGen<int>?)(ValueType)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((NestedStructGen<int>)(ValueType)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((NestedStructGen<int>?)(ValueType)(object)o, Helper.Create(default(NestedStructGen<int>)));
+ }
+
+ public static void Run()
+ {
+ NestedStructGen<int>? s = Helper.Create(default(NestedStructGen<int>));
+
+ Console.WriteLine("--- NestedStructGen<int>? s = Helper.Create(default(NestedStructGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NestedStructGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- NestedStructGen<int> u = Helper.Create(default(NestedStructGen<int>)) ---");
+ NestedStructGen<int> u = Helper.Create(default(NestedStructGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<NestedStructGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<NestedStructGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest34
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct)(ValueType)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct?)(ValueType)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct?)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct)(ValueType)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct?)(ValueType)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct)(ValueType)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ExplicitFieldOffsetStruct?)(ValueType)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct)));
+ }
+
+ public static void Run()
+ {
+ ExplicitFieldOffsetStruct? s = Helper.Create(default(ExplicitFieldOffsetStruct));
+
+ Console.WriteLine("--- ExplicitFieldOffsetStruct? s = Helper.Create(default(ExplicitFieldOffsetStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ExplicitFieldOffsetStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ExplicitFieldOffsetStruct u = Helper.Create(default(ExplicitFieldOffsetStruct)) ---");
+ ExplicitFieldOffsetStruct u = Helper.Create(default(ExplicitFieldOffsetStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ExplicitFieldOffsetStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ExplicitFieldOffsetStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest37
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((MarshalAsStruct)(ValueType)o, Helper.Create(default(MarshalAsStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((MarshalAsStruct?)(ValueType)o, Helper.Create(default(MarshalAsStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((MarshalAsStruct)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((MarshalAsStruct?)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((MarshalAsStruct)(ValueType)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((MarshalAsStruct?)(ValueType)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((MarshalAsStruct)(ValueType)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((MarshalAsStruct?)(ValueType)(object)o, Helper.Create(default(MarshalAsStruct)));
+ }
+
+ public static void Run()
+ {
+ MarshalAsStruct? s = Helper.Create(default(MarshalAsStruct));
+
+ Console.WriteLine("--- MarshalAsStruct? s = Helper.Create(default(MarshalAsStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- MarshalAsStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- MarshalAsStruct u = Helper.Create(default(MarshalAsStruct)) ---");
+ MarshalAsStruct u = Helper.Create(default(MarshalAsStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<MarshalAsStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<MarshalAsStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest38
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)(ValueType)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementOneInterface?)(ValueType)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementOneInterface?)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)(ValueType)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementOneInterface?)(ValueType)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterface)(ValueType)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementOneInterface?)(ValueType)(object)o, Helper.Create(default(ImplementOneInterface)));
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface));
+
+ Console.WriteLine("--- ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementOneInterface? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementOneInterface u = Helper.Create(default(ImplementOneInterface)) ---");
+ ImplementOneInterface u = Helper.Create(default(ImplementOneInterface));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementOneInterface>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementOneInterface>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest39
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)(ValueType)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementTwoInterface?)(ValueType)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementTwoInterface?)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementTwoInterface?)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterface)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementTwoInterface?)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterface)));
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface));
+
+ Console.WriteLine("--- ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementTwoInterface? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementTwoInterface u = Helper.Create(default(ImplementTwoInterface)) ---");
+ ImplementTwoInterface u = Helper.Create(default(ImplementTwoInterface));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementTwoInterface>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementTwoInterface>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest40
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)(ValueType)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)(ValueType)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)(ValueType)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)(ValueType)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>)(ValueType)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementOneInterfaceGen<int>?)(ValueType)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementOneInterfaceGen<int> u = Helper.Create(default(ImplementOneInterfaceGen<int>)) ---");
+ ImplementOneInterfaceGen<int> u = Helper.Create(default(ImplementOneInterfaceGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementOneInterfaceGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementOneInterfaceGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest41
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)(ValueType)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)(ValueType)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementTwoInterfaceGen<int>?)(ValueType)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>));
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementTwoInterfaceGen<int> u = Helper.Create(default(ImplementTwoInterfaceGen<int>)) ---");
+ ImplementTwoInterfaceGen<int> u = Helper.Create(default(ImplementTwoInterfaceGen<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementTwoInterfaceGen<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementTwoInterfaceGen<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest42
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)(ValueType)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)(ValueType)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)(ValueType)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)(ValueType)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((ImplementAllInterface<int>)(ValueType)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((ImplementAllInterface<int>?)(ValueType)(object)o, Helper.Create(default(ImplementAllInterface<int>)));
+ }
+
+ public static void Run()
+ {
+ ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>));
+
+ Console.WriteLine("--- ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementAllInterface<int>? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- ImplementAllInterface<int> u = Helper.Create(default(ImplementAllInterface<int>)) ---");
+ ImplementAllInterface<int> u = Helper.Create(default(ImplementAllInterface<int>));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<ImplementAllInterface<int>>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<ImplementAllInterface<int>>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest43
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct)(ValueType)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct?)(ValueType)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct?)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct)(ValueType)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct?)(ValueType)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct)(ValueType)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((WithMultipleGCHandleStruct?)(ValueType)(object)o, Helper.Create(default(WithMultipleGCHandleStruct)));
+ }
+
+ public static void Run()
+ {
+ WithMultipleGCHandleStruct? s = Helper.Create(default(WithMultipleGCHandleStruct));
+
+ Console.WriteLine("--- WithMultipleGCHandleStruct? s = Helper.Create(default(WithMultipleGCHandleStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- WithMultipleGCHandleStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- WithMultipleGCHandleStruct u = Helper.Create(default(WithMultipleGCHandleStruct)) ---");
+ WithMultipleGCHandleStruct u = Helper.Create(default(WithMultipleGCHandleStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<WithMultipleGCHandleStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<WithMultipleGCHandleStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest44
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct)(ValueType)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct?)(ValueType)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct?)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct)(ValueType)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct?)(ValueType)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct)(ValueType)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((WithOnlyFXTypeStruct?)(ValueType)(object)o, Helper.Create(default(WithOnlyFXTypeStruct)));
+ }
+
+ public static void Run()
+ {
+ WithOnlyFXTypeStruct? s = Helper.Create(default(WithOnlyFXTypeStruct));
+
+ Console.WriteLine("--- WithOnlyFXTypeStruct? s = Helper.Create(default(WithOnlyFXTypeStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- WithOnlyFXTypeStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- WithOnlyFXTypeStruct u = Helper.Create(default(WithOnlyFXTypeStruct)) ---");
+ WithOnlyFXTypeStruct u = Helper.Create(default(WithOnlyFXTypeStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<WithOnlyFXTypeStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<WithOnlyFXTypeStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class NullableTest45
+{
+ private static bool BoxUnboxToNQ(object o)
+ {
+ try
+ {
+ return Helper.Compare((MixedAllStruct)(ValueType)o, Helper.Create(default(MixedAllStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQ(object o)
+ {
+ return Helper.Compare((MixedAllStruct?)(ValueType)o, Helper.Create(default(MixedAllStruct)));
+ }
+
+ private static bool BoxUnboxToNQV(ValueType o)
+ {
+ try
+ {
+ return Helper.Compare((MixedAllStruct)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQV(ValueType o)
+ {
+ return Helper.Compare((MixedAllStruct?)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+
+ private static bool BoxUnboxToNQGen<T>(T o)
+ {
+ try
+ {
+ return Helper.Compare((MixedAllStruct)(ValueType)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGen<T>(T o)
+ {
+ return Helper.Compare((MixedAllStruct?)(ValueType)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+
+ private static bool BoxUnboxToNQGenC<T>(T? o) where T : struct
+ {
+ try
+ {
+ return Helper.Compare((MixedAllStruct)(ValueType)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+ catch (NullReferenceException)
+ {
+ return o == null;
+ }
+ }
+
+ private static bool BoxUnboxToQGenC<T>(T? o) where T : struct
+ {
+ return Helper.Compare((MixedAllStruct?)(ValueType)(object)o, Helper.Create(default(MixedAllStruct)));
+ }
+
+ public static void Run()
+ {
+ MixedAllStruct? s = Helper.Create(default(MixedAllStruct));
+
+ Console.WriteLine("--- MixedAllStruct? s = Helper.Create(default(MixedAllStruct)) ---");
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), true, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- MixedAllStruct? s = null ---");
+ s = null;
+ Assert.AreEqual(BoxUnboxToNQ(s), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(s), false, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(s), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(s), false, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(s), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(s), false, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC(s), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC(s), false, "BoxUnboxToQGenC");
+
+ Console.WriteLine("--- MixedAllStruct u = Helper.Create(default(MixedAllStruct)) ---");
+ MixedAllStruct u = Helper.Create(default(MixedAllStruct));
+ Assert.AreEqual(BoxUnboxToNQ(u), true, "BoxUnboxToNQ");
+ Assert.AreEqual(BoxUnboxToQ(u), true, "BoxUnboxToQ");
+ Assert.AreEqual(BoxUnboxToNQV(u), true, "BoxUnboxToNQV");
+ Assert.AreEqual(BoxUnboxToQV(u), true, "BoxUnboxToQV");
+ Assert.AreEqual(BoxUnboxToNQGen(u), true, "BoxUnboxToNQGen");
+ Assert.AreEqual(BoxUnboxToQGen(u), true, "BoxUnboxToQGen");
+ Assert.AreEqual(BoxUnboxToNQGenC<MixedAllStruct>(u), true, "BoxUnboxToNQGenC");
+ Assert.AreEqual(BoxUnboxToQGenC<MixedAllStruct>(u), true, "BoxUnboxToQGenC");
+ }
+}
+
+
+internal class Test
+{
+ private static int Main()
+ {
+ try
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ NullableTest3.Run();
+ NullableTest4.Run();
+ NullableTest5.Run();
+ NullableTest6.Run();
+ NullableTest7.Run();
+ NullableTest8.Run();
+ NullableTest9.Run();
+ NullableTest10.Run();
+ NullableTest11.Run();
+ NullableTest12.Run();
+ NullableTest13.Run();
+ NullableTest14.Run();
+ NullableTest15.Run();
+ NullableTest16.Run();
+ NullableTest17.Run();
+ NullableTest18.Run();
+ NullableTest19.Run();
+ NullableTest20.Run();
+ NullableTest21.Run();
+ NullableTest22.Run();
+ NullableTest23.Run();
+ NullableTest24.Run();
+ NullableTest25.Run();
+ NullableTest26.Run();
+ NullableTest27.Run();
+ NullableTest28.Run();
+ NullableTest29.Run();
+ NullableTest30.Run();
+ NullableTest31.Run();
+ NullableTest32.Run();
+ NullableTest33.Run();
+ NullableTest34.Run();
+ NullableTest37.Run();
+ NullableTest38.Run();
+ NullableTest39.Run();
+ NullableTest40.Run();
+ NullableTest41.Run();
+ NullableTest42.Run();
+ NullableTest43.Run();
+ NullableTest44.Run();
+ NullableTest45.Run();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Test FAILED");
+ Console.WriteLine(ex);
+ return 666;
+ }
+ return 100;
+ }
+}
+
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_d.csproj b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_d.csproj
new file mode 100644
index 0000000..78ce99d
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_d.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassvaluetype.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_do.csproj b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_do.csproj
new file mode 100644
index 0000000..14f13e3
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_do.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassvaluetype.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_r.csproj b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_r.csproj
new file mode 100644
index 0000000..db14d6e
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_r.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>False</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassvaluetype.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_ro.csproj b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_ro.csproj
new file mode 100644
index 0000000..3901561
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/castclassvaluetype_ro.csproj
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="castclassvaluetype.cs" />
+ <Compile Include="Desktop\StructDefinitions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/constructor.cs b/tests/src/JIT/Directed/nullabletypes/constructor.cs
new file mode 100644
index 0000000..d273e7c
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/constructor.cs
@@ -0,0 +1,55 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+//<Title>Nullable types have a default single-parameter constructor</Title>
+//<Description>
+// A nullable type can be created with a single argument constructor
+// The HasValue property will be set to true, and the Value property will get the value of the constructor
+//</Description>
+
+#pragma warning disable 0649
+
+using System;
+
+
+interface BaseInter { }
+interface GenInter<T> { }
+
+struct Struct { }
+struct ImplStruct : BaseInter { }
+struct OpenGenImplStruct<T> : GenInter<T> { }
+struct CloseGenImplStruct : GenInter<int> { }
+
+class Foo { }
+
+class NullableTest1
+{
+ static int? i = new int?(1);
+ static Struct? s = new Struct?(new Struct());
+ static ImplStruct? imps = new ImplStruct?(new ImplStruct());
+ static OpenGenImplStruct<Foo>? genfoo = new OpenGenImplStruct<Foo>?(new OpenGenImplStruct<Foo>());
+ static CloseGenImplStruct? genint = new CloseGenImplStruct?(new CloseGenImplStruct());
+
+
+ public static void Run()
+ {
+ Test.Eval(i.HasValue);
+ Test.Eval(i.Value, 1);
+ Test.Eval(s.HasValue);
+ Test.Eval(s.Value, default(Struct));
+ Test.Eval(imps.HasValue);
+ Test.Eval(imps.Value, default(ImplStruct));
+ Test.Eval(genfoo.HasValue);
+ Test.Eval(genfoo.Value, default(OpenGenImplStruct<Foo>));
+ Test.Eval(genint.HasValue);
+ Test.Eval(genint.Value, default(CloseGenImplStruct));
+ }
+}
+
+class NullableTests
+{
+ public static void Run()
+ {
+ NullableTest1.Run();
+ }
+} \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/constructor_d.csproj b/tests/src/JIT/Directed/nullabletypes/constructor_d.csproj
new file mode 100644
index 0000000..980c5ac
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/constructor_d.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>Full</DebugType>
+ <Optimize></Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="constructor.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/constructor_do.csproj b/tests/src/JIT/Directed/nullabletypes/constructor_do.csproj
new file mode 100644
index 0000000..726d4b2
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/constructor_do.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="constructor.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/constructor_r.csproj b/tests/src/JIT/Directed/nullabletypes/constructor_r.csproj
new file mode 100644
index 0000000..ee5bd84
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/constructor_r.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="constructor.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/constructor_ro.csproj b/tests/src/JIT/Directed/nullabletypes/constructor_ro.csproj
new file mode 100644
index 0000000..e19dc21
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/constructor_ro.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="constructor.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/hashcode.cs b/tests/src/JIT/Directed/nullabletypes/hashcode.cs
new file mode 100644
index 0000000..c7ed2ad
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hashcode.cs
@@ -0,0 +1,68 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+//<Title>Nullable types lift the GetHashCode() method from the underlying struct</Title>
+//<Description>
+// A nullable type with a value returns the GetHashCode() from the underlying struct
+//</Description>
+
+#pragma warning disable 0649
+using System;
+
+
+interface BaseInter { }
+interface GenInter<T> { }
+
+struct Struct { }
+struct ImplStruct : BaseInter { }
+struct OpenGenImplStruct<T> : GenInter<T> { }
+struct CloseGenImplStruct : GenInter<int> { }
+
+class Foo { }
+
+class NullableTest1
+{
+ static int? i = new int?(1);
+ static Struct? s = new Struct?(new Struct());
+ static ImplStruct? imps = new ImplStruct?(new ImplStruct());
+ static OpenGenImplStruct<Foo>? genfoo = new OpenGenImplStruct<Foo>?(new OpenGenImplStruct<Foo>());
+ static CloseGenImplStruct? genint = new CloseGenImplStruct?(new CloseGenImplStruct());
+
+
+ public static void Run()
+ {
+ Test.Eval(i.GetHashCode(), 1.GetHashCode());
+ Test.Eval(s.GetHashCode(), default(Struct).GetHashCode());
+ Test.Eval(imps.GetHashCode(), default(ImplStruct).GetHashCode());
+ Test.Eval(genfoo.GetHashCode(), default(OpenGenImplStruct<Foo>).GetHashCode());
+ Test.Eval(genint.GetHashCode(), default(CloseGenImplStruct).GetHashCode());
+ }
+}
+
+class NullableTest2
+{
+ static int? i;
+ static Struct? s;
+ static ImplStruct? imps;
+ static OpenGenImplStruct<Foo>? genfoo;
+ static CloseGenImplStruct? genint;
+
+
+ public static void Run()
+ {
+ Test.Eval(i.GetHashCode(), 0);
+ Test.Eval(s.GetHashCode(), 0);
+ Test.Eval(imps.GetHashCode(), 0);
+ Test.Eval(genfoo.GetHashCode(), 0);
+ Test.Eval(genint.GetHashCode(), 0);
+ }
+}
+
+public class NullableTests
+{
+ public static void Run()
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ }
+} \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/hashcode_d.csproj b/tests/src/JIT/Directed/nullabletypes/hashcode_d.csproj
new file mode 100644
index 0000000..c444e55
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hashcode_d.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>Full</DebugType>
+ <Optimize></Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="hashcode.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/hashcode_do.csproj b/tests/src/JIT/Directed/nullabletypes/hashcode_do.csproj
new file mode 100644
index 0000000..c96cc91
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hashcode_do.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="hashcode.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/hashcode_r.csproj b/tests/src/JIT/Directed/nullabletypes/hashcode_r.csproj
new file mode 100644
index 0000000..5e4bd66
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hashcode_r.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="hashcode.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/hashcode_ro.csproj b/tests/src/JIT/Directed/nullabletypes/hashcode_ro.csproj
new file mode 100644
index 0000000..34a2b73
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hashcode_ro.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="hashcode.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/hasvalue.cs b/tests/src/JIT/Directed/nullabletypes/hasvalue.cs
new file mode 100644
index 0000000..c36d5a4
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hasvalue.cs
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+//<Title>Nullable types have the HasValue property</Title>
+//<Description>
+// If the nullable type has a null value, HasValue is false
+//</Description>
+
+
+using System;
+
+
+interface BaseInter { }
+interface GenInter<T> { }
+
+struct Struct { }
+struct ImplStruct : BaseInter { }
+struct OpenGenImplStruct<T> : GenInter<T> { }
+struct CloseGenImplStruct : GenInter<int> { }
+
+class Foo { }
+
+class NullableTest1
+{
+ static int? i;
+ static Struct? s;
+ static ImplStruct? imps;
+ static OpenGenImplStruct<Foo>? genfoo;
+ static CloseGenImplStruct? genint;
+
+ public static void Run()
+ {
+ Test.IsFalse(i.HasValue);
+ i = null;
+ Test.IsFalse(i.HasValue);
+ Test.IsFalse(s.HasValue);
+ s = null;
+ Test.IsFalse(s.HasValue);
+ Test.IsFalse(imps.HasValue);
+ imps = null;
+ Test.IsFalse(imps.HasValue);
+ Test.IsFalse(genfoo.HasValue);
+ genfoo = null;
+ Test.IsFalse(genfoo.HasValue);
+ Test.IsFalse(genint.HasValue);
+ genint = null;
+ Test.IsFalse(genint.HasValue);
+ }
+}
+
+class NullableTest2
+{
+ static int? i = 1;
+ static Struct? s = new Struct();
+ static ImplStruct? imps = new ImplStruct();
+ static OpenGenImplStruct<Foo>? genfoo = new OpenGenImplStruct<Foo>();
+ static CloseGenImplStruct? genint = new CloseGenImplStruct();
+
+
+ public static void Run()
+ {
+ Test.Eval(i.HasValue);
+ Test.Eval(s.HasValue);
+ Test.Eval(imps.HasValue);
+ Test.Eval(genfoo.HasValue);
+ Test.Eval(genint.HasValue);
+ }
+}
+
+class NullableTests
+{
+ public static void Run()
+ {
+ NullableTest1.Run();
+ NullableTest2.Run();
+ }
+} \ No newline at end of file
diff --git a/tests/src/JIT/Directed/nullabletypes/hasvalue_d.csproj b/tests/src/JIT/Directed/nullabletypes/hasvalue_d.csproj
new file mode 100644
index 0000000..16ba577
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hasvalue_d.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>Full</DebugType>
+ <Optimize></Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="hasvalue.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/hasvalue_do.csproj b/tests/src/JIT/Directed/nullabletypes/hasvalue_do.csproj
new file mode 100644
index 0000000..e792df3
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hasvalue_do.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="hasvalue.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/hasvalue_r.csproj b/tests/src/JIT/Directed/nullabletypes/hasvalue_r.csproj
new file mode 100644
index 0000000..034a3b2
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hasvalue_r.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="hasvalue.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/hasvalue_ro.csproj b/tests/src/JIT/Directed/nullabletypes/hasvalue_ro.csproj
new file mode 100644
index 0000000..06934c5
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/hasvalue_ro.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="hasvalue.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/invocation.cs b/tests/src/JIT/Directed/nullabletypes/invocation.cs
new file mode 100644
index 0000000..5487cac
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/invocation.cs
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+//<Title>Nullable types lift the GetHashCode() method from the underlying struct</Title>
+//<Description>
+// A nullable type with a value returns the GetHashCode() from the underlying struct
+//</Description>
+
+
+using System;
+
+
+interface BaseInter
+{
+ int Foo();
+}
+interface GenInter<T>
+{
+ int Foo();
+}
+
+struct Struct
+{
+ public int Foo() { return 0x0001; }
+}
+
+struct ImplStruct : BaseInter
+{
+ public int Foo() { return 0x0010; }
+}
+
+struct OpenGenImplStruct<T> : GenInter<T>
+{
+ public int Foo() { return 0x0100; }
+}
+
+struct CloseGenImplStruct : GenInter<int>
+{
+ public int Foo() { return 0x1000; }
+}
+
+struct CloseGenImplGenAndImplStruct<T> : BaseInter, GenInter<int>
+{
+ public int Foo() { return 0x1001; }
+ int BaseInter.Foo() { return 0x0110; }
+}
+
+
+class Foo { }
+
+class NullableTests
+{
+ static Struct? s = default(Struct);
+ static ImplStruct? imps = default(ImplStruct);
+ static OpenGenImplStruct<int>? ogis = default(OpenGenImplStruct<int>);
+ static CloseGenImplStruct? cgis = default(CloseGenImplStruct);
+ static CloseGenImplGenAndImplStruct<int>? cgiis = default(CloseGenImplGenAndImplStruct<int>);
+
+ public static void Run()
+ {
+ Test.Eval(s.Value.Foo() == 0x0001);
+ Test.Eval(((Struct)((object)s)).Foo() == 0x0001);
+ Test.Eval(((Struct)((ValueType)s)).Foo() == 0x0001);
+
+ Test.Eval(imps.Value.Foo() == 0x0010);
+ Test.Eval(((ImplStruct)(object)imps).Foo() == 0x0010);
+ Test.Eval(((ImplStruct)(ValueType)imps).Foo() == 0x0010);
+ Test.Eval(((BaseInter)imps).Foo() == 0x0010);
+
+ Test.Eval(ogis.Value.Foo() == 0x0100);
+ Test.Eval(((OpenGenImplStruct<int>)(object)ogis).Foo() == 0x0100);
+ Test.Eval(((OpenGenImplStruct<int>)(ValueType)ogis).Foo() == 0x0100);
+ Test.Eval(((GenInter<int>)ogis).Foo() == 0x0100);
+
+ Test.Eval(cgis.Value.Foo() == 0x1000);
+ Test.Eval(((CloseGenImplStruct)(object)cgis).Foo() == 0x1000);
+ Test.Eval(((CloseGenImplStruct)(ValueType)cgis).Foo() == 0x1000);
+ Test.Eval(((GenInter<int>)cgis).Foo() == 0x1000);
+
+ Test.Eval(cgiis.Value.Foo() == 0x1001);
+ Test.Eval(((CloseGenImplGenAndImplStruct<int>)(object)cgiis).Foo() == 0x1001);
+ Test.Eval(((CloseGenImplGenAndImplStruct<int>)(ValueType)cgiis).Foo() == 0x1001);
+ Test.Eval(((GenInter<int>)cgiis).Foo() == 0x1001);
+ Test.Eval(((BaseInter)cgiis).Foo() == 0x0110);
+ }
+}
diff --git a/tests/src/JIT/Directed/nullabletypes/invocation_d.csproj b/tests/src/JIT/Directed/nullabletypes/invocation_d.csproj
new file mode 100644
index 0000000..eae13fa
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/invocation_d.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>Full</DebugType>
+ <Optimize></Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="invocation.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/invocation_do.csproj b/tests/src/JIT/Directed/nullabletypes/invocation_do.csproj
new file mode 100644
index 0000000..b07cb2e
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/invocation_do.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>Full</DebugType>
+ <Optimize>True</Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="invocation.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/invocation_r.csproj b/tests/src/JIT/Directed/nullabletypes/invocation_r.csproj
new file mode 100644
index 0000000..ad709a1
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/invocation_r.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ <NoLogo>True</NoLogo>
+ <DefineConstants>$(DefineConstants);DESKTOP</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="invocation.cs" />
+ <Compile Include="invokecommon.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Directed/nullabletypes/invocation_ro.csproj b/tests/src/JIT/Directed/nullabletypes/invocation_ro.csproj
new file mode 100644
index 0000000..ef456c9
--- /dev/null
+++ b/tests/src/JIT/Directed/nullabletypes/invocation_ro.csproj
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>