811 references to Type
Microsoft.CodeAnalysis.CSharp (811)
Binder\Binder.NamespaceOrTypeOrAliasSymbolWithAnnotations.cs (1)
37internal Symbol Symbol => _symbol ?? TypeWithAnnotations.Type;
Binder\Binder.ValueChecks.cs (3)
4529Debug.Assert(elementType.Type is { }); 4530return !LocalRewriter.ShouldUseRuntimeHelpersCreateSpan(expr, elementType.Type); 4550if (LocalRewriter.ShouldUseRuntimeHelpersCreateSpan(expr, ((NamedTypeSymbol)parameter.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type))
Binder\Binder_Attributes.cs (3)
55var boundTypeSymbol = (NamedTypeSymbol)boundType.Type; 403if (!paramType.Type.IsValidAttributeParameterType(Compilation)) 405Error(diagnostics, ErrorCode.ERR_BadAttributeParamType, syntax, parameter.Name, paramType.Type);
Binder\Binder_Constraints.cs (9)
455diagnostics.Add(ErrorCode.ERR_BadVisBound, location, containingSymbol, constraintType.Type); 458if (constraintType.Type.HasFileLocalTypes()) 471diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, location, constraintType.Type, containingSymbol); 499Error(diagnostics, ErrorCode.ERR_DuplicateBound, syntax, type.Type.SetUnknownNullabilityForReferenceTypes(), typeParameter.Name); 513Error(diagnostics, ErrorCode.ERR_ClassBoundNotFirst, syntax, type.Type); 528Error(diagnostics, ErrorCode.ERR_RefValBoundWithClass, syntax, type.Type); 537Error(diagnostics, ErrorCode.ERR_RefValBoundWithClass, syntax, type.Type); 543Error(diagnostics, ErrorCode.ERR_UnmanagedBoundWithClass, syntax, type.Type); 561TypeSymbol type = typeWithAnnotations.Type;
Binder\Binder_Conversions.cs (14)
384new BoundValuePlaceholder(source.Syntax, sourceTypes[i].Type), 389destTypes[i].Type, 613var sourceElementType = ((NamedTypeSymbol)source).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 614var destinationElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 644typeArgument.Type.IsReferenceType && 646((NamedTypeSymbol)parameter.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type.Equals(typeArgument.Type, TypeCompareKind.ConsiderEverything) && 648((NamedTypeSymbol)method.ReturnType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type.Equals(((NamedTypeSymbol)arg.destination).TypeParameters[0], TypeCompareKind.ConsiderEverything)); 1048collectionBuilderMethod = GetCollectionBuilderMethod(namedType, elementTypeOriginalDefinition.Type, builderType, methodName, ref useSiteInfo, out collectionBuilderReturnTypeConversion); 1064elementType = parameterType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 1752Debug.Assert(elementTypeWithAnnotations.Type is null); // GetCollectionExpressionTypeKind() does not set elementType for these cases. 1773var elementType = elementTypeWithAnnotations.Type; 1894var spanTypeArg = ((NamedTypeSymbol)methodWithTargetTypeParameters.Parameters[0].Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 2489convertedArguments.Add(CreateConversion(argument.Syntax, argument, elementConversion, isCast: isCast, elementConversionGroup, destType.Type, diagnostics));
Binder\Binder_Crefs.cs (3)
590if (ContainsNestedTypeOfUnconstructedGenericType(typeArgument.Type)) 905(!unusedDiagnostics.HasAnyErrors() && typeArgument.Type is CrefTypeParameterSymbol)); 974TypeSymbol type = parameterOrReturnTypeBinder.BindType(typeSyntax, localDiagnostics).Type;
Binder\Binder_Deconstruct.cs (7)
855var type = declTypeWithAnnotations.Type; 893CheckRestrictedTypeInAsyncMethod(this.ContainingMemberOrLambda, declTypeWithAnnotations.Type, diagnostics, typeSyntax); 897localSymbol.Scope == ScopedKind.ScopedValue && !declTypeWithAnnotations.Type.IsErrorOrRefLikeOrAllowsRefLikeType()) 910return new BoundLocal(syntax, localSymbol, BoundLocalDeclarationKind.WithExplicitType, constantValueOpt: null, isNullableUnknown: false, type: declTypeWithAnnotations.Type, hasErrors: hasErrors); 948Debug.Assert(TypeSymbol.Equals(declTypeWithAnnotations.Type, fieldType.Type, TypeCompareKind.ConsiderEverything2)); 955type: fieldType.Type);
Binder\Binder_Expressions.cs (35)
452field.GetFieldType(initializerBinder.FieldsBeingBound).Type, diagnostics); 1234return new BoundRefValueOperator(node, typeWithAnnotations.NullableAnnotation, argument, typeWithAnnotations.Type, hasErrors); 1374TypeSymbol type = typeWithAnnotations.Type; 1402var type = typeWithAnnotations.Type; 1427TypeSymbol type = typeWithAnnotations.Type; 1534TypeSymbol type = typeWithAnnotations.Type; 2538TypeSymbol targetType = targetTypeWithAnnotations.Type; 2700TypeSymbol targetType = targetTypeWithAnnotations.Type; 2858var targetElementType = targetElementTypesWithAnnotations[i].Type; 2885TypeWithAnnotations underlyingTargetTypeWithAnnotations = targetTypeWithAnnotations.Type.GetNullableUnderlyingTypeWithAnnotations(); 2886var underlyingConversion = Conversions.ClassifyBuiltInConversion(operand.Type, underlyingTargetTypeWithAnnotations.Type, isChecked: CheckOverflowAtRuntime, ref discardedUseSiteInfo); 3130var type = declType.Type; 3184CheckRestrictedTypeInAsyncMethod(this.ContainingMemberOrLambda, declType.Type, diagnostics, typeSyntax); 3186if (localSymbol.Scope == ScopedKind.ScopedValue && !declType.Type.IsErrorOrRefLikeOrAllowsRefLikeType()) 3191return new BoundLocal(declarationExpression, localSymbol, BoundLocalDeclarationKind.WithExplicitType, constantValueOpt: null, isNullableUnknown: false, type: declType.Type); 3228TypeSymbol fieldType = expressionVariableField.GetFieldType(this.FieldsBeingBound).Type; 3517coercedArgument = bindInterpolatedStringHandlerInMemberCall(argument, parameterTypeWithAnnotations.Type, argumentsForInterpolationConversion, parameters, in result, arg, receiver, diagnostics); 3524coercedArgument = CreateConversion(argument.Syntax, argument, kind, isCast: false, conversionGroupOpt: null, parameterTypeWithAnnotations.Type, diagnostics); 3545coercedArgument = CreateConversion(argument.Syntax, argument, kind, isCast: false, conversionGroupOpt: null, parameterTypeWithAnnotations.Type, diagnostics); 3599Debug.Assert(methodResult.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel); 3666if (!methodResult.Member.IsIndexer() && !argument.HasAnyErrors && parameterTypeWithAnnotations.Type.ContainsPointer()) 3975var type = (ArrayTypeSymbol)BindArrayType(node.Type, diagnostics, permitDimensions: true, basesBeingResolved: null, disallowRestrictedTypes: true).Type; 4458var arrayType = (ArrayTypeSymbol)BindArrayType(arrayTypeSyntax, diagnostics, permitDimensions: true, basesBeingResolved: null, disallowRestrictedTypes: false).Type; 4462if (!elementType.Type.IsErrorType()) 4464hasErrors = hasErrors || CheckManagedAddr(Compilation, elementType.Type, elementTypeSyntax.Location, diagnostics, errorForManaged: true); 4515? new BoundStackAllocArrayCreation(node, elementType.Type, count, initializerOpt: null, type, hasErrors: hasErrors) 4516: BindStackAllocWithInitializer(node, node.StackAllocKeyword, node.Initializer, type, elementType.Type, count, diagnostics, hasErrors); 5140var type = typeWithAnnotations.Type; 7559if (typeArgument.Type.IsPointerOrFunctionPointer() || typeArgument.Type.IsRestrictedType()) 7562Error(diagnostics, ErrorCode.ERR_BadTypeArgument, typeArgumentsSyntax[i], typeArgument.Type); 8172resultType = ((FieldSymbol)symbolOpt).GetFieldType(this.FieldsBeingBound).Type; 8614TypeSymbol fieldType = fieldSymbol.GetFieldType(this.FieldsBeingBound).Type; 10814Debug.Assert(returnType.Type is { }); // Expecting System.Void rather than null return type. 10817bool returnsVoid = returnType.Type.IsVoidType();
Binder\Binder_Invocation.cs (1)
2190TypeSymbol returnType = members[i].GetTypeOrReturnType().Type;
Binder\Binder_Lambda.cs (1)
292var type = returnType.Type;
Binder\Binder_Lookup.cs (1)
1737type = ((FieldSymbol)symbol).GetFieldType(this.FieldsBeingBound).Type;
Binder\Binder_Operators.cs (3)
883namedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type.SpecialType is SpecialType.System_Byte; 3341TypeSymbol targetType = targetTypeWithAnnotations.Type; 3693TypeSymbol targetType = targetTypeWithAnnotations.Type;
Binder\Binder_Patterns.cs (6)
861hasErrors |= CheckValidPatternType(typeSyntax, inputType, declType.Type, diagnostics: diagnostics); 896CheckRestrictedTypeInAsyncMethod(this.ContainingMemberOrLambda, declType.Type, diagnostics, typeSyntax ?? (SyntaxNode)designation); 900syntax: designation, localSymbol: localSymbol, localSymbol.IsVar ? BoundLocalDeclarationKind.WithInferredType : BoundLocalDeclarationKind.WithExplicitType, constantValueOpt: null, isNullableUnknown: false, type: declType.Type); 974TypeSymbol declType = declTypeWithAnnotations.Type; 1172TypeSymbol elementType = isError ? CreateErrorType() : elementTypesWithAnnotations[i].Type; 1445TypeSymbol elementType = isError ? CreateErrorType() : elementTypes[i].Type;
Binder\Binder_Statements.cs (16)
237TypeSymbol elementType = GetIteratorElementType().Type; 847Error(diagnostics, ErrorCode.ERR_VarDeclIsStaticClass, typeSyntax, declType.Type); 850if (isConst && !declType.Type.CanBeConst()) 852Error(diagnostics, ErrorCode.ERR_BadConstType, typeSyntax, declType.Type); 1027Error(localDiagnostics, ErrorCode.ERR_ImplicitlyTypedVariableAssignedBadValue, declarator, declTypeOpt.Type); 1032if (!declTypeOpt.Type.IsErrorType()) 1056initializerOpt = BindPossibleArrayInitializer(value, declTypeOpt.Type, valueKind, diagnostics); 1061declTypeOpt.Type, 1083if (!declTypeOpt.Type.IsPointerType()) 1087Error(localDiagnostics, declTypeOpt.Type.IsFunctionPointer() ? ErrorCode.ERR_CannotUseFunctionPointerAsFixedLocal : ErrorCode.ERR_BadFixedInitType, declarator); 1091else if (!IsValidFixedVariableInitializer(declTypeOpt.Type, ref initializerOpt, localDiagnostics)) 1097CheckRestrictedTypeInAsyncMethod(this.ContainingMemberOrLambda, declTypeOpt.Type, localDiagnostics, typeSyntax); 1099if (localSymbol.Scope == ScopedKind.ScopedValue && !declTypeOpt.Type.IsErrorOrRefLikeOrAllowsRefLikeType()) 2063conversionError(diagnostics, ErrorCode.ERR_ExpressionTreeMustHaveDelegate, ((NamedTypeSymbol)targetType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type); 2522var targetElementType = targetElementTypes[i].Type; 3249type = this.BindType(declaration.Type, diagnostics).Type;
Binder\Binder_Symbols.cs (7)
530else if (LazyMissingNonNullTypesContextDiagnosticInfo.IsNullableReference(typeArgument.Type)) 554ReportUseSite(constructedType.Type.OriginalDefinition, diagnostics, syntax); 555var type = (NamedTypeSymbol)constructedType.Type; 598CheckManagedAddr(Compilation, elementType.Type, node.Location, diagnostics); 613if (type.Type.IsTypeParameterDisallowingAnnotationInCSharp8()) 638Error(diagnostics, ErrorCode.ERR_ArrayOfStaticClass, node.ElementType, type.Type); 649Error(diagnostics, ErrorCode.ERR_ArrayElementCantBeRefAny, node.ElementType, type.Type);
Binder\ForEachEnumeratorInfo.cs (2)
25public TypeSymbol ElementType => ElementTypeWithAnnotations.Type; 102public TypeSymbol ElementType => ElementTypeWithAnnotations.Type;
Binder\ForEachLoopBinder.cs (13)
200var valuePlaceholder = new BoundDeconstructValuePlaceholder(_syntax.Expression, variableSymbol: null, isDiscardExpression: false, inferredType.Type ?? CreateErrorType("var")); 316CheckRestrictedTypeInAsyncMethod(this.ContainingMemberOrLambda, declType.Type, diagnostics, typeSyntax); 318if (local.Scope == ScopedKind.ScopedValue && !declType.Type.IsErrorOrRefLikeOrAllowsRefLikeType()) 375var valuePlaceholder = new BoundDeconstructValuePlaceholder(_syntax.Expression, variableSymbol: null, isDiscardExpression: false, iterationVariableType.Type).MakeCompilerGenerated(); 431hasErrors = hasErrors || boundIterationVariableType.HasErrors || iterationVariableType.Type.IsErrorType(); 469Conversion elementConversionClassification = this.Conversions.ClassifyConversionFromType(inferredType.Type, iterationVariableType.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo, forCast: true); 473Error(diagnostics, ErrorCode.ERR_RefAssignmentMustHaveIdentityConversion, collectionExpr.Syntax, iterationVariableType.Type); 477var elementPlaceholder = new BoundValuePlaceholder(_syntax, inferredType.Type).MakeCompilerGenerated(); 485diagnostics.Add(ErrorCode.ERR_AmbigUDConv, foreachKeyword.GetLocation(), originalUserDefinedConversions[0], originalUserDefinedConversions[1], inferredType.Type, iterationVariableType); 489SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, inferredType.Type, iterationVariableType.Type); 501BoundExpression elementConversion = CreateConversion(_syntax, elementPlaceholder, elementConversionClassification, isCast: false, conversionGroupOpt: null, iterationVariableType.Type, createConversionDiagnostics);
Binder\Semantics\AccessCheck.cs (3)
164return IsSymbolAccessibleCore(((DiscardSymbol)symbol).TypeWithAnnotations.Type, within, null, out failedThroughTypeCheck, compilation, ref useSiteInfo, basesBeingResolved); 239if (typeArg.Type.Kind != SymbolKind.TypeParameter && !IsSymbolAccessibleCore(typeArg.Type, within, null, out unused, compilation, ref useSiteInfo, basesBeingResolved))
Binder\Semantics\Conversions\Conversions.cs (2)
164var elementType = elementTypeWithAnnotations.Type; 174elementType = elementTypeWithAnnotations.Type;
Binder\Semantics\Conversions\ConversionsBase.cs (36)
1488!invokeMethod.ReturnType.Equals(returnType.Type, TypeCompareKind.AllIgnoreOptions)) 1605var delegateType = type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 1882var type = typeWithAnnotations.Type; 1896ClassifyImplicitConversionFromType(source.Type, destination.Type, ref discardedUseSiteInfo).Kind != ConversionKind.NoConversion; 1962conversions.ClassifyImplicitExtensionMethodThisArgConversion(s, s.Type, d.Type, ref u, isMethodGroupConversion: false), 1984return conversions.ClassifyImplicitExtensionMethodThisArgConversion(sourceExpressionOpt: null, s.Type, d.Type, ref u, isMethodGroupConversion: false); 2297=> conversions.ClassifyImplicitConversionFromExpression(s, d.Type, ref u), 2315conversions.ClassifyConversionFromExpression(s, d.Type, isChecked: isChecked, ref u, forCast: forCast), 2373return conversions.ClassifyImplicitConversionFromType(s.Type, d.Type, ref u); 2392return conversions.ClassifyConversionFromType(s.Type, d.Type, isChecked: isChecked, ref u, forCast); 2600return HasIdentityOrImplicitReferenceConversion(elementType.Type, argument0.Type, ref useSiteInfo); 2614HasIdentityConversionInternal(source.Type, destination.Type, includeNullability: true)) 2619return HasImplicitReferenceConversion(source.Type, destination.Type, ref useSiteInfo); 3421&& (HasIdentityOrImplicitReferenceConversion(sourceType.Type, destinationType.Type, ref useSiteInfo) 3422|| HasImplicitPointerToVoidConversion(sourceType.Type, destinationType.Type) 3423|| HasImplicitPointerConversion(sourceType.Type, destinationType.Type, ref useSiteInfo)); 3427&& HasIdentityConversion(sourceType.Type, destinationType.Type); 3688var sourceArg = sourceTypeArguments[i].Type; 3689var destinationArg = destinationTypeArguments[i].Type; 3771if (HasExplicitReferenceConversion(sourceArray.ElementType, ((NamedTypeSymbol)destination).TypeArgumentWithDefinitionUseSiteDiagnostics(0, ref useSiteInfo).Type, ref useSiteInfo)) 3791var sourceElement = ((NamedTypeSymbol)source).TypeArgumentWithDefinitionUseSiteDiagnostics(0, ref useSiteInfo).Type; 4008return HasIdentityConversionInternal(source.Type, destination.Type) && 4030return HasIdentityOrReferenceConversion(elementType.Type, spanElementType.Type, ref useSiteInfo) &&
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (72)
452if (!fixedResultType.Type.IsErrorType()) 461var errorTypeName = fixedResultType.Type.Name; 490TypeParameterSymbol typeParameter = (TypeParameterSymbol)type.Type; 513var methodTypeParameter = (TypeParameterSymbol)methodTypeParameterWithAnnotations.Type; 547return typeMap.SubstituteType(delegateOrFunctionPointerType).Type; 587ExactOrBoundsKind kind = GetRefKind(arg).IsManagedReference() || target.Type.IsPointerType() ? ExactOrBoundsKind.Exact : ExactOrBoundsKind.LowerBound; 609if (argument.Kind == BoundKind.UnboundLambda && target.Type.GetDelegateType() is { }) 623if (IsReallyAType(argumentType.Type)) 629var ordinal = ((TypeParameterSymbol)target.Type).Ordinal; 642TypeSymbol targetType = target.Type; 677Debug.Assert(target.Type is { }); 678if (target.Type is null) 699if (target.Type.Kind != SymbolKind.NamedType) 705var destination = (NamedTypeSymbol)target.Type; 861if (HasUnfixedParamInOutputType(argument, formalType.Type) && !HasUnfixedParamInInputType(argument, formalType.Type)) 879if (!binder.TryGetCollectionIterationType((ExpressionSyntax)argument.Syntax, formalType.Type, out TypeWithAnnotations targetElementType)) 895if (formalType.Type.Kind != SymbolKind.NamedType) 901var destination = (NamedTypeSymbol)formalType.Type; 1118var formalParameterType = _formalParameterTypes[iArg].Type; 1360if (MethodGroupReturnTypeInference(binder, expression, target.Type, ref useSiteInfo)) 1382var delegateType = target.Type.GetDelegateType(); 1404Debug.Assert(inferredReturnType.Type is not FunctionTypeSymbol); 1541var delegateType = target.Type.GetDelegateType(); 1594var delegateInvokeMethod = target.Type.GetDelegateType()?.DelegateInvokeMethod(); 1639if (ExactSpanInference(source.Type, target.Type, ref useSiteInfo)) 1684if (!source.Type.IsArray() || !target.Type.IsArray()) 1689var arraySource = (ArrayTypeSymbol)source.Type; 1690var arrayTarget = (ArrayTypeSymbol)target.Type; 1779ExactOrBoundsInference(kind, ((NamedTypeSymbol)source.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0], ((NamedTypeSymbol)target.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0], ref useSiteInfo); 1813if (!source.Type.TryGetElementTypesWithAnnotationsIfTupleType(out sourceTypes) || 1814!target.Type.TryGetElementTypesWithAnnotationsIfTupleType(out targetTypes) || 1837var namedSource = source.Type as NamedTypeSymbol; 1843var namedTarget = target.Type as NamedTypeSymbol; 1862ExactInference(((PointerTypeSymbol)source.Type).PointedAtTypeWithAnnotations, ((PointerTypeSymbol)target.Type).PointedAtTypeWithAnnotations, ref useSiteInfo); 1865else if (source.Type is FunctionPointerTypeSymbol { Signature: { ParameterCount: int sourceParameterCount } sourceSignature } && 1866target.Type is FunctionPointerTypeSymbol { Signature: { ParameterCount: int targetParameterCount } targetSignature } && 1976if (LowerBoundArrayInference(source.Type, target.Type, ref useSiteInfo)) 1983if (LowerBoundSpanInference(source.Type, target.Type, ref useSiteInfo)) 2020if (LowerBoundConstructedInference(source.Type, target.Type, ref useSiteInfo)) 2025if (LowerBoundFunctionPointerTypeInference(source.Type, target.Type, ref useSiteInfo)) 2109if (elementSource.Type.IsReferenceType) 2144if (!sourceElementType.Type.IsReferenceType || target.IsSpan()) 2484Debug.Assert(source.Type.IsReferenceType || source.Type.IsFunctionPointer()); 2501if (UpperBoundFunctionPointerTypeInference(source.Type, target.Type, ref useSiteInfo)) 2536if (!target.Type.IsArray()) 2540var arrayTarget = (ArrayTypeSymbol)target.Type; 2542var elementSource = GetMatchingElementType(arrayTarget, source.Type, ref useSiteInfo); 2548if (elementSource.Type.IsReferenceType) 2569var source = sourceWithAnnotations.Type; 2570var target = targetWithAnnotations.Type; 2821Debug.Assert(best.Type.Type.Equals(withoutNullability.Type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 2985functionType = type.Type as FunctionTypeSymbol; 2992return constraintTypes.Any(static t => isExpressionType(t.Type)); 3011var source = sourceWithAnnotations.Type; 3012var destination = destinationWithAnnotations.Type; 3251if (!dest.Type.ContainsTypeParameter(pParam)) 3395var newBound = TypeWithAnnotations.Create(oldBound.Type, newAnnotation); 3421if (newCandidate.Type.IsDynamic()) 3452return obj.Type.GetHashCode(); 3459if (x.Type.IsDynamic() ^ y.Type.IsDynamic()) { return false; }
Binder\Semantics\OverloadResolution\OverloadResolution.cs (18)
1253expandedResult.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel) 1336if (elementType.Type is null) 1357Debug.Assert(elementType.Type is { }); 2560Debug.Assert(paramsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel); 2561return paramsElementTypeOpt.Type; 3182t1, kind1, elementType1.Type, underlyingElementConversions1: [], 3183t2, kind2, elementType2.Type, underlyingElementConversions2: [], 3197elementType = typeArg.Type; 3240if (x.HasType && Conversions.HasIdentityConversion(x.Type, y)) 3250y = ((NamedTypeSymbol)y).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 3343if (!ExpressionMatchExactly(sourceArguments[i], destTypes[i].Type, ref useSiteInfo)) 3469return BetterConversionTargetCore(((NamedTypeSymbol)type1).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type, 3470((NamedTypeSymbol)type2).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type, 3975TryInferParamsCollectionIterationType(binder, type.Type, out paramsIterationType); 4244if (!parameterTypes[i].Type.CheckAllConstraints(Compilation, Conversions)) 4445&& parameters.ParameterTypes[argumentPosition].Type is NamedTypeSymbol { IsInterpolatedStringHandlerType: true, IsValueType: true }) 4458parameters.ParameterTypes[argumentPosition].Type, 4470(ignoreOpenTypes && parameters.ParameterTypes[argumentPosition].Type.ContainsTypeParameter(parameterContainer: (MethodSymbol)candidate))));
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (2)
1382Debug.Assert(badArg.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel); 1383return badArg.Result.ParamsElementTypeOpt.Type;
BoundTree\BoundDiscardExpression.cs (1)
16return this.Update(type.NullableAnnotation, isInferred: true, type.Type);
BoundTree\Constructors.cs (2)
544: this(syntax, aliasOpt, boundContainingTypeOpt, boundDimensionsOpt, typeWithAnnotations, typeWithAnnotations.Type, hasErrors) 546Debug.Assert((object)typeWithAnnotations.Type != null, "Field 'type' cannot be null");
BoundTree\OutDeconstructVarPendingInference.cs (1)
18Placeholder = new BoundDeconstructValuePlaceholder(this.Syntax, variableSymbol: VariableSymbol, isDiscardExpression: IsDiscardExpression, type.Type, hasErrors: this.HasErrors || !success);
BoundTree\UnboundLambda.cs (9)
228Debug.Assert(bestType.Type is not FunctionTypeSymbol); 409bool hasErrors = !types.IsDefault && types.Any(static t => t.Type?.Kind == SymbolKind.ErrorType); 479public TypeSymbol ParameterType(int index) { return ParameterTypeWithAnnotations(index).Type; } 619yield return type.Type; 628yield return type.Type; 829if (compilation.ShouldEmitNativeIntegerAttributes(returnType.Type)) 922if (targetParameterTypes[i].Type.ContainsPointer()) 1073value = Hash.Combine(type.Type, value); 1209if (!returnType.HasType || returnType.Type.ContainsTypeParameter())
BoundTree\VariablePendingInference.cs (4)
65Binder.CheckRestrictedTypeInAsyncMethod(localSymbol.ContainingSymbol, type.Type, diagnosticsOpt, typeOrDesignationSyntax); 67if (localSymbol.Scope == ScopedKind.ScopedValue && !type.Type.IsErrorOrRefLikeOrAllowsRefLikeType()) 76return new BoundLocal(this.Syntax, localSymbol, BoundLocalDeclarationKind.WithInferredType, constantValueOpt: null, isNullableUnknown: false, type: type.Type, hasErrors: this.HasErrors || inferenceFailed).WithWasConverted(); 106type: type.Type,
CodeGen\EmitStackAllocInitializer.cs (1)
29: ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]).Type;
CodeGen\EmitStatement.cs (1)
1790Debug.Assert(local.TypeWithAnnotations.Type.IsPointerType());
Compilation\BuiltInOperators.cs (1)
693Debug.Assert(((NamedTypeSymbol)readonlySpanOfByte).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type.SpecialType is SpecialType.System_Byte);
Compilation\CSharpCompilation.cs (1)
2247var array = (ArrayTypeSymbol)firstType.Type;
Compilation\CSharpSemanticModel.cs (3)
298crefSymbols = ImmutableArray.Create<Symbol>(binder.BindType(expression, BindingDiagnosticBag.Discarded).Type); 413NamedTypeSymbol attributeType = (NamedTypeSymbol)binder.BindType(attribute.Name, BindingDiagnosticBag.Discarded, out aliasOpt).Type; 2772var attributeType = (NamedTypeSymbol)binder.BindType(attribute.Name, BindingDiagnosticBag.Discarded, out aliasOpt).Type;
Compilation\PublicSemanticModel.cs (1)
20var attributeType = (NamedTypeSymbol)enclosingBinder.BindType(attribute.Name, BindingDiagnosticBag.Discarded, out aliasOpt).Type;
Compiler\ClsComplianceChecker.cs (6)
286paramType.Type.GetAttributeParameterTypedConstantKind(_compilation) == TypedConstantKind.Error) 561if (!IsCompliantType(constraintType.Type, context)) 566this.AddDiagnostic(ErrorCode.WRN_CLS_BadTypeVar, typeParameter.GetFirstLocation(), constraintType.Type); 1046if (!IsCompliantType(typeArg.Type, context)) 1369TypeSymbol xType = xParameterTypes[i].Type; 1370TypeSymbol yType = yParameterTypes[i].Type;
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (1)
208Visit(typeArgument.Type, builder);
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (3)
526var otherType = type.WithTypeAndModifiers((TypeSymbol?)this.Visit(type.Type), this.VisitCustomModifiers(type.CustomModifiers)); 744return AreTypesEqual(type.Type, other.Type);
Emitter\Model\ArrayTypeSymbolAdapter.cs (1)
27var type = moduleBeingBuilt.Translate(elementType.Type, syntaxNodeOpt: (CSharpSyntaxNode?)context.SyntaxNode, diagnostics: context.Diagnostics);
Emitter\Model\FieldSymbolAdapter.cs (1)
38var implType = isFixed ? AdaptedFieldSymbol.FixedImplementationType(moduleBeingBuilt) : fieldTypeWithAnnotations.Type;
Emitter\Model\GenericMethodInstanceReference.cs (1)
37yield return moduleBeingBuilt.Translate(arg.Type, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode, diagnostics: context.Diagnostics);
Emitter\Model\GenericTypeInstanceReference.cs (1)
44builder.Add(moduleBeingBuilt.Translate(type.Type, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode, diagnostics: context.Diagnostics));
Emitter\Model\MethodSymbolAdapter.cs (1)
256yield return moduleBeingBuilt.Translate(arg.Type,
Emitter\Model\NamedTypeSymbolAdapter.cs (1)
875var arg = moduleBeingBuilt.Translate(arguments[i].Type, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode, diagnostics: context.Diagnostics);
Emitter\Model\SpecializedFieldReference.cs (1)
65var type = ((PEModuleBuilder)context.Module).Translate(oldType.Type, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode, diagnostics: context.Diagnostics);
Emitter\Model\SpecializedGenericMethodInstanceReference.cs (1)
38yield return moduleBeingBuilt.Translate(arg.Type, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode, diagnostics: context.Diagnostics);
Emitter\Model\SpecializedGenericNestedTypeInstanceReference.cs (1)
43builder.Add(moduleBeingBuilt.Translate(type.Type, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode, diagnostics: context.Diagnostics));
Emitter\Model\TypeParameterSymbolAdapter.cs (1)
268var typeRef = moduleBeingBuilt.Translate(type.Type,
Errors\LazyArrayElementCantBeRefAnyDiagnosticInfo.cs (1)
36return new CSDiagnosticInfo(ErrorCode.ERR_ArrayElementCantBeRefAny, _possiblyRestrictedTypeSymbol.Type);
Errors\LazyMissingNonNullTypesContextDiagnosticInfo.cs (1)
86protected override DiagnosticInfo ResolveInfo() => IsNullableReference(_type.Type) ? _info : null;
Errors\LazyObsoleteDiagnosticInfo.cs (1)
42var symbol = (_symbolOrSymbolWithAnnotations as Symbol) ?? ((TypeWithAnnotations)_symbolOrSymbolWithAnnotations).Type;
Errors\LazyUseSiteDiagnosticsInfoForNullableType.cs (1)
35return _possiblyNullableTypeSymbol.Type.OriginalDefinition.GetUseSiteInfo().DiagnosticInfo;
FlowAnalysis\DefiniteAssignment.cs (4)
1222else if (!_alreadyReported[slot] && !symbol.GetTypeOrReturnType().Type.IsErrorType()) 1692TypeSymbol structType = variable.Symbol.GetTypeOrReturnType().Type; 1728TypeSymbol type = id.Symbol.GetTypeOrReturnType().Type; 1764TypeSymbol type = id.Symbol.GetTypeOrReturnType().Type;
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (1)
105var type = id.Symbol.GetTypeOrReturnType().Type;
FlowAnalysis\LocalDataFlowPass.cs (1)
126var variableType = symbol.GetTypeOrReturnType().Type;
FlowAnalysis\NullableWalker.cs (91)
130Debug.Assert(TypeSymbol.Equals(RValueType.Type, LValueType.Type, TypeCompareKind.ConsiderEverything)); 751if (symbolType.Type.IsValueType || symbolType.Type.IsErrorType()) 783var badState = symbolType.Type.IsPossiblyNullableReferenceTypeTypeParameter() && (annotations & FlowAnalysisAnnotations.NotNull) == 0 841SetState(ref this.State, memberSlot, type.Type.IsPossiblyNullableReferenceTypeTypeParameter() ? NullableFlowState.MaybeDefault : NullableFlowState.MaybeNull); 2265type.Type.IsValueType) 2282if (type.Type.IsTypeParameterDisallowingAnnotationInCSharp8() && !(type.Type is TypeParameterSymbol { IsNotNullable: true })) 2308!targetType.Type.Equals(valueType.Type, TypeCompareKind.AllIgnoreOptions)) 2541InheritDefaultState(targetType.Type, targetSlot); 2547if (targetType.Type.IsReferenceType || 2556else if (EmptyStructTypeCache.IsTrackableStructType(targetType.Type)) 2558InheritNullableStateOfTrackableStruct(targetType.Type, targetSlot, valueSlot, isDefaultValue: !(valueOpt is null) && IsDefaultValue(valueOpt), skipSlot: targetSlot); 2564target.Type.Equals(assignedValue.Type, TypeCompareKind.AllIgnoreOptions); 2632if (fieldOrPropertyType.Type.IsReferenceType || 2661else if (EmptyStructTypeCache.IsTrackableStructType(fieldOrPropertyType.Type)) 2671InheritNullableStateOfTrackableStruct(fieldOrPropertyType.Type, targetMemberSlot, valueMemberSlot, isDefaultValue: isDefaultValue, skipSlot); 2678return _variables[slot].Symbol.GetTypeOrReturnType().Type; 2713var actualType = _variables[targetSlot].Symbol.GetTypeOrReturnType().Type; 2733InheritDefaultState(symbol.GetTypeOrReturnType().Type, slot); 2831if (EmptyStructTypeCache.IsTrackableStructType(parameterType.Type)) 2834parameterType.Type, 2867return TypeWithState.Create(parameterType.Type, NullableFlowState.MaybeDefault); 2872return TypeWithState.Create(parameterType.Type, NullableFlowState.NotNull); 2896returnType.Type.SpecialType == SpecialType.System_Boolean) 3003type = ((NamedTypeSymbol)returnType.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single(); 3030if (!node.Type.Equals(type.Type, TypeCompareKind.ConsiderEverything | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamicAndTupleNames)) 3035Debug.Assert(node.Type.IsErrorType() || type.Type.IsErrorType()); 3398VisitObjectCreationInitializer(resultSlot, resultType.Type, withExpr.InitializerExpression, delayCompletionForType: false); 3451InheritDefaultState(GetDeclaredLocalResult(local).Type, slot); 3509Debug.Assert(type.Type.IsErrorType()); 3588return AnonymousTypeManager.GetAnonymousTypeFieldTypes(type).Any(static t => canIgnoreAnyType(t.Type)); 3768var strippedTargetCollectionType = targetCollectionType.Type.StrippedType(); 3924Debug.Assert(TypeSymbol.Equals(resultTypeWithAnnotations.Type, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 3926var type = resultTypeWithAnnotations.Type; 4002if (AreNullableAndUnderlyingTypes(type, parameterType.Type, out TypeWithAnnotations underlyingType)) 4196Debug.Assert(TypeSymbol.Equals(objectInitializer.Type, symbol.GetTypeOrReturnType().Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4213Action<int, TypeSymbol>? nestedCompletion = VisitObjectCreationInitializer(slot, symbol.GetTypeOrReturnType().Type, initializer, delayCompletionForType); 4246nestedCompletion?.Invoke(slot, symbol.GetTypeOrReturnType().Type); 4328Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.LValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4386Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.LValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4637inferredType = TypeWithState.Create(inferredType.Type, elementState).ToTypeWithAnnotations(compilation); 5117if (isLifted && targetTypeWithNullability.Type.IsNonNullableValueType()) 5487MarkDependentSlotsNotNull(childSlot, member.GetTypeOrReturnType().Type, ref state, depth - 1); 5560Debug.Assert(targetType.Type.ContainsErrorType() || 5562TypeSymbol.Equals(targetType.Type.GetNullableUnderlyingType(), node.Type, TypeCompareKind.AllIgnoreOptions)); 5566leftSlot = GetNullableOfTValueSlot(targetType.Type, leftSlot, out _); 5572Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.Type, TypeCompareKind.AllIgnoreOptions)); 5576TypeWithState resultType = TypeWithState.Create(targetType.Type, rightResult.State); 5836TypeSymbol accessType = accessTypeWithAnnotations.Type; 6030var typeWithState = TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6043return TypeWithState.Create(resultTypeWithAnnotations.Type, resultState); 6158new BoundExpressionWithNullability(expr.Syntax, expr, type.NullableAnnotation, type.Type); 6598if (parameter.ContainingSymbol.GetTypeOrReturnType().Type.SpecialType != SpecialType.System_Boolean) 7368conversion = GenerateConversion(_conversions, argumentNoConversion, argumentResultType, parameterType.Type, fromExplicitCast: false, extensionMethodThisArgument: false, isChecked: conversionOpt?.Checked ?? false); 7372ReportNullabilityMismatchInArgument(argumentNoConversion.Syntax, argumentResultType, parameter, parameterType.Type, forOutput: false); 7404if (IsNullabilityMismatch(lvalueResultType.Type, parameterType.Type)) 7407ReportNullabilityMismatchInRefArgument(argumentNoConversion, argumentType: lvalueResultType.Type, parameter, parameterType.Type); 7511parameterWithState = TypeWithState.Create(parameterType.Type, adjustedState); 7568if (!_conversions.HasIdentityOrImplicitReferenceConversion(parameterType.Type, lValueType.Type, ref discardedUseSiteInfo)) 7570ReportNullabilityMismatchInArgument(argument.Syntax, lValueType.Type, parameter, parameterType.Type, forOutput: true); 7805OverloadResolution.TryInferParamsCollectionIterationType(_binder, type.Type, out paramsIterationType); 7994return new BoundExpressionWithNullability(argument.Syntax, argument, argumentType.NullableAnnotation, argumentType.Type); 8274if (TypeAllowsConditionalState(targetType.Type) && TypeAllowsConditionalState(operand.Type)) 8387if (typeArg.Type.Equals(underlyingTypeOpt, TypeCompareKind.AllIgnoreOptions)) 8808operandType = completion(targetTypeWithNullability.Type.GetNullableUnderlyingTypeWithAnnotations()); 8836TypeSymbol targetType = targetTypeWithNullability.Type; 9152if (targetType.Type?.IsTypeParameterDisallowingAnnotationInCSharp8() == true) 9161dependsOnTypeParameter(typeParameter1, (TypeParameterSymbol)targetType.Type, NullableAnnotation.NotAnnotated, out var annotation)) 9168if (targetType.Type?.IsTypeParameterDisallowingAnnotationInCSharp8() == false) 9192targetType.Type is TypeParameterSymbol typeParameter2) 9242if (constraintType.Type is TypeParameterSymbol constraintTypeParameter && 9346TypeSymbol targetType = targetTypeWithNullability.Type; 9516bool typeNeedsLifting = returnType.Type.IsNonNullableValueType(); 9517TypeSymbol type = typeNeedsLifting ? MakeNullableOf(returnType) : returnType.Type; 9561var conversion = _conversions.ClassifyStandardConversion(operandType.Type, targetType.Type, ref discardedUseSiteInfo); 9566ReportNullabilityMismatchInArgument(diagnosticLocation, operandType.Type, parameterOpt, targetType.Type, forOutput: false); 9570ReportNullabilityMismatchInAssignment(diagnosticLocation, operandType.Type, targetType.Type); 9651Debug.Assert(TypeSymbol.Equals(resultTypeWithAnnotations.Type, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 9652var delegateType = (NamedTypeSymbol)resultTypeWithAnnotations.Type; 9828arguments.Add(new BoundExpressionWithNullability(syntax, new BoundParameter(syntax, parameter), parameterType.NullableAnnotation, parameterType.Type)); 9978SetResult(node, TypeWithState.Create(leftLValueType.Type, rightState.State), leftLValueType); 10319var valueBeforeNullableWrapping = TypeWithState.Create(underlyingType.Type, NullableFlowState.NotNull); 10603if (argumentType.Type is { } argType && IsNullabilityMismatch(paramType.Type, argType)) 10605ReportNullabilityMismatchInArgument(argument.Syntax, argType, parameter, paramType.Type, forOutput: false); 11125conversion = _conversions.ClassifyImplicitConversionFromType(sourceType.Type, destinationType.Type, ref discardedUseSiteInfo);
FlowAnalysis\NullableWalker_Patterns.cs (14)
452var output = new BoundDagTemp(e.Syntax, parameterType.Type, e, i); 455addToTempMap(output, outputSlot, parameterType.Type); 490var output = new BoundDagTemp(e.Syntax, type.Type, e); 528addToTempMap(output, outputSlot, type.Type); 536var output = new BoundDagTemp(e.Syntax, type.Type, e); 543addToTempMap(output, outputSlot, type.Type); 561var output = new BoundDagTemp(e.Syntax, type.Type, e); 565addToTempMap(output, outputSlot, type.Type); 573var output = new BoundDagTemp(e.Syntax, type.Type, e); 576addToTempMap(output, outputSlot, type.Type); 688inferredType = TypeWithAnnotations.Create(inferredType.Type, existingType.NullableAnnotation.Join(inferredType.NullableAnnotation)); 840var output = new BoundDagTemp(e.Syntax, type.Type, e, index: index); 843addToTempMap(output, outputSlot, type.Type); 1020TypeWithState resultType = TypeWithState.Create(inferredTypeWithAnnotations.Type, inferredState);
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (2)
256var resultType = returnType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type; 263resultType = typeMap.SubstituteType(resultType).Type;
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (1)
45Debug.Assert(!TypeSymbol.Equals(method.IteratorElementTypeWithAnnotations.Type, null, TypeCompareKind.ConsiderEverything2));
Lowering\AsyncRewriter\AsyncStateMachine.cs (1)
35var elementType = TypeMap.SubstituteType(asyncMethod.IteratorElementTypeWithAnnotations).Type;
Lowering\ClosureConversion\ClosureConversion.cs (5)
994while (!TypeSymbol.Equals(oldTypeArg.Type, newTypeArg.Type, TypeCompareKind.ConsiderEverything)); 998Debug.Assert((object)oldTypeArg.Type == newTypeArg.Type); 1694var cacheVariableType = containerAsFrame.TypeMap.SubstituteType(node.Type).Type;
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (2)
733var intermediate = nullable.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 847_bound.Typeof(_typeMap.SubstituteType(p.Type).Type, _bound.WellKnownType(WellKnownType.System_Type)), _bound.Literal(p.Name));
Lowering\ClosureConversion\LambdaCapturedVariable.cs (2)
117return frame.TypeMap.SubstituteType(((object)local != null ? local.TypeWithAnnotations : ((ParameterSymbol)variable).TypeWithAnnotations).Type).Type;
Lowering\IteratorRewriter\IteratorRewriter.cs (1)
258var IEnumerableOfElementType = F.SpecialType(SpecialType.System_Collections_Generic_IEnumerable_T).Construct(_elementType.Type);
Lowering\IteratorRewriter\IteratorStateMachine.cs (2)
34interfaces.Add(ContainingAssembly.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T).Construct(ElementType.Type)); 38interfaces.Add(ContainingAssembly.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerator_T).Construct(ElementType.Type));
Lowering\LocalRewriter\DelegateCacheContainer.cs (1)
69var fieldType = TypeParameters.IsEmpty ? delegateType : TypeMap.SubstituteType(delegateType).Type;
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (7)
272ShouldUseRuntimeHelpersCreateSpan(node, elementType.Type)) 275Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType.Type, _compilation)); 278return _factory.New(constructor, _factory.Array(elementType.Type, rewrittenElements)); 284Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType.Type, _compilation)); 292Debug.Assert(IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType.Type, _compilation)); 848asSpanMethod = collectionsMarshalAsSpanMethod.Construct(namedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type); 1084var elementType = ((NamedTypeSymbol)spanTemp.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (6)
96var byteType = ((NamedTypeSymbol)node.Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type; 611createSpan = createSpan.Construct(rewrittenOperand.Type, spanType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type); 635rewrittenOperand = _factory.Convert(method.ParameterTypesWithAnnotations[0].Type, rewrittenOperand); 658rewrittenOperand = _factory.Convert(implicitOperator.ParameterTypesWithAnnotations[0].Type, rewrittenOperand); 692rewrittenOperand = _factory.Convert(method.ParameterTypesWithAnnotations[0].Type, rewrittenOperand); 970var convertedFieldAccess = MakeConversionNode(syntax, fieldAccess, elementConversions[i], destElementTypes[i].Type, @checked, explicitCastInCode);
Lowering\LocalRewriter\LocalRewriter_Field.cs (1)
89currentLinkType = (NamedTypeSymbol)currentLinkType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[NamedTypeSymbol.ValueTupleRestPosition - 1].Type;
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (3)
69var elementType = resultTypes[i].Type; 121syntax, fieldAccess, elementConversions[i], boundConversion.Checked, boundConversion.ExplicitCastInCode, null, null, destElementTypes[i].Type, boundConversion.HasErrors); 476conversionGroupOpt: null, constantValueOpt: null, type: type.Type);
Lowering\MethodToClassRewriter.cs (2)
212return TypeMap.SubstituteType(type).Type; 339visitedTypeArgs.Add(typeArg.WithTypeAndModifiers(VisitType(typeArg.Type), typeArg.CustomModifiers));
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (2)
319proxy = new CapturedToStateMachineFieldReplacement(GetOrAllocateReusableHoistedField(TypeMap.SubstituteType(local.Type).Type, out reused, local), isReusable: true); 540var type = TypeMap.SubstituteType(local.Type).Type;
Lowering\StateMachineRewriter\StateMachineRewriter.cs (3)
183var fieldType = typeMap.SubstituteType(local.Type).Type; 252var proxyField = F.StateMachineField(typeMap.SubstituteType(parameter.Type).Type, parameter.Name, isPublic: !PreserveInitialParameterValuesAndThreadId); 257var field = F.StateMachineField(typeMap.SubstituteType(parameter.Type).Type, GeneratedNames.StateMachineParameterProxyFieldName(parameter.Name), isPublic: true);
Lowering\SyntheticBoundNodeFactory.cs (2)
1226return new BoundPointerIndirectionOperator(Syntax, Default(new PointerTypeSymbol(type)), refersToLocation: false, type.Type); 1276return Typeof(type.Type, systemType);
Symbols\AbstractTypeMap.cs (6)
298var substituted = SubstituteType(t).Type; 357!type.Type.ContainsTypeParameters(ignoreTypesDependentOnTypeParametersOpt)) 368!type.Type.ContainsTypeParameters(ignoreTypesDependentOnTypeParametersOpt)) 372if (!map.TryGetValue(substituted.Type, out int mergeWith)) 374map.Add(substituted.Type, result.Count); 396return substituted.WithTypeAndModifiers(dynamicEraser.EraseDynamic(substituted.Type), substituted.CustomModifiers);
Symbols\AliasSymbol.cs (1)
410annotatedNamespaceOrType.TypeWithAnnotations.Type?.IsReferenceType is true)
Symbols\AnonymousTypes\AnonymousTypeField.cs (1)
34public TypeSymbol Type => TypeWithAnnotations.Type;
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (1)
236var original = TypeWithAnnotations.Create(genericFieldTypes[index].Type);
Symbols\ArrayTypeSymbol.cs (2)
216return _elementTypeWithAnnotations.Type; 523var newInterfaces = _interfaces.SelectAsArray((i, t) => i.OriginalDefinition.Construct(t), newElementType.Type);
Symbols\Compilation_WellKnownMembers.cs (2)
1027twa.Type.VisitType(visitor, (transformFlagsBuilder, addCustomModifierFlags)); 1110return named.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[argumentIndex].Type;
Symbols\ConstraintsHelper.cs (52)
161Debug.Assert(!constraintType.Type.ContainsDynamic()); 170var constraintTypeParameter = (TypeParameterSymbol)constraintType.Type; 225if (constraintType.Type.IsInterfaceType()) 227AddInterface(interfacesBuilder, (NamedTypeSymbol)constraintType.Type); 233constraintEffectiveBase = (NamedTypeSymbol)constraintType.Type; 234constraintDeducedBase = constraintType.Type; 241var underlyingType = constraintType.Type.GetNullableUnderlyingType(); 259constraintDeducedBase = constraintType.Type; 265constraintDeducedBase = constraintType.Type; 271constraintDeducedBase = constraintType.Type; 275constraintEffectiveBase = (NamedTypeSymbol)constraintType.Type; 276constraintDeducedBase = constraintType.Type; 935if (typeArgument.Type.IsPointerOrFunctionPointer() || typeArgument.IsRestrictedType(ignoreSpanLikeTypes: true) || typeArgument.IsVoidType()) 938diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_BadTypeArgument, typeArgument.Type)))); 942if (typeArgument.Type.IsRefLikeOrAllowsRefLikeType()) 961diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_NotRefStructConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type)))); 969diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_GenericArgIsStaticClass, typeArgument.Type)))); 975if (!typeArgument.Type.IsReferenceType) 978diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_RefConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type)))); 988var managedKind = typeArgument.Type.GetManagedKind(ref useSiteInfo); 991if (managedKind == ManagedKind.Managed || !typeArgument.Type.IsNonNullableValueType()) 994diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_UnmanagedConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type)))); 1015if (typeParameter.HasValueTypeConstraint && !typeArgument.Type.IsNonNullableValueType()) 1018diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_ValConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type)))); 1044if (typeArgument.Type.IsErrorType()) 1066if (typeArgument.Type is NamedTypeSymbol { IsInterface: true } iface && SelfOrBaseHasStaticAbstractMember(iface, ref useSiteInfo, out Symbol member)) 1095var error = SatisfiesConstructorConstraint(typeArgument.Type); 1103diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_NewConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type)))); 1107diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_NewConstraintCannotHaveRequiredMembers, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type)))); 1124if (typeParameter.HasNotNullConstraint && typeArgument.GetValueNullableAnnotation().IsAnnotated() && !typeArgument.Type.IsNonNullableValueType()) 1164if (typeArgument.Type.IsReferenceType) 1170errorCode = constraintType.Type.IsInterfaceType() ? ErrorCode.ERR_GenericConstraintNotSatisfiedNullableInterface : ErrorCode.ERR_GenericConstraintNotSatisfiedNullableEnum; 1184if (constraintType.Type.Equals(typeArgument.Type, TypeCompareKind.AllIgnoreOptions)) 1186constraintTypeErrorArgument = constraintType.Type; 1187typeArgumentErrorArgument = typeArgument.Type; 1191SymbolDistinguisher distinguisher = new SymbolDistinguisher(args.CurrentCompilation, constraintType.Type, typeArgument.Type); 1201var type = typeWithAnnotations.Type; 1244var type = typeWithAnnotations.Type; 1323if (constraintType.Type.IsErrorType()) 1334if (conversions.HasIdentityOrImplicitReferenceConversion(typeArgument.Type, constraintType.Type, ref useSiteInfo)) 1339if (typeArgument.Type.IsValueType) 1343if (conversions.HasBoxingConversion(typeArgument.Type.IsNullableType() ? ((NamedTypeSymbol)typeArgument.Type).ConstructedFrom : typeArgument.Type, 1344constraintType.Type, ref useSiteInfo)) 1349if (typeArgument.Type is NamedTypeSymbol { IsRefLikeType: true } refLike && 1350conversions.ImplementsVarianceCompatibleInterface(refLike, constraintType.Type, ref useSiteInfo)) 1358var typeParameter = (TypeParameterSymbol)typeArgument.Type; 1362if (conversions.HasImplicitTypeParameterConversion(typeParameter, constraintType.Type, ref useSiteInfo))
Symbols\DiscardSymbol.cs (1)
15Debug.Assert(typeWithAnnotations.Type is object);
Symbols\EventSymbol.cs (1)
58public TypeSymbol Type => TypeWithAnnotations.Type;
Symbols\FieldSymbol.cs (1)
75public TypeSymbol Type => TypeWithAnnotations.Type;
Symbols\LocalSymbol.cs (1)
73public TypeSymbol Type => TypeWithAnnotations.Type;
Symbols\MemberSignatureComparer.cs (1)
755result.Add(SubstituteType(typeMap, type).Type);
Symbols\MemberSymbolExtensions.cs (5)
118if (parameterType.Type.ContainsPointer()) 206count += methodReturnType.Type.CustomModifierCount(); 212count += paramType.Type.CustomModifierCount(); 255count += type.Type.CustomModifierCount(); 261count += paramType.Type.CustomModifierCount();
Symbols\Metadata\PE\DynamicTypeDecoder.cs (4)
281TypeSymbol transformedTypeArg = TransformType(typeArg.Type); 290anyTransformed |= !TypeSymbol.Equals(transformedTypeArg, typeArg.Type, TypeCompareKind.ConsiderEverything2); 407var transformedType = decoder.TransformType(typeWithAnnotations.Type); 413if (transformedType.Equals(typeWithAnnotations.Type, TypeCompareKind.ConsiderEverything))
Symbols\Metadata\PE\MemberRefMetadataDecoder.cs (3)
185TypeSymbol.Equals((fieldType = field.TypeWithAnnotations).Type, fieldInfo.Type, TypeCompareKind.CLRSignatureCompareOptions) && 261if (!TypeSymbol.Equals(substituted.Type, targetParam.Type, TypeCompareKind.CLRSignatureCompareOptions)) 289if (!TypeSymbol.Equals(substituted.Type, targetReturnType, TypeCompareKind.CLRSignatureCompareOptions))
Symbols\Metadata\PE\MetadataDecoder.cs (1)
255if (IsOrClosedOverATypeFromAssemblies(arguments[i].Type, assemblies))
Symbols\Metadata\PE\NativeIntegerTypeDecoder.cs (1)
74if (TransformType(type.Type) is { } transformedType)
Symbols\Metadata\PE\PEEventSymbol.cs (4)
90TypeSymbol originalEventType = _eventTypeWithAnnotations.Type; 170TypeSymbol.Equals(_eventTypeWithAnnotations.Type, ((NamedTypeSymbol)candidateAssociatedFieldType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type, TypeCompareKind.ConsiderEverything2)) 177if (TypeSymbol.Equals(candidateAssociatedFieldType, _eventTypeWithAnnotations.Type, TypeCompareKind.ConsiderEverything2))
Symbols\Metadata\PE\PEFieldSymbol.cs (1)
336_lazyFixedImplementationType = type.Type as NamedTypeSymbol;
Symbols\Metadata\PE\PENamedTypeSymbol.cs (2)
521baseType = (NamedTypeSymbol)NullableTypeDecoder.TransformType(TypeWithAnnotations.Create(decodedType), _handle, moduleSymbol, accessSymbol: this, nullableContext: this).Type; 581typeSymbol = NullableTypeDecoder.TransformType(TypeWithAnnotations.Create(typeSymbol), interfaceImpl, moduleSymbol, accessSymbol: this, nullableContext: this).Type;
Symbols\Metadata\PE\PEParameterSymbol.cs (2)
308var typeSymbol = DynamicTypeDecoder.TransformType(typeWithAnnotations.Type, countOfCustomModifiers, handle, moduleSymbol, refKind); 336else if (typeWithAnnotations.Type.IsRefLikeOrAllowsRefLikeType())
Symbols\Metadata\PE\PETypeParameterSymbol.cs (1)
310if (!(constraintType.Type is PETypeParameterSymbol typeParameter) ||
Symbols\Metadata\PE\TupleTypeDecoder.cs (2)
117TypeSymbol type = metadataType.Type; 342TypeSymbol type = typeWithAnnotations.Type;
Symbols\MethodSymbol.cs (8)
247public TypeSymbol ReturnType => ReturnTypeWithAnnotations.Type; 906internal TypeSymbol GetParameterType(int index) => ParameterTypesWithAnnotations[index].Type; 1161if (type.Type.ContainsDynamic() && compilation.HasDynamicEmitAttributes(BindingDiagnosticBag.Discarded, Location.None)) 1163AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(type.Type, type.CustomModifiers.Length + this.RefCustomModifiers.Length, this.RefKind)); 1166if (compilation.ShouldEmitNativeIntegerAttributes(type.Type)) 1168AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeNativeIntegerAttribute(this, type.Type)); 1171if (type.Type.ContainsTupleNames() && compilation.HasTupleNamesAttributes(BindingDiagnosticBag.Discarded, Location.None)) 1173AddSynthesizedAttribute(ref attributes, compilation.SynthesizeTupleNamesAttribute(type.Type));
Symbols\NamedTypeSymbol.cs (5)
78typeArgument.Type.OriginalDefinition.AddUseSiteInfo(ref useSiteInfo); 87result.Type.OriginalDefinition.AddUseSiteInfo(ref useSiteInfo); 1164internal static readonly Func<TypeWithAnnotations, bool> TypeWithAnnotationsIsErrorType = type => type.HasType && type.Type.IsErrorType(); 1275builder.Add(argument.Type); 1660typeToCheck = ((NamedTypeSymbol)typeToCheck).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[ValueTupleRestPosition - 1].Type;
Symbols\NullableAnnotationExtensions.cs (2)
110return type.Type?.GetITypeSymbol(type.ToPublicAnnotation()); 119ToPublicAnnotation(type.Type, type.NullableAnnotation);
Symbols\OverriddenOrHiddenMembersHelpers.cs (2)
895methodReturnType.Type.HasCustomModifiers(flagNonDefaultArraySizesOrLowerBounds: false); 900propertyType.Type.HasCustomModifiers(flagNonDefaultArraySizesOrLowerBounds: false);
Symbols\ParameterSymbol.cs (1)
54public TypeSymbol Type => TypeWithAnnotations.Type;
Symbols\PointerTypeSymbol.cs (1)
76public TypeSymbol PointedAtType => PointedAtTypeWithAnnotations.Type;
Symbols\PropertySymbol.cs (1)
91public TypeSymbol Type => TypeWithAnnotations.Type;
Symbols\Retargeting\RetargetingPropertySymbol.cs (1)
70if (type.Type.TryAsDynamicIfNoPia(this.ContainingType, out TypeSymbol asDynamic))
Symbols\Retargeting\RetargetingSymbolTranslator.cs (4)
182var newTypeSymbol = Retarget(underlyingType.Type, options); 192if (modifiersHaveChanged || !TypeSymbol.Equals(underlyingType.Type, newTypeSymbol, TypeCompareKind.ConsiderEverything2)) 673if (IsOrClosedOverAnExplicitLocalType(argument.Type)) 1119if (TypeSymbol.Equals(retargetedEvent.Type, targetType.Type, TypeCompareKind.ConsiderEverything2))
Symbols\SignatureOnlyParameterSymbol.cs (4)
30Debug.Assert((object)type.Type != null); 118TypeSymbol.Equals(_type.Type, other._type.Type, compareKind) && 129_type.Type.GetHashCode(),
Symbols\Source\CustomModifierUtils.cs (2)
48TypeSymbol returnTypeSymbol = returnType.Type; 56TypeSymbol returnTypeWithCustomModifiers = sourceMethodReturnType.Type;
Symbols\Source\ExplicitInterfaceHelpers.cs (1)
54explicitInterfaceTypeOpt = binder.BindType(explicitInterfaceName, diagnostics).Type;
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (6)
400if (type.Type.ContainsDynamic()) 403compilation.SynthesizeDynamicAttribute(type.Type, type.CustomModifiers.Length)); 406if (compilation.ShouldEmitNativeIntegerAttributes(type.Type)) 408AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeNativeIntegerAttribute(this, type.Type)); 411if (type.Type.ContainsTupleNames()) 414compilation.SynthesizeTupleNamesAttribute(type.Type));
Symbols\Source\GlobalExpressionVariable.cs (2)
136TypeSymbol.Equals(originalType, type.Type, TypeCompareKind.ConsiderEverything2)); 140TypeChecks(type.Type, diagnostics);
Symbols\Source\LambdaSymbol.cs (1)
162Debug.Assert(_returnType.Type.IsErrorType());
Symbols\Source\LocalFunctionOrSourceMemberMethodSymbol.cs (2)
38Debug.Assert(TypeSymbol.Equals(_lazyIteratorElementType.Value.Type, elementType.Type, TypeCompareKind.ConsiderEverything));
Symbols\Source\LocalFunctionSymbol.cs (2)
266if (compilation.ShouldEmitNativeIntegerAttributes(returnType.Type)) 283diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, returnTypeSyntax.Location, returnType.Type);
Symbols\Source\ParameterHelpers.cs (2)
683typeWithAnnotations.Type); 695diagnostics.Add(ErrorCode.ERR_MethodArgCantBeRefAny, syntax.Location, typeWithAnnotations.Type);
Symbols\Source\SourceComplexParameterSymbol.cs (11)
1070else if (!compilation.Conversions.HasCallerLineNumberConversion(TypeWithAnnotations.Type, ref useSiteInfo)) 1074diagnostics.Add(ErrorCode.ERR_NoConversionForCallerLineNumberParam, node.Name.Location, intType, TypeWithAnnotations.Type); 1098else if (!compilation.Conversions.HasCallerInfoStringConversion(TypeWithAnnotations.Type, ref useSiteInfo)) 1102diagnostics.Add(ErrorCode.ERR_NoConversionForCallerFilePathParam, node.Name.Location, stringType, TypeWithAnnotations.Type); 1131else if (!compilation.Conversions.HasCallerInfoStringConversion(TypeWithAnnotations.Type, ref useSiteInfo)) 1135diagnostics.Add(ErrorCode.ERR_NoConversionForCallerMemberNameParam, node.Name.Location, stringType, TypeWithAnnotations.Type); 1172else if (!compilation.Conversions.HasCallerInfoStringConversion(TypeWithAnnotations.Type, ref useSiteInfo)) 1176diagnostics.Add(ErrorCode.ERR_NoConversionForCallerArgumentExpressionParam, node.Name.Location, stringType, TypeWithAnnotations.Type); 1558var elementType = elementTypeWithAnnotations.Type; 1571elementType = elementTypeWithAnnotations.Type; 1630elementType = elementTypeWithAnnotations.Type;
Symbols\Source\SourceDelegateMethodSymbol.cs (1)
67diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, returnTypeSyntax.Location, returnType.Type);
Symbols\Source\SourceEventSymbol.cs (8)
331if (type.Type.ContainsDynamic()) 333AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(type.Type, type.CustomModifiers.Length)); 336if (compilation.ShouldEmitNativeIntegerAttributes(type.Type)) 338AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeNativeIntegerAttribute(this, type.Type)); 341if (type.Type.ContainsTupleNames()) 344DeclaringCompilation.SynthesizeTupleNamesAttribute(type.Type)); 632if (type.Type.Equals(overriddenEventType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamic)) 634type = type.WithTypeAndModifiers(CustomModifierUtils.CopyTypeCustomModifiers(overriddenEventType, type.Type, containingAssembly),
Symbols\Source\SourceLocalSymbol.cs (2)
390Debug.Assert(newType.Type is object); 397originalType.Value.DefaultType.IsErrorType() && newType.Type.IsErrorType() ||
Symbols\Source\SourceMemberContainerSymbol.cs (1)
3951var propertyParamType = (((i == numParams - 1) && !getNotSet) ? propertySymbol.TypeWithAnnotations : propertyParams[i].TypeWithAnnotations).Type;
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (16)
795if (IsOrContainsErrorType(parameterType.Type)) 960if (!IsOrContainsErrorType(overridingMemberType.Type)) 962diagnostics.Add(ErrorCode.ERR_CantChangeTypeOnOverride, overridingMemberLocation, overridingMember, overriddenMember, overriddenMemberType.Type); 998if (DeclaringCompilation.Conversions.HasIdentityOrImplicitReferenceConversion(overridingMethod.ReturnTypeWithAnnotations.Type, overriddenMethod.ReturnTypeWithAnnotations.Type, ref discardedUseSiteInfo)) 1063if (!IsOrContainsErrorType(overridingMemberType.Type)) 1068DeclaringCompilation.Conversions.HasIdentityOrImplicitReferenceConversion(overridingMemberType.Type, overriddenMemberType.Type, ref discardedUseSiteInfo)) 1072diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportCovariantPropertiesOfClasses, overridingMemberLocation, overridingMember, overriddenMember, overriddenMemberType.Type); 1084diagnostics.Add(ErrorCode.ERR_CantChangeTypeOnOverride, overridingMemberLocation, overridingMember, overriddenMember, overriddenMemberType.Type); 1204var result = DeclaringCompilation.Conversions.HasIdentityOrImplicitReferenceConversion(overridingReturnType.Type, overriddenReturnType.Type, ref useSiteInfo); 1269overrideReturnType.Type, 1270baseMethod.ReturnTypeWithAnnotations.Type)) 1302baseParameterType.Type, 1303overrideParameterType.Type))
Symbols\Source\SourceMemberFieldSymbol.cs (3)
500if (type.Type.IsRefLikeOrAllowsRefLikeType()) 573var elementType = ((PointerTypeSymbol)type.Type).PointedAtType; 591TypeChecks(type.Type, diagnostics);
Symbols\Source\SourceMemberMethodSymbol.cs (3)
353diagnostics.Add(code, GetFirstLocation(), this, returnType.Type); 379if (returnType.Type.HasFileLocalTypes()) 381diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, GetFirstLocation(), returnType.Type, ContainingType);
Symbols\Source\SourceNamedTypeSymbol.cs (2)
61TypeSymbol bt = baseBinder.BindType(t, BindingDiagnosticBag.Discarded).Type; 1888if (!fieldSupported || elementType.Type.IsPointerOrFunctionPointer() || elementType.IsRestrictedType(ignoreSpanLikeTypes: true))
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (4)
226var curBaseSym = baseBinder.BindType(b, BindingDiagnosticBag.Discarded).Type; 351static (type, arg, flag) => !type.Type.IsValueType && !type.NullableAnnotation.IsOblivious(), 471baseType = baseBinder.BindType(typeSyntax, diagnostics, newBasesBeingResolved).Type; 540baseType = baseBinder.BindType(typeSyntax, diagnostics, newBasesBeingResolved).Type;
Symbols\Source\SourceNamedTypeSymbol_Enum.cs (1)
62var type = baseBinder.BindType(typeSyntax, diagnostics).Type;
Symbols\Source\SourceOrdinaryMethodSymbol.cs (4)
149diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, syntax.ReturnType.Location, returnType.Type); 210if (!parameter0Type.Type.IsValidExtensionParameterType()) 216diagnostics.Add(ErrorCode.ERR_BadTypeforThis, loc, parameter0Type.Type); 218else if (parameter0RefKind == RefKind.Ref && !parameter0Type.Type.IsValueType)
Symbols\Source\SourceParameterSymbolBase.cs (6)
95if (type.Type.ContainsDynamic()) 97AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(type.Type, type.CustomModifiers.Length + this.RefCustomModifiers.Length, this.RefKind)); 100if (compilation.ShouldEmitNativeIntegerAttributes(type.Type)) 102AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeNativeIntegerAttribute(this, type.Type)); 110if (type.Type.ContainsTupleNames()) 113compilation.SynthesizeTupleNamesAttribute(type.Type));
Symbols\Source\SourcePropertyAccessorSymbol.cs (2)
293CustomModifierUtils.CopyTypeCustomModifiers(type.Type, _lazyReturnType.Type, this.ContainingAssembly),
Symbols\Source\SourcePropertySymbol.cs (3)
574diagnostics.Add((this.IsIndexer ? ErrorCode.ERR_BadVisIndexerReturn : ErrorCode.ERR_BadVisPropertyType), Location, this, type.Type); 577if (type.Type.HasFileLocalTypes() && !ContainingType.HasFileLocalTypes()) 579diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, Location, type.Type, ContainingType);
Symbols\Source\SourcePropertySymbolBase.cs (10)
256if (type.Type.Equals(overriddenPropertyType.Type, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreDynamic)) 259CustomModifierUtils.CopyTypeCustomModifiers(overriddenPropertyType.Type, type.Type, this.ContainingAssembly), 1370if (type.Type.ContainsDynamic()) 1373compilation.SynthesizeDynamicAttribute(type.Type, type.CustomModifiers.Length + RefCustomModifiers.Length, _refKind)); 1376if (compilation.ShouldEmitNativeIntegerAttributes(type.Type)) 1378AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeNativeIntegerAttribute(this, type.Type)); 1381if (type.Type.ContainsTupleNames()) 1384compilation.SynthesizeTupleNamesAttribute(type.Type));
Symbols\Source\SourceTypeParameterSymbol.cs (2)
266if (!diagnostics.ReportUseSite(constraintType.Type, args.Args.Location)) 268constraintType.Type.CheckAllConstraints(args);
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (3)
259diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, returnTypeSyntax.Location, returnType.Type); 262if (returnType.Type.IsStatic) 267diagnostics.Add(ErrorFacts.GetStaticClassReturnCode(useWarning: false), returnTypeSyntax.Location, returnType.Type);
Symbols\Source\TypeParameterConstraintClause.cs (2)
174TypeSymbol type = constraintType.IsResolved ? constraintType.Type : constraintType.DefaultType; 234TypeSymbol type = constraintType.IsResolved ? constraintType.Type : constraintType.DefaultType;
Symbols\SubstitutedFieldSymbol.cs (1)
103return (NamedTypeSymbol)_containingType.TypeSubstitution.SubstituteType(OriginalDefinition.FixedImplementationType(emitModule)).Type;
Symbols\SubstitutedMethodSymbol.cs (3)
178return this.TypeArgumentsWithAnnotations[reducedFromTypeParameter.Ordinal].Type; 393code = Hash.Combine(arg.Type, code); 414typeArguments[i].Type,
Symbols\Symbol.cs (1)
1230return DeriveUseSiteInfoFromType(ref result, type.Type) ||
Symbols\Symbol_Attributes.cs (1)
551var boundTypeSymbol = (NamedTypeSymbol)boundType.Type;
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (1)
124printableMembers.Any(static m => m.GetTypeOrReturnType().Type.IsErrorType()))
Symbols\Synthesized\SynthesizedEmbeddedNativeIntegerAttributeSymbol.cs (1)
40boolArrayType.Type,
Symbols\Synthesized\SynthesizedEmbeddedNullableAttributeSymbol.cs (1)
44byteArrayType.Type,
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (1)
610Debug.Assert(TypeSymbol.Equals(initializeResult.Type, _returnType.Type, TypeCompareKind.ConsiderEverything2));
Symbols\Synthesized\SynthesizedFieldSymbolBase.cs (1)
52var type = typeWithAnnotations.Type;
Symbols\Synthesized\SynthesizedInstanceConstructor.cs (1)
277MergeUseSiteInfo(ref result, ReturnTypeWithAnnotations.Type.GetUseSiteInfo());
Symbols\Synthesized\SynthesizedParameterSymbol.cs (6)
156if (type.Type.ContainsDynamic() && compilation.HasDynamicEmitAttributes(BindingDiagnosticBag.Discarded, Location.None) && compilation.CanEmitBoolean()) 158AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(type.Type, type.CustomModifiers.Length + this.RefCustomModifiers.Length, this.RefKind)); 161if (compilation.ShouldEmitNativeIntegerAttributes(type.Type)) 163AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeNativeIntegerAttribute(this, type.Type)); 171if (type.Type.ContainsTupleNames() && 176compilation.SynthesizeTupleNamesAttribute(type.Type));
Symbols\Tuples\TupleFieldSymbol.cs (1)
223newUnderlyingOwner = (NamedTypeSymbol)newUnderlyingOwner.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[NamedTypeSymbol.ValueTupleRestIndex].Type;
Symbols\Tuples\TupleTypeSymbol.cs (5)
145underlyingType = ((NamedTypeSymbol)underlyingType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[NamedTypeSymbol.ValueTupleRestIndex].Type); 213currentType = (NamedTypeSymbol)currentType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[NamedTypeSymbol.ValueTupleRestPosition - 1].Type; 712currentValueTuple = (NamedTypeSymbol)oldUnderlying.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[ValueTupleRestIndex].Type; 793found = (NamedTypeSymbol)found.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[ValueTupleRestPosition - 1].Type; 985var extensionTupleElementTypes = tuple.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[ValueTupleRestPosition - 1].Type.TupleElementTypesWithAnnotations;
Symbols\TypeMap.cs (1)
24public static readonly Func<TypeWithAnnotations, TypeSymbol> AsTypeSymbol = t => t.Type;
Symbols\TypeParameterSymbol.cs (5)
99((TypeSymbol)constraint.Type.OriginalDefinition).AddUseSiteInfo(ref useSiteInfo); 440if (ConstraintImpliesReferenceType(constraintType.Type)) 471if (constraintType.Type.IsNonNullableValueType()) 486bool? isNotNullable = ((TypeParameterSymbol)constraintType.Type).IsNotNullable; 510if (constraintType.Type.IsValueType)
Symbols\TypeParameterSymbolExtensions.cs (1)
23if (constraintType.Type is TypeParameterSymbol typeParameter)
Symbols\TypeSymbolExtensions.cs (14)
122if (constraintType.Type.IsNullableTypeOrTypeParameter()) 154return type.GetNullableUnderlyingTypeWithAnnotations().Type; 162underlyingType = nt.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 442type = ((NamedTypeSymbol)type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type; 748/// instead of <see cref="TypeWithAnnotations.Type"/> to avoid early resolution of nullable types</param> 770TypeSymbol current = type ?? (useDefaultType ? typeWithAnnotationsOpt.DefaultType : typeWithAnnotationsOpt.Type); 1254return type.Type?.ContainsNativeIntegerWrapperType() == true; 1597code = Hash.Combine(arg.Type, code); 1619typeArguments[i].Type.OriginalDefinition, 1954var type = typeWithAnnotations.Type; 2094if (type.Type.ContainsTupleNames()) 2096addIfNotNull(builder, compilation.SynthesizeTupleNamesAttribute(type.Type)); 2098if (compilation.ShouldEmitNativeIntegerAttributes(type.Type)) 2100addIfNotNull(builder, moduleBuilder.SynthesizeNativeIntegerAttribute(declaringSymbol, type.Type));
Symbols\TypeUnification.cs (24)
33Debug.Assert(substituted1.Type.Equals(substituted2.Type, TypeCompareKind.CLRSignatureCompareOptions)); 92if (TypeSymbol.Equals(t1.Type, t2.Type, TypeCompareKind.CLRSignatureCompareOptions) && t1.CustomModifiers.SequenceEqual(t2.CustomModifiers)) 99if (!t1.Type.IsTypeParameter() && t2.Type.IsTypeParameter()) 107Debug.Assert(t1.Type.IsTypeParameter() || !t2.Type.IsTypeParameter()); 109switch (t1.Type.Kind) 118ArrayTypeSymbol at1 = (ArrayTypeSymbol)t1.Type; 119ArrayTypeSymbol at2 = (ArrayTypeSymbol)t2.Type; 135PointerTypeSymbol pt1 = (PointerTypeSymbol)t1.Type; 136PointerTypeSymbol pt2 = (PointerTypeSymbol)t2.Type; 148NamedTypeSymbol nt1 = (NamedTypeSymbol)t1.Type; 149NamedTypeSymbol nt2 = (NamedTypeSymbol)t2.Type; 185if (t2.Type.IsPointerOrFunctionPointer() || t2.IsVoidType()) 190TypeParameterSymbol tp1 = (TypeParameterSymbol)t1.Type; 194if (Contains(t2.Type, tp1)) 207AddSubstitution(ref substitution, tp1, TypeWithAnnotations.Create(t2.Type)); 215TypeWithAnnotations.Create(t2.Type, 220if (t2.Type.IsTypeParameter()) 222var tp2 = (TypeParameterSymbol)t2.Type; 234TypeWithAnnotations.Create(t1.Type, 282if (Contains(typePart.Type, typeParam))
Symbols\TypeWithAnnotations.cs (49)
63public override string ToString() => Type.ToString(); 110if (NullableAnnotation.IsAnnotated() || (Type.IsValueType && Type.IsNullableType())) 115return Create(Type, NullableAnnotation.Annotated, CustomModifiers); 120if (NullableAnnotation.IsNotAnnotated() || (Type.IsValueType && !Type.IsNullableType())) 125return Create(Type, NullableAnnotation.NotAnnotated, CustomModifiers); 136if (Type?.IsPossiblyNullableReferenceTypeTypeParameter() == true) 141if (Type.IsNullableTypeOrTypeParameter()) 160return Type.IsNullableTypeOrTypeParameter(); 198var typeSymbol = this.Type; 243TypeSymbol typeSymbol = other.Type; 245TypeSymbol type = Type.MergeEquivalentTypes(typeSymbol, variance); 264public bool IsNullableType() => Type.IsNullableType(); 267/// The list of custom modifiers, if any, associated with the <see cref="Type"/>. 271public TypeKind TypeKind => Type.TypeKind; 273public Cci.PrimitiveTypeCode PrimitiveTypeCode => Type.PrimitiveTypeCode; 304var str = !HasType ? "<null>" : Type.ToDisplayString(format); 309(!HasType || (!IsNullableType() && !Type.IsValueType))) 315(!HasType || (!Type.IsValueType && !Type.IsTypeParameterDisallowingAnnotationInCSharp8()))) 377TypeSymbol type = Type; 408return obj.Type.GetHashCode(); 426return Type.GetUnificationUseSiteDiagnosticRecursive(ref result, owner, ref checkedTypes) || 445TypeSymbol typeSymbol = this.Type; 454if (typeSymbol.Equals(newTypeWithModifiers.Type, TypeCompareKind.ConsiderEverything) && 465return Create(newTypeWithModifiers.Type, NullableAnnotation, newCustomModifiers); 478if (newTypeWithModifiers.Type is PlaceholderTypeArgumentSymbol) 484Debug.Assert(newTypeWithModifiers.Type is not IndexedTypeParameterSymbol || newTypeWithModifiers.NullableAnnotation == NullableAnnotation.Ignored); 512Debug.Assert((object)newTypeWithModifiers.DefaultType == newTypeWithModifiers.Type); 534newTypeWithModifiers.Type, 544return Type.Equals(other.Type, comparison); 549binder.ReportDiagnosticsIfObsolete(diagnostics, Type, syntax, hasBaseReceiver: false); 596typeWithAnnotationsPredicate: (t, a, b) => t.NullableAnnotation != NullableAnnotation.Oblivious && !t.Type.IsErrorType() && !t.Type.IsValueType, 629var type = typeWithAnnotations.Type; 665TypeSymbol oldTypeSymbol = Type; 726var typeSymbol = Type; 737var typeSymbol = Type; 775return Type.GetHashCode(); 811return TypeWithState.Create(Type, getFlowState(Type, NullableAnnotation)); 1084TryForceResolve(asValueType: _underlying.Type.IsValueType); 1090internal override TypeSymbol GetNullableUnderlyingTypeOrSelf(TypeSymbol typeSymbol) => _underlying.Type; 1145if (!_underlying.Type.IsValueType) 1162if (newUnderlying.Type.Equals(this._underlying.Type, TypeCompareKind.ConsiderEverything) && 1204_underlying.Type;
Symbols\TypeWithState.cs (1)
42var type = typeWithAnnotations.Type;
Symbols\VarianceSafety.cs (2)
264IsVarianceUnsafe(constraintType.Type, 386TypeSymbol typeArg = namedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[i].Type;
Utilities\TypeSymbolExtensions.cs (2)
76=> typeWithAnnotations.CustomModifiers.Length + typeWithAnnotations.Type.CustomModifierCount(); 158=> typeWithAnnotations.CustomModifiers.Any() || typeWithAnnotations.Type.HasCustomModifiers(flagNonDefaultArraySizesOrLowerBounds);