146 references to TypeUtils
System.Linq.Expressions (146)
System\Dynamic\BindingRestrictions.cs (1)
270return obj is TypeRestriction other && other._expression == _expression && TypeUtils.AreEquivalent(other._type, _type);
System\Dynamic\DynamicMetaObjectBinder.cs (2)
68!TypeUtils.AreReferenceAssignable(returnLabel.Type, expectedResult)) 95!TypeUtils.AreReferenceAssignable(expectedResult, body.Type))
System\Dynamic\DynamicObject.cs (1)
847if (TypeUtils.AreEquivalent(Expression.Type, typeof(DynamicObject)))
System\Dynamic\ExpandoObject.cs (1)
997if (TypeUtils.AreEquivalent(Expression.Type, LimitType))
System\Dynamic\Utils\ExpressionUtils.cs (3)
163TypeUtils.ValidateType(pType, methodParamName, allowByRef: true, allowPointer: true); 164if (!TypeUtils.AreReferenceAssignable(pType, arguments.Type)) 226if (TypeUtils.IsSameOrSubclass(quoteable, parameterType) && parameterType.IsInstanceOfType(argument))
System\Dynamic\Utils\TypeExtensions.cs (1)
56if (!TypeUtils.AreReferenceAssignable(ps[i].ParameterType, argTypes[i]))
System\Linq\Expressions\BinaryExpression.cs (24)
294!TypeUtils.AreEquivalent(method.GetParametersCached()[0].ParameterType.GetNonRefType(), Left.Type); 318Debug.Assert(method == null && TypeUtils.AreEquivalent(type, right.Type) && nodeType == ExpressionType.Coalesce); 343TypeUtils.AreEquivalent(right, left) && 346TypeUtils.AreEquivalent(method.ReturnType, left.GetNonNullableType()); 400MethodInfo? opTrueFalse = TypeUtils.GetBooleanOperator(Method!.DeclaringType!, opName); 591TypeUtils.ValidateType(left.Type, nameof(left), allowByRef: true, allowPointer: true); 592TypeUtils.ValidateType(right.Type, nameof(right), allowByRef: true, allowPointer: true); 593if (!TypeUtils.AreReferenceAssignable(left.Type, right.Type)) 668if (!TypeUtils.AreReferenceAssignable(left.Type, b.Type)) 701if (!TypeUtils.AreReferenceAssignable(left.Type, b.Type)) 725if (method == null && !TypeUtils.AreEquivalent(leftType, rightType)) 750return TypeUtils.AreReferenceAssignable(pType, argType); 832MethodInfo? opTrue = TypeUtils.GetBooleanOperator(declaringType, "op_True"); 833MethodInfo? opFalse = TypeUtils.GetBooleanOperator(declaringType, "op_False"); 858return TypeUtils.AreEquivalent(left, right) && 860TypeUtils.AreEquivalent(pms[1].ParameterType, right.GetNonNullableType()); 992if (TypeUtils.HasReferenceEquality(left.Type, right.Type)) 1044if (TypeUtils.HasReferenceEquality(left.Type, right.Type)) 1074if (TypeUtils.HasBuiltInEqualityOperator(left.Type, right.Type) || IsNullComparison(left, right)) 1288returnType = (left.Type.IsNullableType() && TypeUtils.AreEquivalent(method.ReturnType, left.Type.GetNonNullableType())) ? left.Type : method.ReturnType; 1294returnType = (left.Type.IsNullableType() && TypeUtils.AreEquivalent(method.ReturnType, left.Type.GetNonNullableType())) ? left.Type : method.ReturnType; 1409if (!TypeUtils.AreEquivalent(method.ReturnType, right.Type)) 1557if (!TypeUtils.AreEquivalent(mi.ReturnType, left.Type)) 1563if (!TypeUtils.AreEquivalent(pms[0].ParameterType, method.ReturnType))
System\Linq\Expressions\BlockExpression.cs (2)
1045if (!TypeUtils.AreReferenceAssignable(type, last.Type)) 1051if (!TypeUtils.AreEquivalent(type, last.Type))
System\Linq\Expressions\CatchBlock.cs (2)
138ContractUtils.Requires(variable == null || TypeUtils.AreEquivalent(variable.Type, type), nameof(variable)); 141TypeUtils.ValidateType(type, nameof(type));
System\Linq\Expressions\Compiler\ILGen.cs (5)
492il.Emit(OpCodes.Newobj, TypeUtils.GetNullableConstructor(type)); 554if (TypeUtils.AreEquivalent(typeFrom, typeTo)) 573TypeUtils.IsLegalExplicitVariantDelegateConversion(typeFrom, typeTo)) 807ConstructorInfo ci = TypeUtils.GetNullableConstructor(typeTo); 827ConstructorInfo ci = TypeUtils.GetNullableConstructor(typeTo);
System\Linq\Expressions\Compiler\LambdaCompiler.Address.cs (9)
70if (TypeUtils.AreEquivalent(type, node.Type)) 85if (TypeUtils.AreEquivalent(type, node.Type)) 114if (TypeUtils.AreEquivalent(type, node.Type)) 174node.Method == TypeUtils.GetArrayGetMethod(node.Object.Type)) 176MethodInfo mi = TypeUtils.GetArrayAddressMethod(node.Object.Type); 188if (!TypeUtils.AreEquivalent(type, node.Type) || node.Indexer != null) 202MethodInfo address = TypeUtils.GetArrayAddressMethod(node.Object!.Type); 219Debug.Assert(TypeUtils.AreReferenceAssignable(type, node.Type)); 237if (TypeUtils.AreEquivalent(type, node.Type))
System\Linq\Expressions\Compiler\LambdaCompiler.Binary.cs (3)
118Debug.Assert(TypeUtils.AreReferenceAssignable(p1.Type, b.Left.Type.GetNonNullableType())); 119Debug.Assert(TypeUtils.AreReferenceAssignable(p2.Type, b.Right.Type.GetNonNullableType())); 484ConstructorInfo ci = TypeUtils.GetNullableConstructor(resultType);
System\Linq\Expressions\Compiler\LambdaCompiler.ControlFlow.cs (1)
258_labelInfo.Add(label, new LabelInfo(_ilg, label, TypeUtils.AreReferenceAssignable(lambda.ReturnType, label.Type)));
System\Linq\Expressions\Compiler\LambdaCompiler.Expressions.cs (11)
133if (!TypeUtils.AreEquivalent(node.Type, type)) 136Debug.Assert(TypeUtils.AreReferenceAssignable(type, node.Type)); 317_ilg.Emit(OpCodes.Call, TypeUtils.GetArrayGetMethod(arrayType)); 345_ilg.Emit(OpCodes.Call, TypeUtils.GetArraySetMethod(arrayType)); 1114Debug.Assert(TypeUtils.AreEquivalent(resultType.GetNonNullableType(), mc.Type.GetNonNullableType())); 1162if (resultType.IsNullableType() && !TypeUtils.AreEquivalent(resultType, mc.Type)) 1164ConstructorInfo ci = TypeUtils.GetNullableConstructor(resultType); 1169if (TypeUtils.AreEquivalent(resultType, mc.Type.GetNullableType())) 1200if (TypeUtils.AreEquivalent(resultType, mc.Type.GetNullableType())) 1266if (resultType.IsNullableType() && !TypeUtils.AreEquivalent(resultType, mc.Type)) 1268ConstructorInfo ci = TypeUtils.GetNullableConstructor(resultType);
System\Linq\Expressions\Compiler\LambdaCompiler.Logical.cs (8)
148else if (TypeUtils.AreEquivalent(b.Type, b.Left.Type)) 156if (!TypeUtils.AreEquivalent(b.Type, nnLeftType)) 167if (!TypeUtils.AreEquivalent(b.Right.Type, b.Type)) 214if (!TypeUtils.AreEquivalent(b.Right.Type, b.Type)) 224if (!TypeUtils.AreEquivalent(b.Left.Type, b.Type)) 283MethodInfo? opFalse = TypeUtils.GetBooleanOperator(b.Method.DeclaringType!, "op_False"); 389MethodInfo? opTrue = TypeUtils.GetBooleanOperator(b.Method.DeclaringType!, "op_True"); 573if (TypeUtils.AreReferenceAssignable(convert.Type, convert.Operand.Type))
System\Linq\Expressions\Compiler\LambdaCompiler.Statements.cs (2)
222Debug.Assert(TypeUtils.AreReferenceAssignable(testValue.Type, test.Type)); 375!TypeUtils.AreEquivalent(type, node.Cases[0].TestValues[0].Type))
System\Linq\Expressions\Compiler\LambdaCompiler.Unary.cs (4)
97_ilg.Emit(OpCodes.Newobj, TypeUtils.GetNullableConstructor(type)); 149Debug.Assert(TypeUtils.AreEquivalent(operandType, resultType)); 167ConstructorInfo ci = TypeUtils.GetNullableConstructor(resultType); 336if (TypeUtils.AreEquivalent(node.Operand.Type, node.Type))
System\Linq\Expressions\Compiler\StackSpiller.cs (1)
151TypeUtils.AreReferenceAssignable(node.Type, result.Node.Type),
System\Linq\Expressions\ConditionalExpression.cs (3)
144if (!TypeUtils.AreEquivalent(ifTrue.Type, ifFalse.Type)) 179if (!TypeUtils.AreReferenceAssignable(type, ifTrue.Type) || 180!TypeUtils.AreReferenceAssignable(type, ifFalse.Type))
System\Linq\Expressions\ConstantExpression.cs (1)
98TypeUtils.ValidateType(type, nameof(type));
System\Linq\Expressions\DefaultExpression.cs (1)
67TypeUtils.ValidateType(type, nameof(type));
System\Linq\Expressions\DynamicExpression.cs (1)
1278TypeUtils.ValidateType(type, nameof(type), allowByRef: true, allowPointer: true);
System\Linq\Expressions\Expression.cs (1)
192if (!TypeUtils.AreReferenceAssignable(Type, newNode.Type)) throw Error.ReducedNotCompatible();
System\Linq\Expressions\ExpressionVisitor.cs (1)
690if (TypeUtils.AreEquivalent(before, after))
System\Linq\Expressions\GotoExpression.cs (2)
348TypeUtils.ValidateType(type, nameof(type)); 363if (!TypeUtils.AreReferenceAssignable(expectedType, value.Type))
System\Linq\Expressions\IndexExpression.cs (3)
331if (!TypeUtils.AreReferenceAssignable(parms[i].ParameterType, args[i].Type)) 506TypeUtils.ValidateType(pType, nameof(indexes), i); 508if (!TypeUtils.AreReferenceAssignable(pType, arg.Type))
System\Linq\Expressions\Interpreter\LightCompiler.cs (8)
597_instructions.EmitCall(TypeUtils.GetArrayGetMethod(index.Object!.Type)); 636_instructions.EmitCall(TypeUtils.GetArraySetMethod(index.Object!.Type)); 1359MethodInfo? opTrue = TypeUtils.GetBooleanOperator(expr.Method!.DeclaringType!, andAlso ? "op_False" : "op_True"); 2341call.Method == TypeUtils.GetArrayGetMethod(call.Object.Type)) 2378_instructions.EmitCall(TypeUtils.GetArrayGetMethod(array.Type)); 2380return new IndexMethodByRefUpdater(objTmp, indexLocals, TypeUtils.GetArraySetMethod(array.Type), index); 2610if (!TypeUtils.AreEquivalent(node.Type, typeToCompare)) 2631else if (node.Right.Type.IsValueType && !TypeUtils.AreEquivalent(node.Type, node.Right.Type))
System\Linq\Expressions\InvocationExpression.cs (1)
748Type? exprType = TypeUtils.FindGenericType(typeof(Expression<>), expression.Type);
System\Linq\Expressions\LabelTarget.cs (1)
81TypeUtils.ValidateType(type, nameof(type));
System\Linq\Expressions\LambdaExpression.cs (3)
924TypeUtils.ValidateType(delegateType, nameof(delegateType), allowByRef: true, allowPointer: true); 960if (!TypeUtils.AreReferenceAssignable(pex.Type, pType)) 974if (mi.ReturnType != typeof(void) && !TypeUtils.AreReferenceAssignable(mi.ReturnType, body.Type))
System\Linq\Expressions\MemberAssignment.cs (1)
96TypeUtils.ValidateType(decType, null);
System\Linq\Expressions\MemberExpression.cs (2)
139if (!TypeUtils.AreReferenceAssignable(field.DeclaringType!, expression.Type)) 282if (!TypeUtils.IsValidInstanceType(property, expression.Type))
System\Linq\Expressions\MemberMemberBinding.cs (1)
132TypeUtils.ValidateType(decType, null, allowByRef: true, allowPointer: true);
System\Linq\Expressions\MethodCallExpression.cs (4)
1263if (!TypeUtils.IsValidInstanceType(method, instanceType)) 1362if (!TypeUtils.AreReferenceAssignable(pType, argType) && 1363!(TypeUtils.IsSameOrSubclass(typeof(LambdaExpression), pType) && pType.IsAssignableFrom(arg.GetType()))) 1437MethodInfo mi = TypeUtils.GetArrayGetMethod(array.Type);
System\Linq\Expressions\NewArrayExpression.cs (3)
144TypeUtils.ValidateType(type, nameof(type)); 153if (!TypeUtils.AreReferenceAssignable(type, expr.Type)) 221TypeUtils.ValidateType(type, nameof(type));
System\Linq\Expressions\NewExpression.cs (6)
146TypeUtils.ValidateType(constructor.DeclaringType!, nameof(constructor), allowByRef: true, allowPointer: true); 171TypeUtils.ValidateType(constructor.DeclaringType!, nameof(constructor), allowByRef: true, allowPointer: true); 205TypeUtils.ValidateType(type, nameof(type)); 241if (!TypeUtils.AreEquivalent(member.DeclaringType, constructor.DeclaringType)) 247if (!TypeUtils.AreReferenceAssignable(memberType, arg.Type)) 260if (!TypeUtils.AreReferenceAssignable(pType, arg.Type))
System\Linq\Expressions\ParameterExpression.cs (1)
203TypeUtils.ValidateType(type, nameof(type), allowByRef, allowPointer: false);
System\Linq\Expressions\SwitchExpression.cs (4)
75!TypeUtils.AreEquivalent(SwitchValue.Type, Comparison.GetParametersCached()[0].ParameterType.GetNonRefType()); 261if (!TypeUtils.AreEquivalent(firstTestValue.Type, c.TestValues[i].Type)) 300if (!TypeUtils.AreReferenceAssignable(resultType, @case.Type)) 308if (!TypeUtils.AreEquivalent(resultType, @case.Type))
System\Linq\Expressions\TryExpression.cs (3)
190if (!TypeUtils.AreReferenceAssignable(type, tryBody.Type)) 196if (!TypeUtils.AreReferenceAssignable(type, cb.Body.Type)) 222if (!TypeUtils.AreEquivalent(cb.Body.Type, type))
System\Linq\Expressions\TypeBinaryExpression.cs (1)
77Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(object), Expression.Type), "Expecting reference types only after this point.");
System\Linq\Expressions\UnaryExpression.cs (12)
66return (operandIsNullable && !TypeUtils.AreEquivalent(Method.GetParametersCached()[0].ParameterType, Operand.Type)) || 67(resultIsNullable && !TypeUtils.AreEquivalent(Method.ReturnType, this.Type)); 415MethodInfo? method = TypeUtils.GetUserDefinedCoercionMethod(expression.Type, convertToType); 435if (ParameterIsAssignable(pms[0], operand.Type) && TypeUtils.AreEquivalent(method.ReturnType, convertToType)) 442(TypeUtils.AreEquivalent(method.ReturnType, convertToType.GetNonNullableType()) || 443TypeUtils.AreEquivalent(method.ReturnType, convertToType))) 694TypeUtils.ValidateType(type, nameof(type)); 718TypeUtils.ValidateType(type, nameof(type)); 749TypeUtils.ValidateType(type, nameof(type)); 789TypeUtils.ValidateType(type, nameof(type)); 883TypeUtils.ValidateType(type, nameof(type)); 1073if (!TypeUtils.AreReferenceAssignable(expression.Type, result.Type))
System\Runtime\CompilerServices\CallSite.cs (1)
686if (TypeUtils.AreReferenceAssignable(type, arg.Type))