/IronPython_Main/Runtime/Tests/ETScenariosCSLinq/CSLinq/ExpressionCompiler/constant_BackSl_test0.cs
C# | 17067 lines | 13916 code | 2661 blank | 490 comment | 1717 complexity | 22396c4bece7d3cee26efab926f9d6e0 MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
- #if !CLR2
- using System.Linq.Expressions;
- #else
- using Microsoft.Scripting.Ast;
- using Microsoft.Scripting.Utils;
- #endif
-
- using System.Reflection;
- using System;
- namespace ExpressionCompiler {
-
-
- //-------- Scenario 1706
- namespace Scenario1706{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check0__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check0__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check0();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check0() {
- foreach (byte val in new byte[] { 0, 1, byte.MaxValue }) {
- if (!check0(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check0(byte val) {
- Expression<Func<byte>> e =
- Expression.Lambda<Func<byte>>(
- Expression.Constant(val, typeof(byte)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<byte> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1707
- namespace Scenario1707{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check1__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check1__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check1();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check1() {
- foreach (ushort val in new ushort[] { 0, 1, ushort.MaxValue }) {
- if (!check1(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check1(ushort val) {
- Expression<Func<ushort>> e =
- Expression.Lambda<Func<ushort>>(
- Expression.Constant(val, typeof(ushort)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<ushort> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1708
- namespace Scenario1708{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check2__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check2__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check2();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check2() {
- foreach (uint val in new uint[] { 0, 1, uint.MaxValue }) {
- if (!check2(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check2(uint val) {
- Expression<Func<uint>> e =
- Expression.Lambda<Func<uint>>(
- Expression.Constant(val, typeof(uint)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<uint> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1709
- namespace Scenario1709{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check3__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check3__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check3();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check3() {
- foreach (ulong val in new ulong[] { 0, 1, ulong.MaxValue }) {
- if (!check3(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check3(ulong val) {
- Expression<Func<ulong>> e =
- Expression.Lambda<Func<ulong>>(
- Expression.Constant(val, typeof(ulong)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<ulong> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1710
- namespace Scenario1710{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check4__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check4__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check4();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check4() {
- foreach (sbyte val in new sbyte[] { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }) {
- if (!check4(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check4(sbyte val) {
- Expression<Func<sbyte>> e =
- Expression.Lambda<Func<sbyte>>(
- Expression.Constant(val, typeof(sbyte)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<sbyte> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1711
- namespace Scenario1711{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check5__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check5__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check5();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check5() {
- foreach (short val in new short[] { 0, 1, -1, short.MinValue, short.MaxValue }) {
- if (!check5(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check5(short val) {
- Expression<Func<short>> e =
- Expression.Lambda<Func<short>>(
- Expression.Constant(val, typeof(short)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<short> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1712
- namespace Scenario1712{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check6__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check6__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check6();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check6() {
- foreach (int val in new int[] { 0, 1, -1, int.MinValue, int.MaxValue }) {
- if (!check6(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check6(int val) {
- Expression<Func<int>> e =
- Expression.Lambda<Func<int>>(
- Expression.Constant(val, typeof(int)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<int> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1713
- namespace Scenario1713{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check7__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check7__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check7();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check7() {
- foreach (long val in new long[] { 0, 1, -1, long.MinValue, long.MaxValue }) {
- if (!check7(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check7(long val) {
- Expression<Func<long>> e =
- Expression.Lambda<Func<long>>(
- Expression.Constant(val, typeof(long)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<long> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1714
- namespace Scenario1714{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check8__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check8__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check8();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check8() {
- foreach (float val in new float[] { 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN }) {
- if (!check8(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check8(float val) {
- Expression<Func<float>> e =
- Expression.Lambda<Func<float>>(
- Expression.Constant(val, typeof(float)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<float> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1715
- namespace Scenario1715{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check9__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check9__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check9();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check9() {
- foreach (double val in new double[] { 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN }) {
- if (!check9(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check9(double val) {
- Expression<Func<double>> e =
- Expression.Lambda<Func<double>>(
- Expression.Constant(val, typeof(double)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<double> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1716
- namespace Scenario1716{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check10__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check10__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check10();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check10() {
- foreach (decimal val in new decimal[] { decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue }) {
- if (!check10(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check10(decimal val) {
- Expression<Func<decimal>> e =
- Expression.Lambda<Func<decimal>>(
- Expression.Constant(val, typeof(decimal)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<decimal> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1717
- namespace Scenario1717{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check11__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check11__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check11();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check11() {
- foreach (char val in new char[] { '\0', '\b', 'A', '\uffff' }) {
- if (!check11(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check11(char val) {
- Expression<Func<char>> e =
- Expression.Lambda<Func<char>>(
- Expression.Constant(val, typeof(char)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<char> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1718
- namespace Scenario1718{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check12__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check12__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check12();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check12() {
- foreach (bool val in new bool[] { true, false }) {
- if (!check12(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check12(bool val) {
- Expression<Func<bool>> e =
- Expression.Lambda<Func<bool>>(
- Expression.Constant(val, typeof(bool)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<bool> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1719
- namespace Scenario1719{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check13__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check13__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check13();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check13() {
- foreach (S val in new S[] { default(S), new S() }) {
- if (!check13(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check13(S val) {
- Expression<Func<S>> e =
- Expression.Lambda<Func<S>>(
- Expression.Constant(val, typeof(S)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<S> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1720
- namespace Scenario1720{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check14__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check14__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check14();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check14() {
- foreach (Sp val in new Sp[] { default(Sp), new Sp(), new Sp(5,5.0) }) {
- if (!check14(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check14(Sp val) {
- Expression<Func<Sp>> e =
- Expression.Lambda<Func<Sp>>(
- Expression.Constant(val, typeof(Sp)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Sp> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1721
- namespace Scenario1721{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check15__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check15__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check15();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check15() {
- foreach (Ss val in new Ss[] { default(Ss), new Ss(), new Ss(new S()) }) {
- if (!check15(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check15(Ss val) {
- Expression<Func<Ss>> e =
- Expression.Lambda<Func<Ss>>(
- Expression.Constant(val, typeof(Ss)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ss> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1722
- namespace Scenario1722{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check16__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check16__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check16();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check16() {
- foreach (Sc val in new Sc[] { default(Sc), new Sc(), new Sc(null) }) {
- if (!check16(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check16(Sc val) {
- Expression<Func<Sc>> e =
- Expression.Lambda<Func<Sc>>(
- Expression.Constant(val, typeof(Sc)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Sc> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1723
- namespace Scenario1723{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check17__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check17__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check17();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check17() {
- foreach (Scs val in new Scs[] { default(Scs), new Scs(), new Scs(null,new S()) }) {
- if (!check17(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check17(Scs val) {
- Expression<Func<Scs>> e =
- Expression.Lambda<Func<Scs>>(
- Expression.Constant(val, typeof(Scs)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Scs> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1724
- namespace Scenario1724{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check18_S___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check18_S___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check18<S>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check18<Ts>() where Ts : struct {
- foreach (Ts val in new Ts[] { default(Ts), new Ts() }) {
- if (!check18<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check18<Ts>(Ts val) where Ts : struct {
- Expression<Func<Ts>> e =
- Expression.Lambda<Func<Ts>>(
- Expression.Constant(val, typeof(Ts)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1725
- namespace Scenario1725{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check18_Scs___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check18_Scs___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check18<Scs>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check18<Ts>() where Ts : struct {
- foreach (Ts val in new Ts[] { default(Ts), new Ts() }) {
- if (!check18<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check18<Ts>(Ts val) where Ts : struct {
- Expression<Func<Ts>> e =
- Expression.Lambda<Func<Ts>>(
- Expression.Constant(val, typeof(Ts)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1726
- namespace Scenario1726{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check18_E___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check18_E___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check18<E>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check18<Ts>() where Ts : struct {
- foreach (Ts val in new Ts[] { default(Ts), new Ts() }) {
- if (!check18<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check18<Ts>(Ts val) where Ts : struct {
- Expression<Func<Ts>> e =
- Expression.Lambda<Func<Ts>>(
- Expression.Constant(val, typeof(Ts)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1727
- namespace Scenario1727{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check19__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check19__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check19();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check19() {
- foreach (E val in new E[] { (E) 0, E.A, E.B, (E) int.MaxValue, (E) int.MinValue }) {
- if (!check19(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check19(E val) {
- Expression<Func<E>> e =
- Expression.Lambda<Func<E>>(
- Expression.Constant(val, typeof(E)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<E> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1728
- namespace Scenario1728{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check20__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check20__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check20();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check20() {
- foreach (El val in new El[] { (El) 0, El.A, El.B, (El) long.MaxValue, (El) long.MinValue }) {
- if (!check20(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check20(El val) {
- Expression<Func<El>> e =
- Expression.Lambda<Func<El>>(
- Expression.Constant(val, typeof(El)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<El> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1729
- namespace Scenario1729{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check21__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check21__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check21();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check21() {
- foreach (string val in new string[] { null, "", "a", "foo" }) {
- if (!check21(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check21(string val) {
- Expression<Func<string>> e =
- Expression.Lambda<Func<string>>(
- Expression.Constant(val, typeof(string)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<string> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1730
- namespace Scenario1730{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check22__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check22__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check22();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check22() {
- foreach (object val in new object[] { null, new object(), new C(), new D(3) }) {
- if (!check22(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check22(object val) {
- Expression<Func<object>> e =
- Expression.Lambda<Func<object>>(
- Expression.Constant(val, typeof(object)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<object> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1731
- namespace Scenario1731{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check23__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check23__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check23();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check23() {
- foreach (C val in new C[] { null, new C(), new D(), new D(0), new D(5) }) {
- if (!check23(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check23(C val) {
- Expression<Func<C>> e =
- Expression.Lambda<Func<C>>(
- Expression.Constant(val, typeof(C)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<C> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1732
- namespace Scenario1732{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check24__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check24__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check24();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check24() {
- foreach (D val in new D[] { null, new D(), new D(0), new D(5) }) {
- if (!check24(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check24(D val) {
- Expression<Func<D>> e =
- Expression.Lambda<Func<D>>(
- Expression.Constant(val, typeof(D)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<D> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1733
- namespace Scenario1733{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check25_object___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check25_object___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check25<object>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check25<T>() {
- foreach (T val in new T[] { default(T) }) {
- if (!check25<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check25<T>(T val) {
- Expression<Func<T>> e =
- Expression.Lambda<Func<T>>(
- Expression.Constant(val, typeof(T)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1734
- namespace Scenario1734{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check25_C___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check25_C___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check25<C>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check25<T>() {
- foreach (T val in new T[] { default(T) }) {
- if (!check25<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check25<T>(T val) {
- Expression<Func<T>> e =
- Expression.Lambda<Func<T>>(
- Expression.Constant(val, typeof(T)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1735
- namespace Scenario1735{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check25_S___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check25_S___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check25<S>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check25<T>() {
- foreach (T val in new T[] { default(T) }) {
- if (!check25<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check25<T>(T val) {
- Expression<Func<T>> e =
- Expression.Lambda<Func<T>>(
- Expression.Constant(val, typeof(T)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1736
- namespace Scenario1736{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check25_Scs___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check25_Scs___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check25<Scs>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check25<T>() {
- foreach (T val in new T[] { default(T) }) {
- if (!check25<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check25<T>(T val) {
- Expression<Func<T>> e =
- Expression.Lambda<Func<T>>(
- Expression.Constant(val, typeof(T)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1737
- namespace Scenario1737{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check25_E___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check25_E___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check25<E>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check25<T>() {
- foreach (T val in new T[] { default(T) }) {
- if (!check25<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check25<T>(T val) {
- Expression<Func<T>> e =
- Expression.Lambda<Func<T>>(
- Expression.Constant(val, typeof(T)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1738
- namespace Scenario1738{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check26_object___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check26_object___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check26<object>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check26<Tc>() where Tc : class {
- foreach (Tc val in new Tc[] { null, default(Tc) }) {
- if (!check26<Tc>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check26<Tc>(Tc val) where Tc : class {
- Expression<Func<Tc>> e =
- Expression.Lambda<Func<Tc>>(
- Expression.Constant(val, typeof(Tc)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Tc> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1739
- namespace Scenario1739{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check26_C___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check26_C___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check26<C>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check26<Tc>() where Tc : class {
- foreach (Tc val in new Tc[] { null, default(Tc) }) {
- if (!check26<Tc>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check26<Tc>(Tc val) where Tc : class {
- Expression<Func<Tc>> e =
- Expression.Lambda<Func<Tc>>(
- Expression.Constant(val, typeof(Tc)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Tc> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1740
- namespace Scenario1740{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check27_object___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check27_object___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check27<object>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check27<Tcn>() where Tcn : class, new() {
- foreach (Tcn val in new Tcn[] { null, default(Tcn), new Tcn() }) {
- if (!check27<Tcn>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check27<Tcn>(Tcn val) where Tcn : class, new() {
- Expression<Func<Tcn>> e =
- Expression.Lambda<Func<Tcn>>(
- Expression.Constant(val, typeof(Tcn)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Tcn> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1741
- namespace Scenario1741{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check27_C___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check27_C___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check27<C>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check27<Tcn>() where Tcn : class, new() {
- foreach (Tcn val in new Tcn[] { null, default(Tcn), new Tcn() }) {
- if (!check27<Tcn>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check27<Tcn>(Tcn val) where Tcn : class, new() {
- Expression<Func<Tcn>> e =
- Expression.Lambda<Func<Tcn>>(
- Expression.Constant(val, typeof(Tcn)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Tcn> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1742
- namespace Scenario1742{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check28_C___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check28_C___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check28<C>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check28<TC>() where TC : C {
- foreach (TC val in new TC[] { null, default(TC), (TC) new C() }) {
- if (!check28<TC>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check28<TC>(TC val) where TC : C {
- Expression<Func<TC>> e =
- Expression.Lambda<Func<TC>>(
- Expression.Constant(val, typeof(TC)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<TC> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1743
- namespace Scenario1743{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check29_C___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check29_C___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check29<C>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check29<TCn>() where TCn : C, new() {
- foreach (TCn val in new TCn[] { null, default(TCn), new TCn(), (TCn) new C() }) {
- if (!check29<TCn>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check29<TCn>(TCn val) where TCn : C, new() {
- Expression<Func<TCn>> e =
- Expression.Lambda<Func<TCn>>(
- Expression.Constant(val, typeof(TCn)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<TCn> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1744
- namespace Scenario1744{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check30__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check30__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check30();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check30() {
- foreach (Delegate val in new Delegate[] { null, (Func<object>) delegate() { return null; }, (Func<int, int>) delegate(int i) { return i+1; }, (Action<object>) delegate { } }) {
- if (!check30(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check30(Delegate val) {
- Expression<Func<Delegate>> e =
- Expression.Lambda<Func<Delegate>>(
- Expression.Constant(val, typeof(Delegate)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Delegate> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1745
- namespace Scenario1745{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check31__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check31__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check31();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check31() {
- foreach (Func<object> val in new Func<object>[] { null, (Func<object>) delegate() { return null; } }) {
- if (!check31(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check31(Func<object> val) {
- Expression<Func<Func<object>>> e =
- Expression.Lambda<Func<Func<object>>>(
- Expression.Constant(val, typeof(Func<object>)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Func<object>> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1746
- namespace Scenario1746{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check32__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check32__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check32();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check32() {
- foreach (IEquatable<C> val in new IEquatable<C>[] { null, new C(), new D(), new D(0), new D(5) }) {
- if (!check32(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check32(IEquatable<C> val) {
- Expression<Func<IEquatable<C>>> e =
- Expression.Lambda<Func<IEquatable<C>>>(
- Expression.Constant(val, typeof(IEquatable<C>)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<IEquatable<C>> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1747
- namespace Scenario1747{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check33__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check33__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check33();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check33() {
- foreach (IEquatable<D> val in new IEquatable<D>[] { null, new D(), new D(0), new D(5) }) {
- if (!check33(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check33(IEquatable<D> val) {
- Expression<Func<IEquatable<D>>> e =
- Expression.Lambda<Func<IEquatable<D>>>(
- Expression.Constant(val, typeof(IEquatable<D>)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<IEquatable<D>> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1748
- namespace Scenario1748{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check34__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check34__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check34();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check34() {
- foreach (I val in new I[] { null, new C(), new D(), new D(0), new D(5) }) {
- if (!check34(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check34(I val) {
- Expression<Func<I>> e =
- Expression.Lambda<Func<I>>(
- Expression.Constant(val, typeof(I)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<I> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1749
- namespace Scenario1749{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check35__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check35__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check35();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check35() {
- foreach (byte? val in new byte?[] { null, 0, 1, byte.MaxValue }) {
- if (!check35(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check35(byte? val) {
- Expression<Func<byte?>> e =
- Expression.Lambda<Func<byte?>>(
- Expression.Constant(val, typeof(byte?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<byte?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1750
- namespace Scenario1750{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check36__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check36__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check36();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check36() {
- foreach (ushort? val in new ushort?[] { null, 0, 1, ushort.MaxValue }) {
- if (!check36(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check36(ushort? val) {
- Expression<Func<ushort?>> e =
- Expression.Lambda<Func<ushort?>>(
- Expression.Constant(val, typeof(ushort?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<ushort?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1751
- namespace Scenario1751{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check37__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check37__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check37();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check37() {
- foreach (uint? val in new uint?[] { null, 0, 1, uint.MaxValue }) {
- if (!check37(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check37(uint? val) {
- Expression<Func<uint?>> e =
- Expression.Lambda<Func<uint?>>(
- Expression.Constant(val, typeof(uint?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<uint?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1752
- namespace Scenario1752{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check38__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check38__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check38();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check38() {
- foreach (ulong? val in new ulong?[] { null, 0, 1, ulong.MaxValue }) {
- if (!check38(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check38(ulong? val) {
- Expression<Func<ulong?>> e =
- Expression.Lambda<Func<ulong?>>(
- Expression.Constant(val, typeof(ulong?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<ulong?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1753
- namespace Scenario1753{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check39__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check39__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check39();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check39() {
- foreach (sbyte? val in new sbyte?[] { null, 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }) {
- if (!check39(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check39(sbyte? val) {
- Expression<Func<sbyte?>> e =
- Expression.Lambda<Func<sbyte?>>(
- Expression.Constant(val, typeof(sbyte?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<sbyte?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1754
- namespace Scenario1754{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check40__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check40__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check40();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check40() {
- foreach (short? val in new short?[] { null, 0, 1, -1, short.MinValue, short.MaxValue }) {
- if (!check40(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check40(short? val) {
- Expression<Func<short?>> e =
- Expression.Lambda<Func<short?>>(
- Expression.Constant(val, typeof(short?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<short?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1755
- namespace Scenario1755{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check41__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check41__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check41();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check41() {
- foreach (int? val in new int?[] { null, 0, 1, -1, int.MinValue, int.MaxValue }) {
- if (!check41(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check41(int? val) {
- Expression<Func<int?>> e =
- Expression.Lambda<Func<int?>>(
- Expression.Constant(val, typeof(int?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<int?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1756
- namespace Scenario1756{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check42__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check42__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check42();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check42() {
- foreach (long? val in new long?[] { null, 0, 1, -1, long.MinValue, long.MaxValue }) {
- if (!check42(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check42(long? val) {
- Expression<Func<long?>> e =
- Expression.Lambda<Func<long?>>(
- Expression.Constant(val, typeof(long?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<long?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1757
- namespace Scenario1757{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check43__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check43__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check43();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check43() {
- foreach (float? val in new float?[] { null, 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN }) {
- if (!check43(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check43(float? val) {
- Expression<Func<float?>> e =
- Expression.Lambda<Func<float?>>(
- Expression.Constant(val, typeof(float?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<float?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1758
- namespace Scenario1758{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check44__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check44__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check44();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check44() {
- foreach (double? val in new double?[] { null, 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN }) {
- if (!check44(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check44(double? val) {
- Expression<Func<double?>> e =
- Expression.Lambda<Func<double?>>(
- Expression.Constant(val, typeof(double?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<double?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1759
- namespace Scenario1759{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check45__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check45__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check45();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check45() {
- foreach (decimal? val in new decimal?[] { null, decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue }) {
- if (!check45(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check45(decimal? val) {
- Expression<Func<decimal?>> e =
- Expression.Lambda<Func<decimal?>>(
- Expression.Constant(val, typeof(decimal?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<decimal?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1760
- namespace Scenario1760{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check46__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check46__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check46();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check46() {
- foreach (char? val in new char?[] { null, '\0', '\b', 'A', '\uffff' }) {
- if (!check46(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check46(char? val) {
- Expression<Func<char?>> e =
- Expression.Lambda<Func<char?>>(
- Expression.Constant(val, typeof(char?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<char?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1761
- namespace Scenario1761{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check47__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check47__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check47();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check47() {
- foreach (bool? val in new bool?[] { null, true, false }) {
- if (!check47(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check47(bool? val) {
- Expression<Func<bool?>> e =
- Expression.Lambda<Func<bool?>>(
- Expression.Constant(val, typeof(bool?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<bool?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1762
- namespace Scenario1762{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check48__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check48__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check48();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check48() {
- foreach (S? val in new S?[] { null, default(S), new S() }) {
- if (!check48(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check48(S? val) {
- Expression<Func<S?>> e =
- Expression.Lambda<Func<S?>>(
- Expression.Constant(val, typeof(S?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<S?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1763
- namespace Scenario1763{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check49__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check49__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check49();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check49() {
- foreach (Sp? val in new Sp?[] { null, default(Sp), new Sp(), new Sp(5,5.0) }) {
- if (!check49(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check49(Sp? val) {
- Expression<Func<Sp?>> e =
- Expression.Lambda<Func<Sp?>>(
- Expression.Constant(val, typeof(Sp?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Sp?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1764
- namespace Scenario1764{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check50__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check50__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check50();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check50() {
- foreach (Ss? val in new Ss?[] { null, default(Ss), new Ss(), new Ss(new S()) }) {
- if (!check50(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check50(Ss? val) {
- Expression<Func<Ss?>> e =
- Expression.Lambda<Func<Ss?>>(
- Expression.Constant(val, typeof(Ss?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ss?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1765
- namespace Scenario1765{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check51__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check51__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check51();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check51() {
- foreach (Sc? val in new Sc?[] { null, default(Sc), new Sc(), new Sc(null) }) {
- if (!check51(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check51(Sc? val) {
- Expression<Func<Sc?>> e =
- Expression.Lambda<Func<Sc?>>(
- Expression.Constant(val, typeof(Sc?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Sc?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1766
- namespace Scenario1766{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check52__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check52__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check52();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check52() {
- foreach (Scs? val in new Scs?[] { null, default(Scs), new Scs(), new Scs(null,new S()) }) {
- if (!check52(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check52(Scs? val) {
- Expression<Func<Scs?>> e =
- Expression.Lambda<Func<Scs?>>(
- Expression.Constant(val, typeof(Scs?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Scs?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1767
- namespace Scenario1767{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check53_S___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check53_S___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check53<S>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check53<Ts>() where Ts : struct {
- foreach (Ts? val in new Ts?[] { null, default(Ts), new Ts() }) {
- if (!check53<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check53<Ts>(Ts? val) where Ts : struct {
- Expression<Func<Ts?>> e =
- Expression.Lambda<Func<Ts?>>(
- Expression.Constant(val, typeof(Ts?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1768
- namespace Scenario1768{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check53_Scs___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check53_Scs___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check53<Scs>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check53<Ts>() where Ts : struct {
- foreach (Ts? val in new Ts?[] { null, default(Ts), new Ts() }) {
- if (!check53<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check53<Ts>(Ts? val) where Ts : struct {
- Expression<Func<Ts?>> e =
- Expression.Lambda<Func<Ts?>>(
- Expression.Constant(val, typeof(Ts?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1769
- namespace Scenario1769{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check53_E___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check53_E___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check53<E>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check53<Ts>() where Ts : struct {
- foreach (Ts? val in new Ts?[] { null, default(Ts), new Ts() }) {
- if (!check53<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check53<Ts>(Ts? val) where Ts : struct {
- Expression<Func<Ts?>> e =
- Expression.Lambda<Func<Ts?>>(
- Expression.Constant(val, typeof(Ts?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1770
- namespace Scenario1770{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check54__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check54__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check54();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check54() {
- foreach (E? val in new E?[] { null, (E) 0, E.A, E.B, (E) int.MaxValue, (E) int.MinValue }) {
- if (!check54(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check54(E? val) {
- Expression<Func<E?>> e =
- Expression.Lambda<Func<E?>>(
- Expression.Constant(val, typeof(E?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<E?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1771
- namespace Scenario1771{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check55__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check55__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check55();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check55() {
- foreach (El? val in new El?[] { null, (El) 0, El.A, El.B, (El) long.MaxValue, (El) long.MinValue }) {
- if (!check55(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check55(El? val) {
- Expression<Func<El?>> e =
- Expression.Lambda<Func<El?>>(
- Expression.Constant(val, typeof(El?)),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<El?> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1772
- namespace Scenario1772{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check56__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check56__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check56();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check56() {
- foreach (byte[] val in new byte[][] { null, new byte[0], new byte[] { 0, 1, byte.MaxValue }, new byte[100] }) {
- if (!check56(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check56(byte[] val) {
- Expression<Func<byte[]>> e =
- Expression.Lambda<Func<byte[]>>(
- Expression.Constant(val, typeof(byte[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<byte[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1773
- namespace Scenario1773{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check57__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check57__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check57();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check57() {
- foreach (ushort[] val in new ushort[][] { null, new ushort[0], new ushort[] { 0, 1, ushort.MaxValue }, new ushort[100] }) {
- if (!check57(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check57(ushort[] val) {
- Expression<Func<ushort[]>> e =
- Expression.Lambda<Func<ushort[]>>(
- Expression.Constant(val, typeof(ushort[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<ushort[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1774
- namespace Scenario1774{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check58__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check58__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check58();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check58() {
- foreach (uint[] val in new uint[][] { null, new uint[0], new uint[] { 0, 1, uint.MaxValue }, new uint[100] }) {
- if (!check58(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check58(uint[] val) {
- Expression<Func<uint[]>> e =
- Expression.Lambda<Func<uint[]>>(
- Expression.Constant(val, typeof(uint[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<uint[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1775
- namespace Scenario1775{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check59__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check59__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check59();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check59() {
- foreach (ulong[] val in new ulong[][] { null, new ulong[0], new ulong[] { 0, 1, ulong.MaxValue }, new ulong[100] }) {
- if (!check59(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check59(ulong[] val) {
- Expression<Func<ulong[]>> e =
- Expression.Lambda<Func<ulong[]>>(
- Expression.Constant(val, typeof(ulong[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<ulong[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1776
- namespace Scenario1776{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check60__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check60__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check60();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check60() {
- foreach (sbyte[] val in new sbyte[][] { null, new sbyte[0], new sbyte[] { 0, 1, -1, sbyte.MinValue, sbyte.MaxValue }, new sbyte[100] }) {
- if (!check60(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check60(sbyte[] val) {
- Expression<Func<sbyte[]>> e =
- Expression.Lambda<Func<sbyte[]>>(
- Expression.Constant(val, typeof(sbyte[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<sbyte[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1777
- namespace Scenario1777{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check61__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check61__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check61();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check61() {
- foreach (short[] val in new short[][] { null, new short[0], new short[] { 0, 1, -1, short.MinValue, short.MaxValue }, new short[100] }) {
- if (!check61(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check61(short[] val) {
- Expression<Func<short[]>> e =
- Expression.Lambda<Func<short[]>>(
- Expression.Constant(val, typeof(short[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<short[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1778
- namespace Scenario1778{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check62__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check62__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check62();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check62() {
- foreach (int[] val in new int[][] { null, new int[0], new int[] { 0, 1, -1, int.MinValue, int.MaxValue }, new int[100] }) {
- if (!check62(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check62(int[] val) {
- Expression<Func<int[]>> e =
- Expression.Lambda<Func<int[]>>(
- Expression.Constant(val, typeof(int[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<int[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1779
- namespace Scenario1779{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check63__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check63__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check63();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check63() {
- foreach (long[] val in new long[][] { null, new long[0], new long[] { 0, 1, -1, long.MinValue, long.MaxValue }, new long[100] }) {
- if (!check63(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check63(long[] val) {
- Expression<Func<long[]>> e =
- Expression.Lambda<Func<long[]>>(
- Expression.Constant(val, typeof(long[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<long[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1780
- namespace Scenario1780{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check64__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check64__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check64();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check64() {
- foreach (float[] val in new float[][] { null, new float[0], new float[] { 0, 1, -1, float.MinValue, float.MaxValue, float.Epsilon, float.NegativeInfinity, float.PositiveInfinity, float.NaN }, new float[100] }) {
- if (!check64(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check64(float[] val) {
- Expression<Func<float[]>> e =
- Expression.Lambda<Func<float[]>>(
- Expression.Constant(val, typeof(float[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<float[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1781
- namespace Scenario1781{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check65__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check65__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check65();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check65() {
- foreach (double[] val in new double[][] { null, new double[0], new double[] { 0, 1, -1, double.MinValue, double.MaxValue, double.Epsilon, double.NegativeInfinity, double.PositiveInfinity, double.NaN }, new double[100] }) {
- if (!check65(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check65(double[] val) {
- Expression<Func<double[]>> e =
- Expression.Lambda<Func<double[]>>(
- Expression.Constant(val, typeof(double[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<double[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1782
- namespace Scenario1782{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check66__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check66__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check66();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check66() {
- foreach (decimal[] val in new decimal[][] { null, new decimal[0], new decimal[] { decimal.Zero, decimal.One, decimal.MinusOne, decimal.MinValue, decimal.MaxValue }, new decimal[100] }) {
- if (!check66(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check66(decimal[] val) {
- Expression<Func<decimal[]>> e =
- Expression.Lambda<Func<decimal[]>>(
- Expression.Constant(val, typeof(decimal[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<decimal[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1783
- namespace Scenario1783{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check67__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check67__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check67();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check67() {
- foreach (char[] val in new char[][] { null, new char[0], new char[] { '\0', '\b', 'A', '\uffff' }, new char[100] }) {
- if (!check67(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check67(char[] val) {
- Expression<Func<char[]>> e =
- Expression.Lambda<Func<char[]>>(
- Expression.Constant(val, typeof(char[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<char[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1784
- namespace Scenario1784{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check68__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check68__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check68();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check68() {
- foreach (bool[] val in new bool[][] { null, new bool[0], new bool[] { true, false }, new bool[100] }) {
- if (!check68(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check68(bool[] val) {
- Expression<Func<bool[]>> e =
- Expression.Lambda<Func<bool[]>>(
- Expression.Constant(val, typeof(bool[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<bool[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1785
- namespace Scenario1785{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check69__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check69__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check69();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check69() {
- foreach (S[] val in new S[][] { null, new S[0], new S[] { default(S), new S() }, new S[100] }) {
- if (!check69(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check69(S[] val) {
- Expression<Func<S[]>> e =
- Expression.Lambda<Func<S[]>>(
- Expression.Constant(val, typeof(S[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<S[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1786
- namespace Scenario1786{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check70__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check70__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check70();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check70() {
- foreach (Sp[] val in new Sp[][] { null, new Sp[0], new Sp[] { default(Sp), new Sp(), new Sp(5,5.0) }, new Sp[100] }) {
- if (!check70(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check70(Sp[] val) {
- Expression<Func<Sp[]>> e =
- Expression.Lambda<Func<Sp[]>>(
- Expression.Constant(val, typeof(Sp[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Sp[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1787
- namespace Scenario1787{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check71__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check71__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check71();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check71() {
- foreach (Ss[] val in new Ss[][] { null, new Ss[0], new Ss[] { default(Ss), new Ss(), new Ss(new S()) }, new Ss[100] }) {
- if (!check71(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check71(Ss[] val) {
- Expression<Func<Ss[]>> e =
- Expression.Lambda<Func<Ss[]>>(
- Expression.Constant(val, typeof(Ss[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ss[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1788
- namespace Scenario1788{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check72__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check72__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check72();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check72() {
- foreach (Sc[] val in new Sc[][] { null, new Sc[0], new Sc[] { default(Sc), new Sc(), new Sc(null) }, new Sc[100] }) {
- if (!check72(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check72(Sc[] val) {
- Expression<Func<Sc[]>> e =
- Expression.Lambda<Func<Sc[]>>(
- Expression.Constant(val, typeof(Sc[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Sc[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1789
- namespace Scenario1789{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check73__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check73__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check73();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check73() {
- foreach (Scs[] val in new Scs[][] { null, new Scs[0], new Scs[] { default(Scs), new Scs(), new Scs(null,new S()) }, new Scs[100] }) {
- if (!check73(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check73(Scs[] val) {
- Expression<Func<Scs[]>> e =
- Expression.Lambda<Func<Scs[]>>(
- Expression.Constant(val, typeof(Scs[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Scs[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1790
- namespace Scenario1790{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check74_S___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check74_S___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check74<S>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check74<Ts>() where Ts : struct {
- foreach (Ts[] val in new Ts[][] { null, new Ts[0], new Ts[] { default(Ts), new Ts() }, new Ts[100] }) {
- if (!check74<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check74<Ts>(Ts[] val) where Ts : struct {
- Expression<Func<Ts[]>> e =
- Expression.Lambda<Func<Ts[]>>(
- Expression.Constant(val, typeof(Ts[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1791
- namespace Scenario1791{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check74_Scs___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check74_Scs___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check74<Scs>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check74<Ts>() where Ts : struct {
- foreach (Ts[] val in new Ts[][] { null, new Ts[0], new Ts[] { default(Ts), new Ts() }, new Ts[100] }) {
- if (!check74<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check74<Ts>(Ts[] val) where Ts : struct {
- Expression<Func<Ts[]>> e =
- Expression.Lambda<Func<Ts[]>>(
- Expression.Constant(val, typeof(Ts[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1792
- namespace Scenario1792{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check74_E___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check74_E___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check74<E>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check74<Ts>() where Ts : struct {
- foreach (Ts[] val in new Ts[][] { null, new Ts[0], new Ts[] { default(Ts), new Ts() }, new Ts[100] }) {
- if (!check74<Ts>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check74<Ts>(Ts[] val) where Ts : struct {
- Expression<Func<Ts[]>> e =
- Expression.Lambda<Func<Ts[]>>(
- Expression.Constant(val, typeof(Ts[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<Ts[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1793
- namespace Scenario1793{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check75__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check75__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check75();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check75() {
- foreach (E[] val in new E[][] { null, new E[0], new E[] { (E) 0, E.A, E.B, (E) int.MaxValue, (E) int.MinValue }, new E[100] }) {
- if (!check75(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check75(E[] val) {
- Expression<Func<E[]>> e =
- Expression.Lambda<Func<E[]>>(
- Expression.Constant(val, typeof(E[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<E[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1794
- namespace Scenario1794{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check76__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check76__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check76();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check76() {
- foreach (El[] val in new El[][] { null, new El[0], new El[] { (El) 0, El.A, El.B, (El) long.MaxValue, (El) long.MinValue }, new El[100] }) {
- if (!check76(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check76(El[] val) {
- Expression<Func<El[]>> e =
- Expression.Lambda<Func<El[]>>(
- Expression.Constant(val, typeof(El[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<El[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1795
- namespace Scenario1795{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check77__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check77__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check77();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check77() {
- foreach (string[] val in new string[][] { null, new string[0], new string[] { null, "", "a", "foo" }, new string[100] }) {
- if (!check77(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check77(string[] val) {
- Expression<Func<string[]>> e =
- Expression.Lambda<Func<string[]>>(
- Expression.Constant(val, typeof(string[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<string[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
- }
-
- //-------- Scenario 1796
- namespace Scenario1796{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check78__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check78__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check78();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check78() {
- foreach (object[] val in new object[][] { null, new object[0], new object[] { null, new object(), new C(), new D(3) }, new object[100] }) {
- if (!check78(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check78(object[] val) {
- Expression<Func<object[]>> e =
- Expression.Lambda<Func<object[]>>(
- Expression.Constant(val, typeof(object[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<object[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1797
- namespace Scenario1797{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check79__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check79__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check79();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check79() {
- foreach (C[] val in new C[][] { null, new C[0], new C[] { null, new C(), new D(), new D(0), new D(5) }, new C[100] }) {
- if (!check79(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check79(C[] val) {
- Expression<Func<C[]>> e =
- Expression.Lambda<Func<C[]>>(
- Expression.Constant(val, typeof(C[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<C[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1798
- namespace Scenario1798{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check80__", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check80__() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check80();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check80() {
- foreach (D[] val in new D[][] { null, new D[0], new D[] { null, new D(), new D(0), new D(5) }, new D[100] }) {
- if (!check80(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check80(D[] val) {
- Expression<Func<D[]>> e =
- Expression.Lambda<Func<D[]>>(
- Expression.Constant(val, typeof(D[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<D[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1799
- namespace Scenario1799{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check81_object___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check81_object___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check81<object>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check81<T>() {
- foreach (T[] val in new T[][] { null, new T[0], new T[] { default(T) }, new T[100] }) {
- if (!check81<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check81<T>(T[] val) {
- Expression<Func<T[]>> e =
- Expression.Lambda<Func<T[]>>(
- Expression.Constant(val, typeof(T[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1800
- namespace Scenario1800{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check81_C___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check81_C___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check81<C>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check81<T>() {
- foreach (T[] val in new T[][] { null, new T[0], new T[] { default(T) }, new T[100] }) {
- if (!check81<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check81<T>(T[] val) {
- Expression<Func<T[]>> e =
- Expression.Lambda<Func<T[]>>(
- Expression.Constant(val, typeof(T[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1801
- namespace Scenario1801{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check81_S___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check81_S___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check81<S>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check81<T>() {
- foreach (T[] val in new T[][] { null, new T[0], new T[] { default(T) }, new T[100] }) {
- if (!check81<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check81<T>(T[] val) {
- Expression<Func<T[]>> e =
- Expression.Lambda<Func<T[]>>(
- Expression.Constant(val, typeof(T[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1802
- namespace Scenario1802{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check81_Scs___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check81_Scs___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check81<Scs>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check81<T>() {
- foreach (T[] val in new T[][] { null, new T[0], new T[] { default(T) }, new T[100] }) {
- if (!check81<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check81<T>(T[] val) {
- Expression<Func<T[]>> e =
- Expression.Lambda<Func<T[]>>(
- Expression.Constant(val, typeof(T[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {
- return other.S == S && other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return S.GetHashCode() ^ Val.GetHashCode();
- }
- }
-
-
- }
-
- //-------- Scenario 1803
- namespace Scenario1803{
-
- public class Test
- {
- [ETUtils.TestAttribute(ETUtils.TestState.Enabled, "check81_E___", new string[] { "positive", "cslinq", "FullTrustOnly","Pri1" })]
- public static Expression check81_E___() {
- if(Main() != 0 ) {
- throw new Exception();
- } else {
- return Expression.Constant(0);
- }
- }
- public static int Main()
- {
- Ext.StartCapture();
- bool success = false;
- try
- {
- success = check81<E>();
- }
- finally
- {
- Ext.StopCapture();
- }
- return success ? 0 : 1;
- }
-
- static bool check81<T>() {
- foreach (T[] val in new T[][] { null, new T[0], new T[] { default(T) }, new T[100] }) {
- if (!check81<T>(val)) {
- return false;
- }
- }
- return true;
- }
-
- static bool check81<T>(T[] val) {
- Expression<Func<T[]>> e =
- Expression.Lambda<Func<T[]>>(
- Expression.Constant(val, typeof(T[])),
- new System.Collections.Generic.List<ParameterExpression>());
- Func<T[]> f = e.Compile();
- return object.Equals(f(), val);
- }
- }
-
-
- public static class Ext {
- public static void StartCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StartCaptureToFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[] { "test.dll" });
- }
-
- public static void StopCapture() {
- // MethodInfo m = Assembly.GetAssembly(typeof(Expression)).GetType("System.Linq.Expressions.ExpressionCompiler").GetMethod("StopCapture", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
- // m.Invoke(null, new object[0]);
- }
-
- public static bool IsIntegralOrEnum(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.Int32:
- case TypeCode.Int64:
- case TypeCode.UInt16:
- case TypeCode.UInt32:
- case TypeCode.UInt64:
- return true;
- default:
- return false;
- }
- }
-
- public static bool IsFloating(Type type) {
- switch (Type.GetTypeCode(GetNonNullableType(type))) {
- case TypeCode.Single:
- case TypeCode.Double:
- return true;
- default:
- return false;
- }
- }
-
- public static Type GetNonNullableType(Type type) {
- return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>) ?
- type.GetGenericArguments()[0] :
- type;
- }
- }
-
-
-
-
- public interface I {
- void M();
- }
-
- public class C : IEquatable<C>, I {
- void I.M() {
- }
-
- public override bool Equals(object o) {
- return o is C && Equals((C) o);
- }
-
- public bool Equals(C c) {
- return c != null;
- }
-
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public class D : C, IEquatable<D> {
- public int Val;
- public D() {
- }
- public D(int val) {
- Val = val;
- }
-
- public override bool Equals(object o) {
- return o is D && Equals((D) o);
- }
-
- public bool Equals(D d) {
- return d != null && d.Val == Val;
- }
-
- public override int GetHashCode() {
- return Val;
- }
- }
-
- public enum E {
- A=1, B=2
- }
-
- public enum El : long {
- A, B, C
- }
-
- public struct S : IEquatable<S> {
- public override bool Equals(object o) {
- return (o is S) && Equals((S) o);
- }
- public bool Equals(S other) {
- return true;
- }
- public override int GetHashCode() {
- return 0;
- }
- }
-
- public struct Sp : IEquatable<Sp> {
- public Sp(int i, double d) {
- I = i;
- D = d;
- }
-
- public int I;
- public double D;
-
- public override bool Equals(object o) {
- return (o is Sp) && Equals((Sp) o);
- }
- public bool Equals(Sp other) {
- return other.I == I && other.D == D;
- }
- public override int GetHashCode() {
- return I.GetHashCode() ^ D.GetHashCode();
- }
- }
-
- public struct Ss : IEquatable<Ss> {
- public Ss(S s) {
- Val = s;
- }
-
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Ss) && Equals((Ss) o);
- }
- public bool Equals(Ss other) {
- return other.Val.Equals(Val);
- }
- public override int GetHashCode() {
- return Val.GetHashCode();
- }
- }
-
- public struct Sc : IEquatable<Sc> {
- public Sc(string s) {
- S = s;
- }
-
- public string S;
-
- public override bool Equals(object o) {
- return (o is Sc) && Equals((Sc) o);
- }
- public bool Equals(Sc other) {
- return other.S == S;
- }
- public override int GetHashCode() {
- return S.GetHashCode();
- }
- }
-
- public struct Scs : IEquatable<Scs> {
- public Scs(string s, S val) {
- S = s;
- Val = val;
- }
-
- public string S;
- public S Val;
-
- public override bool Equals(object o) {
- return (o is Scs) && Equals((Scs) o);
- }
- public bool Equals(Scs other) {