Binder\Binder.WithQueryLambdaParametersBinder.cs (1)
99var result = BindMemberOfType(node, node, name, 0, invoked: false, indexed: false, receiver, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), lookupResult, BoundMethodGroupFlags.None, diagnostics);
Binder\Binder_Constraints.cs (10)
122ArrayBuilder<TypeWithAnnotations>? constraintTypes = null;
250constraintTypes = ArrayBuilder<TypeWithAnnotations>.GetInstance();
257var type = BindTypeOrConstraintKeyword(typeSyntax, diagnostics, out ConstraintContextualKeyword keyword);
348return (TypeParameterConstraintClause.Create(constraints, constraintTypes?.ToImmutableAndFree() ?? ImmutableArray<TypeWithAnnotations>.Empty), syntaxBuilder);
413var constraintTypeBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance();
418var constraintType = constraintTypes[i];
449TypeWithAnnotations constraintType,
486TypeWithAnnotations type,
488ArrayBuilder<TypeWithAnnotations> constraintTypes,
554static bool isValidConstraintType(TypeParameterSymbol typeParameter, TypeConstraintSyntax syntax, TypeWithAnnotations typeWithAnnotations, bool performOnlyCycleSafeValidation, BindingDiagnosticBag diagnostics)
Binder\Binder_Deconstruct.cs (12)
376return pending.SetInferredTypeWithAnnotations(TypeWithAnnotations.Create(type), this, diagnostics);
382return pending.SetInferredTypeWithAnnotations(TypeWithAnnotations.Create(type));
478var typesWithAnnotationsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(leftLength);
520typesWithAnnotationsBuilder.Add(TypeWithAnnotations.Create(mergedType));
552var typesWithAnnotationsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(count);
571typesWithAnnotationsBuilder.Add(TypeWithAnnotations.Create(value.Type));
657typeArgumentsWithAnnotations: default(ImmutableArray<TypeWithAnnotations>),
754var declType = BindVariableTypeWithAnnotations(component.Designation, diagnostics, component.Type.SkipScoped(out _).SkipRef(), ref isConst, out isVar, out alias);
805TypeWithAnnotations declTypeWithAnnotations,
856TypeWithAnnotations declTypeWithAnnotations)
868TypeWithAnnotations declTypeWithAnnotations,
952var fieldType = field.GetFieldType(this.FieldsBeingBound);
Binder\Binder_Expressions.cs (53)
405var type = new PointerTypeSymbol(TypeWithAnnotations.Create(boundStackAlloc.ElementType));
970var declType = BindVariableTypeWithAnnotations(node.Designation, diagnostics, node.Type.SkipScoped(out _).SkipRef(), ref isConst, out isVar, out alias);
978private BoundExpression BindDeclarationVariablesForErrorRecovery(TypeWithAnnotations declTypeWithAnnotations, VariableDesignationSyntax node, CSharpSyntaxNode syntax, BindingDiagnosticBag diagnostics)
980declTypeWithAnnotations = declTypeWithAnnotations.HasType ? declTypeWithAnnotations : TypeWithAnnotations.Create(CreateErrorType("var"));
1019subExpressions.SelectAsArray(e => TypeWithAnnotations.Create(e.Type)),
1054var elementTypesWithAnnotations = ArrayBuilder<TypeWithAnnotations>.GetInstance(arguments.Count);
1086var elementTypeWithAnnotations = TypeWithAnnotations.Create(boundArgument.Type);
1271TypeWithAnnotations typeWithAnnotations = BindType(node.Type, diagnostics);
1412TypeWithAnnotations typeWithAnnotations = typeofBinder.BindType(typeSyntax, diagnostics, out alias);
1436private void CheckDisallowedAttributeDependentType(TypeWithAnnotations typeArgument, NameSyntax attributeName, BindingDiagnosticBag diagnostics)
1465TypeWithAnnotations typeWithAnnotations = this.BindType(typeSyntax, diagnostics, out alias);
1631TypeWithAnnotations typeWithAnnotations = this.BindType(node.Type, diagnostics, out AliasSymbol alias);
1688default(ImmutableArray<TypeWithAnnotations>);
2661TypeWithAnnotations targetTypeWithAnnotations = this.BindType(node.Type, diagnostics);
2822private BoundExpression BindCastCore(ExpressionSyntax node, BoundExpression operand, TypeWithAnnotations targetTypeWithAnnotations, bool wasCompilerGenerated, BindingDiagnosticBag diagnostics)
2910var targetElementTypesWithAnnotations = default(ImmutableArray<TypeWithAnnotations>);
2970ImmutableArray<TypeWithAnnotations> targetElementTypesWithAnnotations)
3001private BoundExpression BindExplicitNullableCastFromNonNullable(ExpressionSyntax node, BoundExpression operand, TypeWithAnnotations targetTypeWithAnnotations, BindingDiagnosticBag diagnostics)
3009TypeWithAnnotations underlyingTargetTypeWithAnnotations = targetTypeWithAnnotations.Type.GetNullableUnderlyingTypeWithAnnotations();
3252var declType = BindVariableTypeWithAnnotations(designation, diagnostics, typeSyntax, ref isConst, out isVar, out alias);
3301var declType = BindVariableTypeWithAnnotations(declarationExpression, diagnostics, typeSyntax, ref isConst, out isVar, out alias);
3565TypeWithAnnotations parameterTypeWithAnnotations,
3665TypeWithAnnotations paramsElementTypeOpt = result.ParamsElementTypeOpt;
3722void reportUnsafeIfNeeded(MemberResolutionResult<TMember> methodResult, BindingDiagnosticBag diagnostics, BoundExpression argument, TypeWithAnnotations parameterTypeWithAnnotations)
4227var arrayType = ArrayTypeSymbol.CreateCSharpArray(Compilation.Assembly, TypeWithAnnotations.Create(bestType), rank);
4256type: GetStackAllocType(node, TypeWithAnnotations.Create(bestType), diagnostics, out bool hasErrors),
4602var elementType = arrayType.ElementTypeWithAnnotations;
4687private TypeSymbol GetStackAllocType(SyntaxNode node, TypeWithAnnotations elementTypeWithAnnotations, BindingDiagnosticBag diagnostics, out bool hasErrors)
5189typeArgumentsWithAnnotations: ImmutableArray<TypeWithAnnotations>.Empty,
5285var typeWithAnnotations = BindType(node.Type, diagnostics);
6859var finalApplicableCandidates = GetCandidatesPassingFinalValidation(node, overloadResolutionResult, receiverOpt: null, default(ImmutableArray<TypeWithAnnotations>), isExtensionMethodGroup: false, diagnostics);
7811ImmutableArray<TypeWithAnnotations> typeArgumentsWithAnnotations = rightHasTypeArguments ?
7813default(ImmutableArray<TypeWithAnnotations>);
7828var typeArgument = typeArgumentsWithAnnotations[i];
7862/// <see cref="MakeQueryInvocation(CSharpSyntaxNode, BoundExpression, string, SeparatedSyntaxList{TypeSyntax}, ImmutableArray{TypeWithAnnotations}, ImmutableArray{BoundExpression}, BindingDiagnosticBag, string?)"/>.
7937var typeArguments = typeArgumentsSyntax.Count > 0 ? BindTypeArguments(typeArgumentsSyntax, diagnostics) : default(ImmutableArray<TypeWithAnnotations>);
8033ImmutableArray<TypeWithAnnotations> typeArguments,
8108ImmutableArray<TypeWithAnnotations> typeArguments,
8228ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, BindingDiagnosticBag diagnostics)
8290ImmutableArray<TypeWithAnnotations> typeArgumentsWithAnnotations,
8359ImmutableArray<TypeWithAnnotations> typeArgumentsWithAnnotations, LookupResult lookupResult, BoundMethodGroupFlags flags, SyntaxNode node,
8525default(ImmutableArray<TypeWithAnnotations>),
8627ImmutableArray<TypeWithAnnotations> typeArgumentsWithAnnotations,
8706typeWithAnnotations: TypeWithAnnotations.Create(type));
8746ImmutableArray<TypeWithAnnotations> typeArgumentsWithAnnotations,
8830ImmutableArray<TypeWithAnnotations> typeArgumentsWithAnnotations,
8948ImmutableArray<TypeWithAnnotations> typeArgumentsWithAnnotations,
10411var finalApplicableCandidates = GetCandidatesPassingFinalValidation(syntax, overloadResolutionResult, receiver, default(ImmutableArray<TypeWithAnnotations>), isExtensionMethodGroup: false, diagnostics);
11165ImmutableArray<TypeWithAnnotations> typeArguments = node.TypeArgumentsOpt;
11492TypeWithAnnotations? returnTypeOverride = null)
11497var returnType = returnTypeOverride ?? methodSymbol.ReturnTypeWithAnnotations;
11577static bool checkConstraints(CSharpCompilation compilation, ConversionsBase conversions, NamedTypeSymbol delegateType, ImmutableArray<TypeWithAnnotations> typeArguments)
Binder\Binder_Patterns.cs (12)
792declType: TypeWithAnnotations.Create(narrowedType, NullableAnnotation.NotAnnotated),
1464TypeWithAnnotations declType = BindType(typeSyntax, diagnostics, out AliasSymbol aliasOpt);
1473TypeWithAnnotations declType,
1532private TypeWithAnnotations BindRecursivePatternType(
1549return TypeWithAnnotations.Create(inputType.StrippedType(), NullableAnnotation.NotAnnotated);
1586TypeWithAnnotations declTypeWithAnnotations = BindRecursivePatternType(typeSyntax, unionType, inputType, diagnostics, ref hasErrors, out BoundTypeExpression? boundDeclType);
1601positionalClause, declType, ImmutableArray<TypeWithAnnotations>.Empty, permitDesignations, ref hasErrors, patternsBuilder, diagnostics, out bool tupleHasUnionMatching);
1764ImmutableArray<TypeWithAnnotations> elementTypesWithAnnotations,
1978var declType = TypeWithState.ForType(inputType).ToTypeWithAnnotations(Compilation);
2021addSubpatternsForTuple(ImmutableArray<TypeWithAnnotations>.Empty, ref hasUnionMatching);
2073void addSubpatternsForTuple(ImmutableArray<TypeWithAnnotations> elementTypes, ref bool hasUnionMatching)
2248typeArgumentsWithAnnotations: default(ImmutableArray<TypeWithAnnotations>),
Binder\Binder_Query.cs (8)
56var typeRestriction = BindTypeArgument(fromClause.Type, diagnostics);
397var castType = BindTypeArgument(join.Type, diagnostics);
823new AnonymousTypeField(fieldName, fieldValue.Syntax.Location, TypeWithAnnotations.Create(TypeOrError(fieldValue)), RefKind.None, ScopedKind.None);
847private UnboundLambda MakeQueryUnboundLambdaWithCast(RangeVariableMap qvm, RangeVariableSymbol parameter, ExpressionSyntax expression, TypeSyntax castTypeSyntax, TypeWithAnnotations castType, bool withDependencies)
885return MakeQueryInvocation(node, receiver, methodName, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), ImmutableArray.Create(arg), diagnostics
898return MakeQueryInvocation(node, receiver, methodName, default(SeparatedSyntaxList<TypeSyntax>), default(ImmutableArray<TypeWithAnnotations>), args, diagnostics
905protected BoundCall MakeQueryInvocation(CSharpSyntaxNode node, BoundExpression receiver, string methodName, TypeSyntax typeArgSyntax, TypeWithAnnotations typeArg, BindingDiagnosticBag diagnostics
918protected BoundCall MakeQueryInvocation(CSharpSyntaxNode node, BoundExpression receiver, string methodName, SeparatedSyntaxList<TypeSyntax> typeArgsSyntax, ImmutableArray<TypeWithAnnotations> typeArgs, ImmutableArray<BoundExpression> args, BindingDiagnosticBag diagnostics
Binder\Binder_Statements.cs (13)
732TypeWithAnnotations declType = BindVariableTypeWithAnnotations(node.Declaration, diagnostics, typeSyntax, ref isConst, isVar: out isVar, alias: out alias);
791private TypeWithAnnotations BindVariableTypeWithAnnotations(CSharpSyntaxNode declarationNode, BindingDiagnosticBag diagnostics, TypeSyntax typeSyntax, ref bool isConst, out bool isVar, out AliasSymbol alias)
804TypeWithAnnotations declType = BindTypeOrVarKeyword(typeSyntax.SkipScoped(out _).SkipRef(), diagnostics, out isVar, out alias);
959TypeWithAnnotations declTypeOpt,
985TypeWithAnnotations declTypeOpt,
1030declTypeOpt = TypeWithAnnotations.Create(initializerType);
1035declTypeOpt = TypeWithAnnotations.Create(CreateErrorType("var"));
1050declTypeOpt = TypeWithAnnotations.Create(CreateErrorType("var"));
1370TypeSymbol pointerType = new PointerTypeSymbol(TypeWithAnnotations.Create(elementType));
1476return op1.SetInferredTypeWithAnnotations(TypeWithAnnotations.Create(inferredType));
2380var targetElementTypes = default(ImmutableArray<TypeWithAnnotations>);
2554ImmutableArray<TypeWithAnnotations> targetElementTypes)
2870TypeWithAnnotations declType = BindTypeOrVarKeyword(typeSyntax, diagnostics, out isVar, out alias);
Binder\Binder_Symbols.cs (38)
39internal TypeWithAnnotations BindTypeOrVarKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out bool isVar)
59private TypeWithAnnotations BindTypeOrConstraintKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out ConstraintContextualKeyword keyword)
80internal TypeWithAnnotations BindTypeOrVarKeyword(TypeSyntax syntax, BindingDiagnosticBag diagnostics, out bool isVar, out AliasSymbol alias)
305internal TypeWithAnnotations BindType(ExpressionSyntax syntax, BindingDiagnosticBag diagnostics, ConsList<TypeSymbol> basesBeingResolved = null, bool suppressUseSiteDiagnostics = false)
314internal TypeWithAnnotations BindType(ExpressionSyntax syntax, BindingDiagnosticBag diagnostics, out AliasSymbol alias, ConsList<TypeSymbol> basesBeingResolved = null)
345return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(GetContainingNamespaceOrNonExtensionType(symbol.Symbol), symbol.Symbol, LookupResultKind.NotATypeOrNamespace, diagnosticInfo));
413/// stack frames due to their use of large struct like <see cref="TypeWithAnnotations"/>.
471return TypeWithAnnotations.Create(
487return TypeWithAnnotations.Create(AreNullableAnnotationsEnabled(tupleTypeSyntax.CloseParenToken), BindTupleType(tupleTypeSyntax, diagnostics, basesBeingResolved));
533void reportNullableReferenceTypesIfNeeded(SyntaxToken questionToken, TypeWithAnnotations typeArgument = default)
555TypeWithAnnotations typeArgument = BindType(typeArgumentSyntax, diagnostics, basesBeingResolved);
556TypeWithAnnotations constructedType = typeArgument.SetIsAnnotated(Compilation);
583return TypeWithAnnotations.Create(AreNullableAnnotationsEnabled(predefinedType.Keyword), type);
596return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(left, LookupResultKind.NotATypeOrNamespace, diagnostics.Add(ErrorCode.ERR_ColColWithTypeAlias, node.Alias.Location, node.Alias.Identifier.Text)));
605var elementType = BindType(node.ElementType, diagnostics, basesBeingResolved);
613return TypeWithAnnotations.Create(new PointerTypeSymbol(elementType));
619return TypeWithAnnotations.Create(CreateErrorType());
623internal static CSDiagnosticInfo? GetNullableUnconstrainedTypeParameterDiagnosticIfNecessary(LanguageVersion languageVersion, in TypeWithAnnotations type)
639private TypeWithAnnotations BindArrayType(
646TypeWithAnnotations type = BindType(node.ElementType, diagnostics, basesBeingResolved);
682type = TypeWithAnnotations.Create(AreNullableAnnotationsEnabled(rankSpecifier.CloseBracketToken), array);
693var types = ArrayBuilder<TypeWithAnnotations>.GetInstance(numElements);
705var argumentType = BindType(argumentSyntax.Type, diagnostics, basesBeingResolved);
846return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(qualifierOpt ?? this.Compilation.Assembly.GlobalNamespace, string.Empty, arity: 0, errorInfo: null));
872return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(
880return TypeWithAnnotations.Create(errorResult);
1163private TypeWithAnnotations BindGenericSimpleNamespaceOrTypeOrAliasSymbol(
1269return TypeWithAnnotations.Create(AreNullableAnnotationsEnabled(node.TypeArgumentList.GreaterThanToken), resultType);
1360private ImmutableArray<TypeWithAnnotations> BindTypeArguments(SeparatedSyntaxList<TypeSyntax> typeArguments, BindingDiagnosticBag diagnostics, ConsList<TypeSymbol> basesBeingResolved = null)
1363var args = ArrayBuilder<TypeWithAnnotations>.GetInstance(typeArguments.Count);
1372private TypeWithAnnotations BindTypeArgument(TypeSyntax typeArgument, BindingDiagnosticBag diagnostics, ConsList<TypeSymbol> basesBeingResolved = null)
1385var arg = typeArgument.Kind() == SyntaxKind.OmittedTypeArgument
1386? TypeWithAnnotations.Create(UnboundArgumentErrorTypeSymbol.Instance)
1395private NamedTypeSymbol ConstructNamedTypeUnlessTypeArgumentOmitted(SyntaxNode typeSyntax, NamedTypeSymbol type, SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax, ImmutableArray<TypeWithAnnotations> typeArguments, BindingDiagnosticBag diagnostics)
1441ImmutableArray<TypeWithAnnotations> typeArguments,
1488ImmutableArray<TypeWithAnnotations> typeArguments, bool invoked, ArrayBuilder<Symbol> members, BindingDiagnosticBag diagnostics)
1635ImmutableArray<TypeWithAnnotations> typeArguments,
1705TypeWithAnnotations type = right.TypeWithAnnotations;
Binder\ForEachLoopBinder.cs (15)
194TypeWithAnnotations inferredType;
227TypeWithAnnotations inferredType;
273TypeWithAnnotations iterationVariableType;
307TypeWithAnnotations declType = BindTypeOrVarKeyword(typeSyntax, diagnostics, out isVar, out alias);
311declType = inferredType.HasType ? inferredType : TypeWithAnnotations.Create(CreateErrorType("var"));
380iterationVariableType = inferredType.HasType ? inferredType : TypeWithAnnotations.Create(CreateErrorType("var"));
628internal TypeWithAnnotations InferCollectionElementType(BindingDiagnosticBag diagnostics, ExpressionSyntax collectionSyntax)
633GetEnumeratorInfoAndInferCollectionElementType(_syntax, collectionSyntax, ref collectionExpr, isAsync: IsAsync, isSpread: false, diagnostics, out TypeWithAnnotations inferredType, builder: out _);
689out TypeWithAnnotations inferredType,
703inferredType = TypeWithAnnotations.Create(DynamicTypeSymbol.Instance);
711inferredType = TypeWithAnnotations.Create(GetSpecialType(SpecialType.System_Char, diagnostics, collectionExpr.Syntax));
1186builder.ElementTypeWithAnnotations = builder.CurrentPropertyGetter?.ReturnTypeWithAnnotations ?? TypeWithAnnotations.Create(GetSpecialType(SpecialType.System_Object, diagnostics, errorLocationSyntax));
1305builder.ElementTypeWithAnnotations = TypeWithAnnotations.Create(
1313TypeWithAnnotations.Create(GetSpecialType(SpecialType.System_Char, diagnostics, syntax)) :
1442var typeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
Binder\Semantics\Conversions\ConversionsBase.cs (45)
1500if (anonymousFunction.HasExplicitReturnType(out var refKind, refCustomModifiers: out _, out var returnType))
1669internal static CollectionExpressionTypeKind GetCollectionExpressionTypeKind(CSharpCompilation compilation, TypeSymbol destination, out TypeWithAnnotations elementType)
1721internal static bool IsSpanOrListType(CSharpCompilation compilation, TypeSymbol targetType, WellKnownType spanType, [NotNullWhen(true)] out TypeWithAnnotations elementType)
1841internal bool HasTopLevelNullabilityIdentityConversion(TypeWithAnnotations source, TypeWithAnnotations destination)
1873internal bool HasTopLevelNullabilityImplicitConversion(TypeWithAnnotations source, TypeWithAnnotations destination)
1893private static bool IsPossiblyNullableTypeTypeParameter(in TypeWithAnnotations typeWithAnnotations)
1904public bool HasAnyNullabilityImplicitConversion(TypeWithAnnotations source, TypeWithAnnotations destination)
1975(ConversionsBase conversions, BoundExpression s, TypeWithAnnotations d, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> u, bool forCast) =>
1992(ConversionsBase conversions, TypeWithAnnotations s, TypeWithAnnotations d, bool _, ref CompoundUseSiteInfo<AssemblySymbol> u, bool _) =>
2295private delegate Conversion ClassifyConversionFromExpressionDelegate(ConversionsBase conversions, BoundExpression sourceExpression, TypeWithAnnotations destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast);
2296private delegate Conversion ClassifyConversionFromTypeDelegate(ConversionsBase conversions, TypeWithAnnotations source, TypeWithAnnotations destination, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, bool forCast);
2310(ConversionsBase conversions, BoundExpression s, TypeWithAnnotations d, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> u, bool forCast)
2328(ConversionsBase conversions, BoundExpression s, TypeWithAnnotations d, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> u, bool forCast) =>
2381(ConversionsBase conversions, TypeWithAnnotations s, TypeWithAnnotations d, bool _, ref CompoundUseSiteInfo<AssemblySymbol> u, bool _) =>
2403(ConversionsBase conversions, TypeWithAnnotations s, TypeWithAnnotations d, bool isChecked, ref CompoundUseSiteInfo<AssemblySymbol> u, bool forCast) =>
2427ImmutableArray<TypeWithAnnotations> sourceTypes;
2428ImmutableArray<TypeWithAnnotations> destTypes;
2612TypeWithAnnotations elementType = source.ElementTypeWithAnnotations;
2613TypeWithAnnotations argument0 = destinationAgg.TypeArgumentWithDefinitionUseSiteDiagnostics(0, ref useSiteInfo);
2623private bool HasImplicitReferenceConversion(TypeWithAnnotations source, TypeWithAnnotations destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3182var typeParameters = ArrayBuilder<TypeWithAnnotations>.GetInstance();
3183var sourceTypeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
3184var destinationTypeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
3198var sourceTypeArgument = sourceTypeArguments[paramIndex];
3199var destinationTypeArgument = destinationTypeArguments[paramIndex];
3435bool hasConversion(RefKind refKind, TypeWithAnnotations sourceType, TypeWithAnnotations destinationType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3986var spanElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
3993var spanElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
4003var sourceElementType = ((NamedTypeSymbol)source).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
4004var destinationElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
4013var spanElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
4020bool hasCovariantConversion(TypeWithAnnotations source, TypeWithAnnotations destination, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
4026bool hasIdentityConversion(TypeWithAnnotations source, TypeWithAnnotations destination)
4049var spanElementType = ((NamedTypeSymbol)destination).TypeArgumentsWithDefinitionUseSiteDiagnostics(ref useSiteInfo)[0];
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (173)
73public readonly ImmutableArray<TypeWithAnnotations> InferredTypeArguments;
82ImmutableArray<TypeWithAnnotations> inferredTypeArguments,
97internal abstract TypeWithAnnotations GetTypeWithAnnotations(BoundExpression expr);
99internal abstract TypeWithAnnotations GetMethodGroupResultType(BoundMethodGroup group, MethodSymbol method);
103internal override TypeWithAnnotations GetTypeWithAnnotations(BoundExpression expr)
105return TypeWithAnnotations.Create(expr.GetTypeOrFunctionType());
108internal override TypeWithAnnotations GetMethodGroupResultType(BoundMethodGroup group, MethodSymbol method)
138private readonly ImmutableArray<TypeWithAnnotations> _formalParameterTypes;
147private readonly (TypeWithAnnotations Type, bool FromFunctionType)[] _fixedResults;
148private readonly HashSet<TypeWithAnnotations>[] _exactBounds;
149private readonly HashSet<TypeWithAnnotations>[] _upperBounds;
150private readonly HashSet<TypeWithAnnotations>[] _lowerBounds;
180ImmutableArray<TypeWithAnnotations> formalParameterTypes,
329ImmutableArray<TypeWithAnnotations> formalParameterTypes,
349_fixedResults = new (TypeWithAnnotations, bool)[methodTypeParameters.Length];
350_exactBounds = new HashSet<TypeWithAnnotations>[methodTypeParameters.Length];
351_upperBounds = new HashSet<TypeWithAnnotations>[methodTypeParameters.Length];
352_lowerBounds = new HashSet<TypeWithAnnotations>[methodTypeParameters.Length];
419var fixedType = _fixedResults[i].Type;
447private ImmutableArray<TypeWithAnnotations> GetResults(out bool inferredFromFunctionType)
467var fixedResultType = _fixedResults[i].Type;
485_fixedResults[i] = (TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(_constructedContainingTypeOfMethod, _methodTypeParameters[i].Name, 0, null, false)), false);
502private bool IsUnfixedTypeParameter(TypeWithAnnotations type)
537private void AddBound(TypeWithAnnotations addedBound, HashSet<TypeWithAnnotations>[] collectedBounds, TypeWithAnnotations methodTypeParameterWithAnnotations)
546collectedBounds[methodTypeParameterIndex] = new HashSet<TypeWithAnnotations>(TypeWithAnnotations.EqualsComparer.ConsiderEverythingComparer);
572static (typeParameter, i, self) => self.IsUnfixed(i) ? TypeWithAnnotations.Create(typeParameter) : self._fixedResults[i].Type,
614TypeWithAnnotations target = _formalParameterTypes[arg];
622private void MakeExplicitParameterTypeInferences(Binder binder, BoundExpression argument, TypeWithAnnotations target, ExactOrBoundsKind kind, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
650var argumentType = _extensions.GetTypeWithAnnotations(argument);
666TypeWithAnnotations target,
682if (!binder.TryGetCollectionIterationType((ExpressionSyntax)argument.Syntax, targetType.StrippedType(), out TypeWithAnnotations targetElementType))
702TypeWithAnnotations target,
721private bool MakeExplicitParameterTypeInferences(Binder binder, BoundTupleLiteral argument, TypeWithAnnotations target, ExactOrBoundsKind kind, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
753var destType = destTypes[i];
871var formalType = _formalParameterTypes[arg];
877private void MakeOutputTypeInferences(Binder binder, BoundExpression argument, TypeWithAnnotations formalType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
900private void MakeOutputTypeInferences(Binder binder, BoundUnconvertedCollectionExpression argument, TypeWithAnnotations formalType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
907if (!binder.TryGetCollectionIterationType((ExpressionSyntax)argument.Syntax, formalType.Type, out TypeWithAnnotations targetElementType))
921private void MakeOutputTypeInferences(Binder binder, BoundTupleLiteral argument, TypeWithAnnotations formalType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
946var destType = destTypes[i];
1369private void OutputTypeInference(Binder binder, BoundExpression expression, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1394var sourceType = _extensions.GetTypeWithAnnotations(expression);
1402private bool InferredReturnTypeInference(BoundExpression source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1420var returnType = delegateType.DelegateInvokeMethod.ReturnTypeWithAnnotations;
1426var inferredReturnType = InferReturnType(source, delegateType, ref useSiteInfo);
1475TypeWithAnnotations sourceReturnType = method.ReturnTypeWithAnnotations;
1494var returnType = MethodGroupReturnType(binder, originalMethodGroup, fixedParameters, method.RefKind, isFunctionPointerResolution, ref useSiteInfo, in callingConventionInfo);
1504private TypeWithAnnotations MethodGroupReturnType(
1525TypeWithAnnotations type = default;
1547private void ExplicitParameterTypeInference(BoundExpression source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1602private void ExplicitReturnTypeInference(BoundExpression source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1619if (!anonymousFunction.HasExplicitReturnType(out _, out _, out TypeWithAnnotations anonymousFunctionReturnType))
1638private void ExactInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1692private bool ExactTypeParameterInference(TypeWithAnnotations source, TypeWithAnnotations target)
1707private bool ExactArrayInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1757var sourceElementType = GetSpanOrSZArrayElementType(source);
1758var targetElementType = GetSpanElementType(target);
1766private static TypeWithAnnotations GetSpanElementType(TypeSymbol type)
1772private static TypeWithAnnotations GetSpanOrSZArrayElementType(TypeSymbol type)
1786private void ExactOrBoundsInference(ExactOrBoundsKind kind, TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1802private bool ExactOrBoundsNullableInference(ExactOrBoundsKind kind, TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1822static bool isNullableOnly(TypeWithAnnotations type)
1826private bool ExactNullableInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1831private bool LowerBoundTupleInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1840ImmutableArray<TypeWithAnnotations> sourceTypes;
1841ImmutableArray<TypeWithAnnotations> targetTypes;
1858private bool ExactConstructedInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1888private bool ExactPointerInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
1948var sourceTypeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
1949var targetTypeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
1969private void LowerBoundInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2063private bool LowerBoundTypeParameterInference(TypeWithAnnotations source, TypeWithAnnotations target)
2078private static TypeWithAnnotations GetMatchingElementType(ArrayTypeSymbol source, TypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2132var elementSource = arraySource.ElementTypeWithAnnotations;
2133var elementTarget = GetMatchingElementType(arraySource, target, ref useSiteInfo);
2169var sourceElementType = GetSpanOrSZArrayElementType(source);
2170var targetElementType = GetSpanElementType(target);
2189private bool LowerBoundNullableInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2391var sourceTypeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
2392var targetTypeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
2404var sourceTypeArgument = sourceTypeArguments[arg];
2405var targetTypeArgument = targetTypeArguments[arg];
2478private void UpperBoundInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2539private bool UpperBoundTypeParameterInference(TypeWithAnnotations source, TypeWithAnnotations target)
2553private bool UpperBoundArrayInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2571var elementTarget = arrayTarget.ElementTypeWithAnnotations;
2572var elementSource = GetMatchingElementType(arrayTarget, source.Type, ref useSiteInfo);
2590private bool UpperBoundNullableInference(TypeWithAnnotations source, TypeWithAnnotations target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2595private bool UpperBoundConstructedInference(TypeWithAnnotations sourceWithAnnotations, TypeWithAnnotations targetWithAnnotations, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
2741var sourceTypeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
2742var targetTypeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
2754var sourceTypeArgument = sourceTypeArguments[arg];
2755var targetTypeArgument = targetTypeArguments[arg];
2848var withoutNullability = Fix(_compilation, _conversions.WithNullability(false), typeParameter, exact, lower, upper, ref discardedUseSiteInfo).Type;
2860private static (TypeWithAnnotations Type, bool FromFunctionType) Fix(
2864HashSet<TypeWithAnnotations>? exact,
2865HashSet<TypeWithAnnotations>? lower,
2866HashSet<TypeWithAnnotations>? upper,
2881var candidates = new Dictionary<TypeWithAnnotations, TypeWithAnnotations>(EqualsIgnoringDynamicTupleNamesAndNullabilityComparer.Instance);
2886Predicate<TypeWithAnnotations> lowerPredicate;
2931var initialCandidates = ArrayBuilder<TypeWithAnnotations>.GetInstance();
2956TypeWithAnnotations best = default;
2957foreach (var candidate in initialCandidates)
2959foreach (var candidate2 in initialCandidates)
2998best = TypeWithAnnotations.Create(resultType, best.NullableAnnotation);
3004static bool containsFunctionTypes([NotNullWhen(true)] HashSet<TypeWithAnnotations>? types)
3009static bool containsNonFunctionTypes([NotNullWhen(true)] HashSet<TypeWithAnnotations>? types)
3014static bool isFunctionType(TypeWithAnnotations type, [NotNullWhen(true)] out FunctionTypeSymbol? functionType)
3040private static bool ImplicitConversionExists(TypeWithAnnotations sourceWithAnnotations, TypeWithAnnotations destinationWithAnnotations, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, ConversionsBase conversions)
3060private TypeWithAnnotations InferReturnType(BoundExpression source, NamedTypeSymbol target, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
3141var returnType = anonymousFunction.InferReturnType(_conversions, fixedDelegate, ref useSiteInfo, out bool inferredFromFunctionType);
3187public static ImmutableArray<TypeWithAnnotations> InferTypeArgumentsFromReceiverType(
3240public static ImmutableArray<TypeWithAnnotations> InferTypeArgumentsFromFirstArgument(
3305var dest = _formalParameterTypes[0];
3337private ImmutableArray<TypeWithAnnotations> GetInferredTypeArguments(out bool inferredFromFunctionType)
3339var builder = ArrayBuilder<TypeWithAnnotations>.GetInstance(_fixedResults.Length);
3359private static void GetAllCandidates(Dictionary<TypeWithAnnotations, TypeWithAnnotations> candidates, ArrayBuilder<TypeWithAnnotations> builder)
3372Dictionary<TypeWithAnnotations, TypeWithAnnotations> candidates,
3373HashSet<TypeWithAnnotations> bounds,
3374Predicate<TypeWithAnnotations>? predicate,
3378foreach (var candidate in bounds)
3385var type = candidate;
3401Dictionary<TypeWithAnnotations, TypeWithAnnotations> candidates,
3402TypeWithAnnotations newCandidate,
3405if (candidates.TryGetValue(newCandidate, out TypeWithAnnotations oldCandidate))
3416Dictionary<TypeWithAnnotations, TypeWithAnnotations> candidates,
3417HashSet<TypeWithAnnotations> bounds,
3418Predicate<TypeWithAnnotations>? predicate,
3419ArrayBuilder<TypeWithAnnotations> initialCandidates,
3428foreach (var bound in bounds)
3435foreach (var candidate in initialCandidates)
3441TypeWithAnnotations source;
3442TypeWithAnnotations destination;
3456if (conversions.IncludeNullability && candidates.TryGetValue(bound, out var oldBound))
3463var newBound = TypeWithAnnotations.Create(oldBound.Type, newAnnotation);
3483Dictionary<TypeWithAnnotations, TypeWithAnnotations> candidates,
3484TypeWithAnnotations oldCandidate,
3485TypeWithAnnotations newCandidate,
3494if (candidates.TryGetValue(oldCandidate, out TypeWithAnnotations latest))
3505TypeWithAnnotations merged = latest.MergeEquivalentTypes(newCandidate, variance);
3514private sealed class EqualsIgnoringDynamicTupleNamesAndNullabilityComparer : EqualityComparer<TypeWithAnnotations>
3518public override int GetHashCode(TypeWithAnnotations obj)
3523public override bool Equals(TypeWithAnnotations x, TypeWithAnnotations y)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (40)
139ArrayBuilder<TypeWithAnnotations> typeArguments,
175ArrayBuilder<TypeWithAnnotations> typeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
187ArrayBuilder<TypeWithAnnotations> typeArguments,
240var typeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance(0);
354ArrayBuilder<TypeWithAnnotations> typeArguments,
430ArrayBuilder<TypeWithAnnotations> typeArguments,
564var typeArgumentsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance();
950if (IsValidParams(_binder, constructor, disallowExpandedNonArrayParams: false, out TypeWithAnnotations definitionElementType))
1013TypeWithAnnotations definitionParamsElementType,
1062ArrayBuilder<TypeWithAnnotations> typeArguments,
1197if ((options & (Options.IsMethodGroupConversion | Options.DisallowExpandedForm)) == 0 && IsValidParams(_binder, leastOverriddenMember, disallowExpandedNonArrayParams, out TypeWithAnnotations definitionElementType))
1304public static bool IsValidParams(Binder binder, Symbol member, bool disallowExpandedNonArrayParams, out TypeWithAnnotations definitionElementType)
1332public static bool TryInferParamsCollectionIterationType(Binder binder, TypeSymbol type, out TypeWithAnnotations elementType)
2578TypeWithAnnotations paramsElementTypeOpt, TMember member, out RefKind parameterRefKind)
3229CollectionExpressionTypeKind kind1 = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, t1, out TypeWithAnnotations elementType1);
3230CollectionExpressionTypeKind kind2 = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, t2, out TypeWithAnnotations elementType2);
3257if (type.IsArrayInterface(out TypeWithAnnotations typeArg))
3301var x = lambda.GetInferredReturnType(ref useSiteInfo, out _);
3752var x = lambda.InferReturnType(Conversions, d1, ref useSiteInfo, out _);
3861out ImmutableArray<TypeWithAnnotations> parameterTypes,
3877internal readonly ImmutableArray<TypeWithAnnotations> ParameterTypes;
3881internal EffectiveParameters(ImmutableArray<TypeWithAnnotations> types, ImmutableArray<RefKind> refKinds, int firstParamsElementIndex)
3926var types = ArrayBuilder<TypeWithAnnotations>.GetInstance();
4063var types = ArrayBuilder<TypeWithAnnotations>.GetInstance();
4069TypeWithAnnotations paramsIterationType = default;
4076var type = parameter.TypeWithAnnotations;
4112ArrayBuilder<TypeWithAnnotations> typeArguments,
4190ArrayBuilder<TypeWithAnnotations> typeArguments,
4192TypeWithAnnotations definitionParamsElementType,
4253ArrayBuilder<TypeWithAnnotations> typeArgumentsBuilder,
4257TypeWithAnnotations definitionParamsElementTypeOpt,
4276ImmutableArray<TypeWithAnnotations> typeArguments;
4395static ImmutableArray<TypeWithAnnotations> getAllTypeArguments(TMember member, bool isExtensionBlockMember)
4415private ImmutableArray<TypeWithAnnotations> InferMethodTypeArguments<TMember>(
4482return default(ImmutableArray<TypeWithAnnotations>);
4488return default(ImmutableArray<TypeWithAnnotations>);
4494TypeWithAnnotations definitionParamsElementTypeOpt,
4506TypeWithAnnotations paramsElementTypeOpt;
4512paramsElementTypeOpt = TypeWithAnnotations.Create(ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel);
BoundTree\Constructors.cs (5)
484public BoundTypeExpression(SyntaxNode syntax, AliasSymbol? aliasOpt, BoundTypeExpression? boundContainingTypeOpt, ImmutableArray<BoundExpression> boundDimensionsOpt, TypeWithAnnotations typeWithAnnotations, bool hasErrors = false)
490public BoundTypeExpression(SyntaxNode syntax, AliasSymbol? aliasOpt, BoundTypeExpression? boundContainingTypeOpt, TypeWithAnnotations typeWithAnnotations, bool hasErrors = false)
495public BoundTypeExpression(SyntaxNode syntax, AliasSymbol? aliasOpt, TypeWithAnnotations typeWithAnnotations, bool hasErrors = false)
501: this(syntax, aliasOpt, null, TypeWithAnnotations.Create(type), hasErrors)
505public BoundTypeExpression(SyntaxNode syntax, AliasSymbol? aliasOpt, ImmutableArray<BoundExpression> dimensionsOpt, TypeWithAnnotations typeWithAnnotations, bool hasErrors = false)
BoundTree\UnboundLambda.cs (68)
45internal readonly TypeWithAnnotations TypeWithAnnotations;
56TypeWithAnnotations typeWithAnnotations,
109public TypeWithAnnotations GetInferredReturnType(ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool inferredFromFunctionType)
123public TypeWithAnnotations GetInferredReturnType(ConversionsBase? conversions, NullableWalker.VariableState? nullableState, NullableWalker.GetterNullResilienceData? getterNullResilienceData, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool inferredFromFunctionType)
153var returnTypes = ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)>.GetInstance();
179TypeWithAnnotations returnType,
180ImmutableArray<TypeWithAnnotations> parameterTypes,
197internal static InferredLambdaReturnType InferReturnType(ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)> returnTypes,
204internal static InferredLambdaReturnType InferReturnType(ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)> returnTypes,
214private static InferredLambdaReturnType InferReturnTypeImpl(ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)> returnTypes,
217var types = ArrayBuilder<(BoundExpression expr, TypeWithAnnotations resultType, bool isChecked)>.GetInstance();
239var bestType = CalculateReturnType(binder, conversions, delegateType, types, isAsync, node, ref useSiteInfo, out bool inferredFromFunctionType);
257private static TypeWithAnnotations CalculateReturnType(
261ArrayBuilder<(BoundExpression expr, TypeWithAnnotations resultType, bool isChecked)> returns,
267TypeWithAnnotations bestResultType;
293bestResultType = TypeWithAnnotations.Create(bestType);
305bestResultType = TypeWithAnnotations.Create(bestType);
335return TypeWithAnnotations.Create(resultType);
350return TypeWithAnnotations.Create(taskTypeT.Construct(ImmutableArray.Create(bestResultType)));
355private readonly ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)> _builder;
357private BlockReturns(ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)> builder)
362public static void GetReturnTypes(ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)> builder, BoundBlock block)
395_builder.Add((node, TypeWithAnnotations.Create(type)));
412TypeWithAnnotations returnType,
416ImmutableArray<TypeWithAnnotations> types,
480public bool HasExplicitReturnType(out RefKind refKind, out ImmutableArray<CustomModifier> refCustomModifiers, out TypeWithAnnotations returnType)
502public TypeWithAnnotations InferReturnType(ConversionsBase conversions, NamedTypeSymbol delegateType, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo, out bool inferredFromFunctionType)
512public TypeWithAnnotations ParameterTypeWithAnnotations(int index) { return Data.ParameterTypeWithAnnotations(index); }
595public abstract bool HasExplicitReturnType(out RefKind refKind, out ImmutableArray<CustomModifier> refCustomModifiers, out TypeWithAnnotations returnType);
601public abstract TypeWithAnnotations ParameterTypeWithAnnotations(int index);
654var type = lambda.InferredReturnType.TypeWithAnnotations;
664var type = BindForErrorRecovery().InferredReturnType.TypeWithAnnotations;
677private static TypeWithAnnotations DelegateReturnTypeWithAnnotations(MethodSymbol? invokeMethod, out RefKind refKind, out ImmutableArray<CustomModifier> refCustomModifiers)
690internal (ImmutableArray<RefKind>, ArrayBuilder<ScopedKind>, ImmutableArray<TypeWithAnnotations>, bool) CollectParameterProperties()
694var parameterTypesBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(ParameterCount);
701var type = ParameterTypeWithAnnotations(i);
757if (!HasExplicitReturnType(out var returnRefKind, refCustomModifiers: out _, out var returnType))
761var returnTypes = ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)>.GetInstance();
805returnType = TypeWithAnnotations.Create(Binder.Compilation.GetSpecialType(SpecialType.System_Void));
823var returnType = DelegateReturnTypeWithAnnotations(invokeMethod, out RefKind refKind, out ImmutableArray<CustomModifier> refCustomModifiers);
934TypeWithAnnotations returnType,
935ImmutableArray<TypeWithAnnotations> parameterTypes,
953var returnType = DelegateReturnTypeWithAnnotations(invokeMethod, out RefKind refKind, out ImmutableArray<CustomModifier> refCustomModifiers);
958private void ValidateUnsafeParameters(BindingDiagnosticBag diagnostics, ImmutableArray<TypeWithAnnotations> targetParameterTypes)
985ImmutableArray<TypeWithAnnotations> parameterTypes,
988bool hasExplicitReturnType = HasExplicitReturnType(out var refKind, out ImmutableArray<CustomModifier> refCustomModifiers, out var returnType);
1008var returnTypes = ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)>.GetInstance();
1023? TypeWithAnnotations.Create(this.Binder.Compilation.GetSpecialType(SpecialType.System_Void))
1024: TypeWithAnnotations.Create(LambdaSymbol.InferenceFailureReturnType);
1051ImmutableArray<TypeWithAnnotations> parameterTypes,
1053TypeWithAnnotations returnType,
1090public readonly ImmutableArray<TypeWithAnnotations> ParameterTypes;
1094public static readonly ReturnInferenceCacheKey Empty = new ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations>.Empty, ImmutableArray<RefKind>.Empty, null);
1096private ReturnInferenceCacheKey(ImmutableArray<TypeWithAnnotations> parameterTypes, ImmutableArray<RefKind> parameterRefKinds, NamedTypeSymbol? taskLikeReturnTypeOpt)
1136foreach (var type in ParameterTypes)
1156out ImmutableArray<TypeWithAnnotations> parameterTypes,
1162parameterTypes = ImmutableArray<TypeWithAnnotations>.Empty;
1171var typesBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(parameterCount);
1248?? rebind(ReallyInferReturnType(delegateType: null, ImmutableArray<TypeWithAnnotations>.Empty, ImmutableArray<RefKind>.Empty));
1264ImmutableArray<TypeWithAnnotations> parameterTypes,
1267var returnType = inferredReturnType.TypeWithAnnotations;
1281returnType = TypeWithAnnotations.Create(t);
1498private readonly TypeWithAnnotations _returnType;
1502private readonly ImmutableArray<TypeWithAnnotations> _parameterTypesWithAnnotations;
1514TypeWithAnnotations returnType,
1518ImmutableArray<TypeWithAnnotations> parameterTypesWithAnnotations,
1545public override bool HasExplicitReturnType(out RefKind refKind, out ImmutableArray<CustomModifier> refCustomModifiers, out TypeWithAnnotations returnType)
1624public override TypeWithAnnotations ParameterTypeWithAnnotations(int index)
Compilation\CSharpCompilation.cs (10)
2349var firstType = method.Parameters[0].TypeWithAnnotations;
2483return ArrayTypeSymbol.CreateCSharpArray(this.Assembly, TypeWithAnnotations.Create(elementType, elementNullableAnnotation), rank);
2496return new PointerTypeSymbol(TypeWithAnnotations.Create(elementType, elementNullableAnnotation));
4304var returnTypeWithAnnotations = TypeWithAnnotations.Create(returnType.EnsureCSharpSymbolOrNull(nameof(returnType)), returnType.NullableAnnotation.ToInternalAnnotation());
4306type => TypeWithAnnotations.Create(type.EnsureCSharpSymbolOrNull(nameof(parameterTypes)), type.NullableAnnotation.ToInternalAnnotation()));
4354var typesBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(elementTypes.Length);
4360typesBuilder.Add(TypeWithAnnotations.Create(elementType, annotation));
4398(t, a) => TypeWithAnnotations.Create(t.Type, a.ToInternalAnnotation())));
4428fields.Add(new AnonymousTypeField(name, location, TypeWithAnnotations.Create(type, nullableAnnotation), RefKind.None, ScopedKind.None));
FlowAnalysis\NullableWalker.cs (228)
119public readonly TypeWithAnnotations LValueType;
130public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType)
139public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, Optional<LocalState> stateForLambda)
148LValueType = TypeWithAnnotations.Create(type, annotation);
156public VisitResult(TypeWithState rValueType, TypeWithAnnotations lValueType, VisitResult[] nestedVisitResults)
162internal VisitResult WithLValueType(TypeWithAnnotations lvalueType)
229private ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)>? _returnTypesOpt;
267private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>? _targetTypedAnalysisCompletionOpt;
272/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional<LocalState>,bool, int, Location, ArrayBuilder<VisitResult>)"/>.
274private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>> TargetTypedAnalysisCompletion
275=> _targetTypedAnalysisCompletionOpt ??= PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>.GetInstance();
340private TypeWithAnnotations LvalueResultType
345private void SetLvalueResultType(BoundExpression? expression, TypeWithAnnotations type)
360private void SetResult(BoundExpression? expression, TypeWithState resultType, TypeWithAnnotations lvalueType, bool updateAnalyzedNullability = true, bool? isLvalue = null)
380private void SetAnalyzedNullability(BoundExpression? expression, TypeWithState resultType, TypeWithAnnotations lvalueType, bool? isLvalue = null)
508ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)>? returnTypesOpt,
775TypeWithAnnotations symbolType;
894var type = GetTypeOrReturnTypeWithAnnotations(memberToInitialize);
1081var symbolType = ApplyUnconditionalAnnotations(property.TypeWithAnnotations, symbolAnnotations);
1088var overriddenType = ApplyUnconditionalAnnotations(overriddenProperty.TypeWithAnnotations, overriddenAnnotations);
1820ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)>? returnTypesOpt,
1869ArrayBuilder<(BoundReturnStatement, TypeWithAnnotations)>? returnTypesOpt,
2053if (!_variables.TryGetType(local, out TypeWithAnnotations localType))
2061if (!_variables.TryGetType(parameter, out TypeWithAnnotations parameterType))
2380private TypeWithAnnotations VisitLvalueWithAnnotations(BoundExpression node)
2421private static bool ShouldReportNullableAssignment(TypeWithAnnotations type, NullableFlowState state)
2457TypeWithAnnotations targetType,
2530TypeWithAnnotations overriddenType,
2532TypeWithAnnotations overridingType,
2603static bool isBadAssignment(TypeWithState valueState, TypeWithAnnotations destinationType, FlowAnalysisAnnotations destinationAnnotations)
2679TypeWithAnnotations targetType,
2722static bool areEquivalentTypes(TypeWithAnnotations target, TypeWithState assignedValue) =>
2793TypeWithAnnotations fieldOrPropertyType = GetTypeOrReturnTypeWithAnnotations(member);
2920private TypeWithAnnotations GetTypeOrReturnTypeWithAnnotations(Symbol symbol)
2922var typeWithAnnotations = symbol.GetTypeOrReturnType();
2949typeWithAnnotations = TypeWithAnnotations.Create(typeWithAnnotations.Type, nullableAnnotation);
3031var parameterType = i >= signatureParameters.Length ? parameter.TypeWithAnnotations : signatureParameters[i].TypeWithAnnotations;
3037private void EnterParameter(ParameterSymbol parameter, TypeWithAnnotations parameterType)
3066var parameterLValueType = ApplyLValueAnnotations(parameter.TypeWithAnnotations, parameterAnnotations);
3082internal static TypeWithState GetParameterState(TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations)
3112TryGetReturnType(out TypeWithAnnotations returnType, out FlowAnalysisAnnotations returnAnnotations))
3171private TypeWithState VisitRefExpression(BoundExpression expr, TypeWithAnnotations destinationType)
3177var lvalueResultType = LvalueResultType;
3193private bool TryGetReturnType(out TypeWithAnnotations type, out FlowAnalysisAnnotations annotations)
3204var returnType = delegateOrMethod.ReturnTypeWithAnnotations;
3247var type = GetDeclaredLocalResult(local);
3255type = TypeWithAnnotations.Create(node.Type, type.NullableAnnotation);
3610var resultType = ResultType.ToTypeWithAnnotations(compilation);
3736TypeWithAnnotations type = local.TypeWithAnnotations;
3948var elementConversionCompletions = ArrayBuilder<Action<TypeWithAnnotations /*targetElementType*/, TypeSymbol /*targetCollectionType*/>>.GetInstance();
3960(TypeWithAnnotations resultTypeWithAnnotations) => convertCollection(
3970var resultType = TypeWithAnnotations.Create(node.Type);
4087void visitElement(BoundNode element, BoundCollectionExpression node, TypeWithAnnotations targetElementType, ArrayBuilder<Action<TypeWithAnnotations, TypeSymbol>> elementConversionCompletions)
4180TypeWithAnnotations targetCollectionType,
4182ArrayBuilder<Action<TypeWithAnnotations, TypeSymbol>> completions)
4235(CollectionExpressionTypeKind, TypeWithAnnotations) getCollectionDetails(BoundCollectionExpression node, TypeSymbol collectionType)
4237var collectionKind = ConversionsBase.GetCollectionExpressionTypeKind(this.compilation, collectionType, out var targetElementType);
4356(TypeWithAnnotations resultTypeWithAnnotations) =>
4436var parameterType = constructor.ParameterTypesWithAnnotations[0];
4437if (AreNullableAndUnderlyingTypes(type, parameterType.Type, out TypeWithAnnotations underlyingType))
4792InitializerCompletionAfterUpdatedSymbol? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null)
4803var type = ApplyLValueAnnotations(GetTypeOrReturnTypeWithAnnotations(symbol), GetObjectInitializerMemberLValueAnnotations(symbol));
4825InitializerCompletionAfterUpdatedSymbol? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion)
4960var lvalueType = resultType.ToTypeWithAnnotations(compilation);
5012return GetOrCreatePlaceholderSlot(node, TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated));
5015private int GetOrCreatePlaceholderSlot(object identifier, TypeWithAnnotations type)
5117var elementType = type switch
5165TypeWithAnnotations inferredType = (bestType is null)
5167: TypeWithAnnotations.Create(bestType);
5206static TypeWithAnnotations getSpanElementType(NamedTypeSymbol namedType)
5213static TypeSymbol setSpanElementType(NamedTypeSymbol namedType, TypeWithAnnotations elementType)
5242internal static TypeWithAnnotations BestTypeForLambdaReturns(
5243ArrayBuilder<(BoundExpression expr, TypeWithAnnotations resultType, bool isChecked)> returns,
5266var resultTypes = ArrayBuilder<TypeWithAnnotations>.GetInstance(n);
5279TypeWithAnnotations inferredType;
5283var bestTypeWithObliviousAnnotation = TypeWithAnnotations.Create(bestType);
5295inferredType = TypeWithAnnotations.Create(bestType, BestTypeInferrer.GetNullableAnnotation(resultTypes));
5342TypeWithAnnotations result;
5346result = TypeWithAnnotations.Create(type);
5369TypeWithAnnotations type = expressionType.TryGetInlineArrayElementField()!.TypeWithAnnotations;
5373type = TypeWithAnnotations.Create(((NamedTypeSymbol)node.Type).OriginalDefinition.Construct(ImmutableArray.Create(type)));
5598SetResult(binary, TypeWithState.ForType(binary.Type), TypeWithAnnotations.Create(binary.Type));
5673TypeWithAnnotations.Create(expr.Type),
5775var targetTypeWithNullability = ApplyLValueAnnotations(parameter.TypeWithAnnotations, parameterAnnotations);
5779targetTypeWithNullability = TypeWithAnnotations.Create(MakeNullableOf(targetTypeWithNullability));
6152TypeWithAnnotations targetType = VisitLvalueWithAnnotations(leftOperand);
6170targetType = TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated);
6263TypeWithAnnotations.Create(rightType),
6299TypeWithAnnotations explicitType = boundConversion.ConversionGroupOpt?.ExplicitType ?? default;
6301TypeWithAnnotations targetType = fromExplicitCast ? explicitType : TypeWithAnnotations.Create(boundConversion.Type);
6440var accessTypeWithAnnotations = LvalueResultType;
6496TypeWithAnnotations consequenceLValue;
6497TypeWithAnnotations alternativeLValue;
6517var refResultTypeWithAnnotations = TypeWithAnnotations.Create(refResultType, lValueAnnotation);
6526SetResult(node, TypeWithState.Create(refResultType, rValueState), TypeWithAnnotations.Create(refResultType, lValueAnnotation));
6577TypeWithAnnotations resultTypeWithAnnotations;
6598resultTypeWithAnnotations = TypeWithAnnotations.Create(resultType);
6611BoundExpression alternative, Conversion alternativeConversion, bool alternativeEndReachable, TypeWithAnnotations resultTypeWithAnnotations, bool wasTargetTyped)
6668(TypeWithAnnotations resultTypeWithAnnotations) =>
6690(TypeWithAnnotations LValueType, TypeWithState RValueType) visitConditionalRefOperand(LocalState state, BoundExpression operand)
6694TypeWithAnnotations lValueType = VisitLvalueWithAnnotations(operand);
6698void reportMismatchIfNecessary(BoundExpression node, TypeWithAnnotations source, TypeWithAnnotations destination)
6711TypeWithAnnotations targetType,
6759private static BoundExpression CreatePlaceholderIfNecessary(BoundExpression expr, TypeWithAnnotations type)
6857TypeWithAnnotations paramsIterationType = default;
6926var type = TypeWithAnnotations.Create(node.Type);
7158var parameterType = method.Parameters[0].TypeWithAnnotations;
7423private static TypeWithAnnotations ApplyLValueAnnotations(TypeWithAnnotations declaredType, FlowAnalysisAnnotations flowAnalysisAnnotations)
7455private static TypeWithAnnotations ApplyUnconditionalAnnotations(TypeWithAnnotations declaredType, FlowAnalysisAnnotations annotations)
7665TypeWithAnnotations paramsIterationType = default;
7672(ParameterSymbol? parameter, TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations, bool isExpandedParamsArgument) =
7742TypeWithAnnotations paramsIterationType = default;
7748(ParameterSymbol? parameter, TypeWithAnnotations parameterType, FlowAnalysisAnnotations parameterAnnotations, _) =
7896completion(TypeWithAnnotations.Create(argument.Type));
8108TypeWithAnnotations paramsIterationType = default;
8118TypeWithAnnotations paramsIterationType = default;
8197TypeWithAnnotations parameterType,
8252var lvalueResultType = result.LValueType;
8335TypeWithAnnotations parameterType,
8365var lValueType = result.LValueType;
8389var declaredType = result.LValueType;
8391var lValueType = ApplyLValueAnnotations(declaredType, leftAnnotations);
8394var varType = worstCaseParameterWithState.ToAnnotatedTypeWithAnnotations(compilation);
8448void trackNullableStateForAssignment(TypeSymbol? receiverType, BoundExpression parameterValue, TypeWithAnnotations lValueType, int targetSlot, TypeWithState parameterWithState, bool isSuppressed, FlowAnalysisAnnotations parameterAnnotations, RefKind refKind, ParameterSymbol parameter)
8650private (ParameterSymbol? Parameter, TypeWithAnnotations Type, FlowAnalysisAnnotations Annotations, bool isExpandedParamsArgument) GetCorrespondingParameter(
8655ref TypeWithAnnotations paramsIterationType)
8669var type = parameter.TypeWithAnnotations;
8717parameterTypes: out ImmutableArray<TypeWithAnnotations> parameterTypes,
8800internal override TypeWithAnnotations GetTypeWithAnnotations(BoundExpression expr)
8802return TypeWithAnnotations.Create(expr.GetTypeOrFunctionType(), GetNullableAnnotation(expr));
8833internal override TypeWithAnnotations GetMethodGroupResultType(BoundMethodGroup group, MethodSymbol method)
8912var argumentType = visitResult.RValueType.ToTypeWithAnnotations(compilation);
9233TypeWithAnnotations explicitType = node.ConversionGroupOpt?.ExplicitType ?? default;
9235TypeWithAnnotations targetType = fromExplicitCast ? explicitType : TypeWithAnnotations.Create(node.Type);
9273private TypeWithState VisitOptionalImplicitConversion(BoundExpression expr, TypeWithAnnotations targetTypeOpt, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind)
9285private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion(
9287TypeWithAnnotations targetTypeOpt,
9299(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion(
9301TypeWithAnnotations targetTypeOpt,
9336Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType)
9338return (TypeWithAnnotations targetTypeOpt) =>
9347private static bool AreNullableAndUnderlyingTypes([NotNullWhen(true)] TypeSymbol? nullableTypeOpt, [NotNullWhen(true)] TypeSymbol? underlyingTypeOpt, out TypeWithAnnotations underlyingTypeWithAnnotations)
9352var typeArg = nullableTypeOpt.GetNullableUnderlyingTypeWithAnnotations();
9387ImmutableArray<TypeWithAnnotations> elementTypesWithAnnotations = elementTypes.SelectAsArray(a => a.ToTypeWithAnnotations(compilation));
9802TypeWithAnnotations targetTypeWithNullability,
9825if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion))
10052if (AreNullableAndUnderlyingTypes(targetType, operandType.Type, out TypeWithAnnotations underlyingType))
10214static TypeWithState calculateResultType(TypeWithAnnotations targetTypeWithNullability, bool fromExplicitCast, NullableFlowState resultState, bool isSuppressed, TypeSymbol targetType)
10230static NullableFlowState getReferenceConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType)
10264static NullableFlowState getBoxingConversionResultState(TypeWithAnnotations targetType, TypeWithState operandType)
10324foreach (var constraintType in typeParameter1.ConstraintTypesNoUseSiteDiagnostics)
10422TypeWithAnnotations targetTypeWithNullability,
10453TypeWithAnnotations.Create(conversion.BestUserDefinedConversionAnalysis!.FromType),
10473var parameterType = ApplyLValueAnnotations(parameter.TypeWithAnnotations, parameterAnnotations);
10479var underlyingOperandTypeWithAnnotations = operandType.Type.GetNullableUnderlyingTypeWithAnnotations();
10511TypeWithAnnotations.Create(conversion.BestUserDefinedConversionAnalysis!.ToType),
10552var methodReturnType = method.ReturnTypeWithAnnotations;
10574TypeWithAnnotations targetTypeWithNullability,
10639var parameterType = ApplyLValueAnnotations(parameter.TypeWithAnnotations, parameterAnnotations);
10775private TypeWithState GetLiftedReturnType(TypeWithAnnotations returnType, NullableFlowState operandState)
10796private TypeWithState GetLiftedReturnTypeIfNecessary(bool isLifted, TypeWithAnnotations returnType, NullableFlowState operandState)
10803private TypeSymbol MakeNullableOf(TypeWithAnnotations underlying)
10810TypeWithAnnotations targetType,
10910(TypeWithAnnotations resultTypeWithAnnotations) =>
10991var argTypeWithAnnotations = TypeWithAnnotations.Create(argType, NullableAnnotation.NotAnnotated);
11091var parameterType = parameter.TypeWithAnnotations;
11190var lvalueResult = TypeWithAnnotations.Create(node.Type, NullableAnnotation.NotAnnotated);
11198var parameterType = GetDeclaredParameterResult(parameter);
11218TypeWithAnnotations leftLValueType;
11259var lvalueType = rightState.ToTypeWithAnnotations(compilation);
11277var type = property.TypeWithAnnotations;
11279var lValueType = ApplyLValueAnnotations(type, annotations);
11551var lvalueType = variable.Type;
11603AreNullableAndUnderlyingTypes(lvalueType.Type, operandType.Type, out TypeWithAnnotations underlyingType))
11619internal readonly TypeWithAnnotations Type;
11622internal DeconstructionVariable(BoundExpression expression, TypeWithAnnotations type)
11773var operandLvalue = LvalueResultType;
11788TypeWithAnnotations targetTypeOfOperandConversion;
11807targetTypeOfOperandConversion = TypeWithAnnotations.Create(node.OperandConversion.Type, nullableAnnotation: NullableAnnotation.NotAnnotated);
11816targetTypeOfOperandConversion = TypeWithAnnotations.Create(MakeNullableOf(targetTypeOfOperandConversion));
11862var operandTypeWithAnnotations = operandType.ToTypeWithAnnotations(compilation);
11973var leftLvalueType = LvalueResultType;
12079private TypeWithAnnotations GetDeclaredLocalResult(LocalSymbol local)
12081return _variables.TryGetType(local, out TypeWithAnnotations type) ?
12086private TypeWithAnnotations GetDeclaredParameterResult(ParameterSymbol parameter)
12088return _variables.TryGetType(parameter, out TypeWithAnnotations type) ?
12139TypeWithAnnotations typeWithAnnotations = GetTypeOrReturnTypeWithAnnotations(updatedProperty);
12270var type = GetTypeOrReturnTypeWithAnnotations(member);
12399TypeWithAnnotations targetTypeWithAnnotations;
12438targetTypeWithAnnotations = TypeWithAnnotations.Create(collectionExpression.Type);
12445targetTypeWithAnnotations = TypeWithAnnotations.Create(ForEachLoopBinder.GetIEnumerableOfT(resultType, isAsync, compilation, ref discardedUseSiteInfo, out bool foundMultiple, needSupportForRefStructInterfaces: out _));
12499TypeWithAnnotations.Create(enumeratorInfoOpt.ElementType, NullableAnnotation.NotAnnotated).ToTypeWithState();
12570TypeWithAnnotations sourceType = sourceState.ToTypeWithAnnotations(compilation);
12599TypeWithAnnotations destinationType = iterationVariable.TypeWithAnnotations;
12687var type = TypeWithAnnotations.Create(node.Type);
12844var type = TypeWithAnnotations.Create(node.Type);
12852var type = TypeWithAnnotations.Create(node.Type);
12874var type = TypeWithAnnotations.Create(node.Type, node.NullableAnnotation);
13265var result = TypeWithAnnotations.Create(node.Type);
13285var result = TypeWithAnnotations.Create(node.Type, NullableAnnotation.Oblivious);
13391var result = TypeWithAnnotations.Create(node.Type, NullableAnnotation.Oblivious);
13460private static bool IsNullabilityMismatch(TypeWithAnnotations type1, TypeWithAnnotations type2)
13562var result = TypeWithAnnotations.Create(node.Type, node.IsInferred ? NullableAnnotation.Annotated : node.NullableAnnotation);
13606TypeWithAnnotations elementType = InMethodBinder.GetIteratorElementTypeFromReturnType(compilation, RefKind.None,
13661var typeWithAnnotations = TypeWithAnnotations.Create(node.Type, node.NullableAnnotation);
13778var returnTypeWithAnnotations = node.FunctionPointer.Signature.ReturnTypeWithAnnotations;
FlowAnalysis\NullableWalker.Variables.cs (7)
48internal readonly ImmutableDictionary<Symbol, TypeWithAnnotations> VariableTypes;
50internal VariablesSnapshot(int id, VariablesSnapshot? container, Symbol? symbol, ImmutableArray<KeyValuePair<VariableIdentifier, int>> variableSlot, ImmutableDictionary<Symbol, TypeWithAnnotations> variableTypes)
59internal bool TryGetType(Symbol symbol, out TypeWithAnnotations type)
128private readonly PooledDictionary<Symbol, TypeWithAnnotations> _variableTypes = SpecializedSymbolCollections.GetPooledSymbolDictionaryInstance<Symbol, TypeWithAnnotations>();
296internal bool TryGetType(Symbol symbol, out TypeWithAnnotations type)
302internal void SetType(Symbol symbol, TypeWithAnnotations type)
FlowAnalysis\NullableWalker_Patterns.cs (22)
389var expressionTypeWithAnnotations = expressionTypeWithState.ToTypeWithAnnotations(compilation);
478var type = property.TypeWithAnnotations;
502TypeWithAnnotations type = getIndexerOutputType(inputType, e.IndexerAccess, isSlice: false);
512TypeWithAnnotations type = getIndexerOutputType(inputType, e.IndexerAccess, isSlice: true);
633var inferredType = value.ToTypeWithAnnotations(compilation, asAnnotatedType: boundLocal.DeclarationKind == BoundLocalDeclarationKind.WithInferredType);
634if (_variables.TryGetType(local, out var existingType))
637inferredType = TypeWithAnnotations.Create(inferredType.Type, existingType.NullableAnnotation.Join(inferredType.NullableAnnotation));
700var parameterType = method.Parameters[output.Index + extensionExtra].TypeWithAnnotations;
722outputSlot = makeDagTempSlot(TypeWithAnnotations.Create(e.Type, NullableAnnotation.NotAnnotated), output);
733var type = field.TypeWithAnnotations;
778var type = property.TypeWithAnnotations;
791var type = TypeWithAnnotations.Create(e.Property.Type, NullableAnnotation.Annotated);
801TypeWithAnnotations type = getIndexerOutputType(inputType, e.IndexerAccess, isSlice: false);
812TypeWithAnnotations type = getIndexerOutputType(inputType, e.IndexerAccess, isSlice: true);
942int makeDagTempSlot(TypeWithAnnotations type, BoundDagTemp temp)
948static TypeWithAnnotations getIndexerOutputType(TypeSymbol inputType, BoundExpression e, bool isSlice)
956? TypeWithAnnotations.Create(isNullableEnabled: true, inputType, isAnnotated: false)
1057var inferredTypeWithAnnotations = TypeWithAnnotations.Create(inferredType);
1093TypeWithAnnotations inferredTypeWithAnnotations,
1140(TypeWithAnnotations inferredTypeWithAnnotations) =>
Generated\BoundNodes.xml.Generated.cs (9)
1085public BoundTypeExpression(SyntaxNode syntax, AliasSymbol? aliasOpt, BoundTypeExpression? boundContainingTypeOpt, ImmutableArray<BoundExpression> boundDimensionsOpt, TypeWithAnnotations typeWithAnnotations, TypeSymbol type, bool hasErrors = false)
1101public TypeWithAnnotations TypeWithAnnotations { get; }
1106public BoundTypeExpression Update(AliasSymbol? aliasOpt, BoundTypeExpression? boundContainingTypeOpt, ImmutableArray<BoundExpression> boundDimensionsOpt, TypeWithAnnotations typeWithAnnotations, TypeSymbol type)
5927public BoundDynamicMemberAccess(SyntaxNode syntax, BoundExpression receiver, ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, bool invoked, bool indexed, TypeSymbol type, bool hasErrors = false)
5944public ImmutableArray<TypeWithAnnotations> TypeArgumentsOpt { get; }
5952public BoundDynamicMemberAccess Update(BoundExpression receiver, ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, bool invoked, bool indexed, TypeSymbol type)
6164public BoundMethodGroup(SyntaxNode syntax, ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, ImmutableArray<MethodSymbol> methods, Symbol? lookupSymbolOpt, DiagnosticInfo? lookupError, BoundMethodGroupFlags? flags, FunctionTypeSymbol? functionType, BoundExpression? receiverOpt, LookupResultKind resultKind, bool hasErrors = false)
6180public ImmutableArray<TypeWithAnnotations> TypeArgumentsOpt { get; }
6191public BoundMethodGroup Update(ImmutableArray<TypeWithAnnotations> typeArgumentsOpt, string name, ImmutableArray<MethodSymbol> methods, Symbol? lookupSymbolOpt, DiagnosticInfo? lookupError, BoundMethodGroupFlags? flags, FunctionTypeSymbol? functionType, BoundExpression? receiverOpt, LookupResultKind resultKind)
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (5)
224var pendingExceptionLocal = new SynthesizedLocal(_F.CurrentFunction, TypeWithAnnotations.Create(exceptionType), SynthesizedLocalKind.TryAwaitPendingException, tryStatementSyntax);
226var pendingBranchVar = new SynthesizedLocal(_F.CurrentFunction, TypeWithAnnotations.Create(_F.SpecialType(SpecialType.System_Int32)), SynthesizedLocalKind.TryAwaitPendingBranch, tryStatementSyntax);
1095this.returnValue = returnValue = new SynthesizedLocal(containingMethod, TypeWithAnnotations.Create(valueOpt.Type), SynthesizedLocalKind.AsyncMethodReturnValue, _syntaxOpt);
1131this.pendingCaughtException = new SynthesizedLocal(F.CurrentFunction, TypeWithAnnotations.Create(F.SpecialType(SpecialType.System_Object)), SynthesizedLocalKind.TryAwaitPendingCaughtException, tryStatementSyntax);
1132this.pendingCatch = new SynthesizedLocal(F.CurrentFunction, TypeWithAnnotations.Create(F.SpecialType(SpecialType.System_Int32)), SynthesizedLocalKind.TryAwaitPendingCatch, tryStatementSyntax);
Lowering\ClosureConversion\ClosureConversion.cs (11)
677var frameTypeParameters = ImmutableArray.Create(_currentTypeParameters.SelectAsArray(t => TypeWithAnnotations.Create(t)), 0, frame.Arity);
681LocalSymbol framePointer = new SynthesizedLocal(_topLevelMethod, TypeWithAnnotations.Create(frameType), SynthesizedLocalKind.LambdaDisplayClass, frame.ScopeSyntaxOpt);
975private ImmutableArray<TypeWithAnnotations> SubstituteTypeArguments(ImmutableArray<TypeWithAnnotations> typeArguments)
999var builder = ArrayBuilder<TypeWithAnnotations>.GetInstance(typeArguments.Length);
1000foreach (var typeArg in typeArguments)
1002TypeWithAnnotations oldTypeArg;
1003TypeWithAnnotations newTypeArg = typeArg;
1028ImmutableArray<TypeWithAnnotations> typeArgumentsOpt,
1040var realTypeArguments = ImmutableArray.Create(_currentTypeParameters.SelectAsArray(t => TypeWithAnnotations.Create(t)), 0, totalTypeArgumentCount - originalMethod.Arity);
1665RemapLambdaOrLocalFunction(node.Syntax, node.Symbol, default(ImmutableArray<TypeWithAnnotations>), closureKind, ref referencedMethod, out receiver, out constructedFrame);
Lowering\ClosureConversion\LambdaCapturedVariable.cs (6)
23private readonly TypeWithAnnotations _type;
26protected LambdaCapturedVariable(SynthesizedClosureEnvironment frame, TypeWithAnnotations type, string fieldName, bool isThisParameter)
54new LambdaCapturedVariableForRegularParameter(frame, TypeWithAnnotations.Create(type), fieldName, parameter) :
55new LambdaCapturedVariable(frame, TypeWithAnnotations.Create(type), fieldName, isThis);
145internal override TypeWithAnnotations GetFieldType(ConsList<FieldSymbol> fieldsBeingBound)
180public LambdaCapturedVariableForRegularParameter(SynthesizedClosureEnvironment frame, TypeWithAnnotations type, string fieldName, ParameterSymbol parameter)
Lowering\StateMachineRewriter\StateMachineFieldSymbol.cs (6)
23private readonly TypeWithAnnotations _type;
32public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeWithAnnotations type, string name, bool isPublic, bool isThis)
44this(stateMachineType, TypeWithAnnotations.Create(type), name, slotDebugInfo, slotIndex, isPublic)
48public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeWithAnnotations type, string name, LocalSlotDebugInfo slotDebugInfo, int slotIndex, bool isPublic)
70internal override TypeWithAnnotations GetFieldType(ConsList<FieldSymbol> fieldsBeingBound)
95public StateMachineFieldSymbolForRegularParameter(NamedTypeSymbol stateMachineType, TypeWithAnnotations type, string name, ParameterSymbol parameter, bool isPublic)
Lowering\SyntheticBoundNodeFactory.cs (11)
175public StateMachineFieldSymbol StateMachineField(TypeWithAnnotations type, string name, bool isPublic = false, bool isThis = false)
186var result = new StateMachineFieldSymbol(CurrentType, TypeWithAnnotations.Create(type), name, isPublic, isThis);
194var result = new StateMachineFieldSymbolForRegularParameter(CurrentType, TypeWithAnnotations.Create(type), name, parameter, isPublic);
614return new SynthesizedLocal(CurrentFunction, TypeWithAnnotations.Create(type), kind, syntax, isPinned,
634TypeWithAnnotations.Create(type),
645return SynthesizedParameterSymbol.Create(container, TypeWithAnnotations.Create(type), ordinal, RefKind.None, name);
1262public BoundExpression NullRef(TypeWithAnnotations type)
1313public BoundExpression Typeof(TypeWithAnnotations type, TypeSymbol systemType)
1318public ImmutableArray<BoundExpression> TypeOfs(ImmutableArray<TypeWithAnnotations> typeArguments, TypeSymbol systemType)
1701TypeWithAnnotations.Create(type),
1740temp = new SynthesizedLocal(this.CurrentFunction, TypeWithAnnotations.Create(node.Type), SynthesizedLocalKind.LoweringTemp);
Symbols\ArrayTypeSymbol.cs (24)
23private readonly TypeWithAnnotations _elementTypeWithAnnotations;
27TypeWithAnnotations elementTypeWithAnnotations,
39TypeWithAnnotations elementTypeWithAnnotations,
51TypeWithAnnotations elementTypeWithAnnotations,
68TypeWithAnnotations elementType,
77TypeWithAnnotations elementTypeWithAnnotations,
84TypeWithAnnotations elementTypeWithAnnotations,
93TypeWithAnnotations elementType)
98internal ArrayTypeSymbol WithElementType(TypeWithAnnotations elementTypeWithAnnotations)
103protected abstract ArrayTypeSymbol WithElementTypeCore(TypeWithAnnotations elementTypeWithAnnotations);
106TypeWithAnnotations elementTypeWithAnnotations,
202public TypeWithAnnotations ElementTypeWithAnnotations
394TypeWithAnnotations oldElementType = ElementTypeWithAnnotations;
395TypeWithAnnotations newElementType;
407internal override TypeSymbol SetNullabilityForReferenceTypes(Func<TypeWithAnnotations, TypeWithAnnotations> transform)
415TypeWithAnnotations elementType = ElementTypeWithAnnotations.MergeEquivalentTypes(((ArrayTypeSymbol)other).ElementTypeWithAnnotations, variance);
513TypeWithAnnotations elementTypeWithAnnotations,
522protected override ArrayTypeSymbol WithElementTypeCore(TypeWithAnnotations newElementType)
571TypeWithAnnotations elementTypeWithAnnotations,
605TypeWithAnnotations elementTypeWithAnnotations,
612protected override ArrayTypeSymbol WithElementTypeCore(TypeWithAnnotations elementTypeWithAnnotations)
632TypeWithAnnotations elementTypeWithAnnotations,
645protected override ArrayTypeSymbol WithElementTypeCore(TypeWithAnnotations elementTypeWithAnnotations)
Symbols\ConstraintsHelper.cs (32)
75ImmutableArray<TypeWithAnnotations> constraintTypes,
132ImmutableArray<TypeWithAnnotations> constraintTypes,
152var constraintTypesBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance();
159foreach (var constraintType in constraintTypes)
344internal static ImmutableArray<ImmutableArray<TypeWithAnnotations>> MakeTypeParameterConstraintTypes(
354return ImmutableArray<ImmutableArray<TypeWithAnnotations>>.Empty;
368return ImmutableArray<ImmutableArray<TypeWithAnnotations>>.Empty;
900ImmutableArray<TypeWithAnnotations> typeArguments,
951TypeWithAnnotations typeArgument,
1058TypeWithAnnotations typeArgument,
1084var constraintTypes = ArrayBuilder<TypeWithAnnotations>.GetInstance();
1086ImmutableArray<TypeWithAnnotations> originalConstraintTypes = typeParameter.ConstraintTypesWithDefinitionUseSiteDiagnostics(ref useSiteInfo);
1098foreach (var constraintType in constraintTypes)
1118static bool errorIfNotSatisfiesConstructorConstraint(Symbol containingSymbol, TypeParameterSymbol typeParameter, TypeWithAnnotations typeArgument, ArrayBuilder<TypeParameterDiagnosticInfo> diagnosticsBuilder)
1144TypeWithAnnotations typeArgument,
1168TypeWithAnnotations typeArgument,
1172TypeWithAnnotations constraintType,
1226static NullableFlowState getTypeArgumentState(in TypeWithAnnotations typeWithAnnotations)
1250foreach (var constraintType in typeParameter.ConstraintTypesNoUseSiteDiagnostics)
1265static bool constraintTypeAllows(in TypeWithAnnotations typeWithAnnotations, NullableFlowState state)
1287foreach (var constraintType in typeParameter.ConstraintTypesNoUseSiteDiagnostics)
1346TypeWithAnnotations typeArgument,
1347TypeWithAnnotations constraintType,
1396foreach (var typeArgumentConstraint in typeParameter.ConstraintTypesWithDefinitionUseSiteDiagnostics(ref useSiteInfo))
1439private static bool IsReferenceType(TypeParameterSymbol typeParameter, ImmutableArray<TypeWithAnnotations> constraintTypes)
1444private static bool IsValueType(TypeParameterSymbol typeParameter, ImmutableArray<TypeWithAnnotations> constraintTypes)
1633internal static TypeWithAnnotations ConstraintWithMostSignificantNullability(TypeWithAnnotations type1, TypeWithAnnotations type2)
1653internal static bool IsObjectConstraint(TypeWithAnnotations type, ref TypeWithAnnotations bestObjectConstraint)
1679internal static bool IsObjectConstraintSignificant(bool? isNotNullable, TypeWithAnnotations objectConstraint)
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (35)
29TypeWithAnnotations returnType;
33returnType = TypeWithAnnotations.Create(typeBinder.CreateErrorType());
245TypeWithAnnotations returnType,
248ImmutableArray<TypeWithAnnotations> parameterTypes,
270TypeWithAnnotations returnTypeWithAnnotations,
272ImmutableArray<TypeWithAnnotations> parameterTypes,
334TypeWithAnnotations substitutedReturnType,
335ImmutableArray<TypeWithAnnotations> substitutedParameterTypes,
352var mergedReturnType = ReturnTypeWithAnnotations.MergeEquivalentTypes(signature.ReturnTypeWithAnnotations, returnVariance);
354var mergedParameterTypes = ImmutableArray<TypeWithAnnotations>.Empty;
358var paramMergedTypesBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(_parameters.Length);
371var mergedParameterType = thisParam.TypeWithAnnotations.MergeEquivalentTypes(otherParam.TypeWithAnnotations, paramVariance);
400public FunctionPointerMethodSymbol SetNullabilityForReferenceTypes(Func<TypeWithAnnotations, TypeWithAnnotations> transform)
402var transformedReturn = transform(ReturnTypeWithAnnotations);
404var transformedParameterTypes = ImmutableArray<TypeWithAnnotations>.Empty;
408var paramTypesBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(_parameters.Length);
411var transformedType = transform(param.TypeWithAnnotations);
444TypeWithAnnotations returnType,
447ImmutableArray<TypeWithAnnotations> substitutedParameterTypes,
465var substitutedType = substitutedParameterTypes[i];
489TypeWithAnnotations returnTypeWithAnnotations,
491ImmutableArray<TypeWithAnnotations> parameterTypes,
520TypeWithAnnotations returnType,
548var returnType = TypeWithAnnotations.Create(retInfo.Type, customModifiers: CSharpCustomModifier.Convert(retInfo.CustomModifiers));
568var paramType = TypeWithAnnotations.Create(param.Type, customModifiers: CSharpCustomModifier.Convert(param.CustomModifiers));
605bool madeChanges = ReturnTypeWithAnnotations.ApplyNullableTransforms(defaultTransformFlag, transforms, ref position, out var newReturnType);
606var newParamTypes = ImmutableArray<TypeWithAnnotations>.Empty;
609var paramTypesBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(Parameters.Length);
613madeParamChanges |= param.TypeWithAnnotations.ApplyNullableTransforms(defaultTransformFlag, transforms, ref position, out var newParamType);
768public override TypeWithAnnotations ReturnTypeWithAnnotations { get; }
836public override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotations => ImmutableArray<TypeWithAnnotations>.Empty;
Symbols\Metadata\PE\PETypeParameterSymbol.cs (19)
44private ImmutableArray<TypeWithAnnotations> _lazyDeclaredConstraintTypes;
151private ImmutableArray<TypeWithAnnotations> GetDeclaredConstraintTypes(ConsList<PETypeParameterSymbol> inProgress)
158ImmutableArray<TypeWithAnnotations> declaredConstraintTypes;
168var symbolsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance();
171TypeWithAnnotations bestObjectConstraint = default;
176TypeWithAnnotations type = GetConstraintTypeOrDefault(moduleSymbol, metadataReader, tokenDecoder, constraintHandle, ref hasUnmanagedModreqPattern);
209foreach (TypeWithAnnotations constraintType in symbolsBuilder)
230declaredConstraintTypes = ImmutableArray<TypeWithAnnotations>.Empty;
265private TypeWithAnnotations GetConstraintTypeOrDefault(PEModuleSymbol moduleSymbol, MetadataReader metadataReader, MetadataDecoder tokenDecoder, GenericParameterConstraintHandle constraintHandle, ref bool hasUnmanagedModreqPattern)
303var type = TypeWithAnnotations.Create(typeSymbol);
309private static bool? IsNotNullableFromConstraintType(TypeWithAnnotations constraintType, ConsList<PETypeParameterSymbol> inProgress, out bool isNonNullableValueType)
354ImmutableArray<TypeWithAnnotations> constraintTypes = this.GetDeclaredConstraintTypes(inProgress);
380private static bool? IsNotNullableFromConstraintTypes(ImmutableArray<TypeWithAnnotations> constraintTypes, ConsList<PETypeParameterSymbol> inProgress, out bool isNonNullableValueType)
386foreach (TypeWithAnnotations constraintType in constraintTypes)
537var symbolsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance();
544TypeWithAnnotations type = GetConstraintTypeOrDefault(moduleSymbol, metadataReader, tokenDecoder, constraintHandle, ref hasUnmanagedModreqPattern);
616internal override ImmutableArray<TypeWithAnnotations> GetConstraintTypes(ConsList<TypeParameterSymbol> inProgress)
619return (bounds != null) ? bounds.ConstraintTypes : ImmutableArray<TypeWithAnnotations>.Empty;
Symbols\Retargeting\RetargetingSymbolTranslator.cs (20)
180public TypeWithAnnotations Retarget(TypeWithAnnotations underlyingType, RetargetOptions options, NamedTypeSymbol asDynamicIfNoPiaContainingType = null)
515var oldArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
534var newArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance(oldArguments.Count);
536foreach (var arg in oldArguments)
538var newArg = Retarget(arg, RetargetOptions.RetargetPrimitiveTypesByTypeCode); // generic instantiation is a signature
595private bool IsNoPiaIllegalGenericInstantiation(ArrayBuilder<TypeWithAnnotations> oldArguments, ArrayBuilder<TypeWithAnnotations> newArguments, int startOfNonInterfaceArguments)
671foreach (var argument in namedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics)
697TypeWithAnnotations oldElement = type.ElementTypeWithAnnotations;
698TypeWithAnnotations newElement = Retarget(oldElement, RetargetOptions.RetargetPrimitiveTypesByTypeCode);
748TypeWithAnnotations oldPointed = type.PointedAtTypeWithAnnotations;
749TypeWithAnnotations newPointed = Retarget(oldPointed, RetargetOptions.RetargetPrimitiveTypesByTypeCode);
762var newReturn = Retarget(signature.ReturnTypeWithAnnotations, RetargetOptions.RetargetPrimitiveTypesByTypeCode);
766var newParameterTypes = ImmutableArray<TypeWithAnnotations>.Empty;
772var newParameterTypesBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(paramCount);
778var newParameterType = Retarget(parameter.TypeWithAnnotations, RetargetOptions.RetargetPrimitiveTypesByTypeCode);
860public ImmutableArray<TypeWithAnnotations> Retarget(ImmutableArray<TypeWithAnnotations> sequence)
1112var targetType = Retarget(@event.TypeWithAnnotations, RetargetOptions.RetargetPrimitiveTypesByTypeCode);
Symbols\Source\LocalFunctionOrSourceMemberMethodSymbol.cs (8)
12private TypeWithAnnotations.Boxed? _lazyIteratorElementType;
19_lazyIteratorElementType = TypeWithAnnotations.Boxed.Sentinel;
23internal sealed override TypeWithAnnotations IteratorElementTypeWithAnnotations
27if (_lazyIteratorElementType == TypeWithAnnotations.Boxed.Sentinel)
29TypeWithAnnotations elementType = InMethodBinder.GetIteratorElementTypeFromReturnType(DeclaringCompilation, RefKind, ReturnType, errorLocation: null, diagnostics: null);
33elementType = TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(DeclaringCompilation, name: "", arity: 0, errorInfo: null, unreported: false));
36Interlocked.CompareExchange(ref _lazyIteratorElementType, new TypeWithAnnotations.Boxed(elementType), TypeWithAnnotations.Boxed.Sentinel);
Symbols\Source\ParameterHelpers.cs (7)
41parameterCreationFunc: static (Binder context, Symbol owner, TypeWithAnnotations parameterType,
70var parameterCreationFunc = static (Binder context, Symbol owner, TypeWithAnnotations parameterType,
133parameterCreationFunc: static (Binder binder, FunctionPointerMethodSymbol owner, TypeWithAnnotations parameterType,
177Func<Binder, TOwningSymbol, TypeWithAnnotations, TParameterSyntax, RefKind, int, SyntaxToken, SyntaxToken, bool, ScopedKind, BindingDiagnosticBag, TParameterSymbol> parameterCreationFunc,
257Func<Binder, TOwningSymbol, TypeWithAnnotations, TParameterSyntax, RefKind, int, SyntaxToken, SyntaxToken, bool, ScopedKind, BindingDiagnosticBag, TParameterSymbol> parameterCreationFunc,
308var parameterType = withTypeParametersBinder.BindType(parameterSyntax.Type, diagnostics, suppressUseSiteDiagnostics: suppressUseSiteDiagnostics);
846TypeWithAnnotations typeWithAnnotations,
Symbols\Source\SourceDelegateMethodSymbol.cs (24)
21private readonly TypeWithAnnotations _returnType;
25TypeWithAnnotations returnType,
57var returnType = binder.BindType(returnTypeSyntax, diagnostics);
60var voidType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_Void, diagnostics, syntax));
62var objectType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_Object, diagnostics, syntax));
63var intPtrType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_IntPtr, diagnostics, syntax));
85var iAsyncResultType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_IAsyncResult, diagnostics, syntax));
86var asyncCallbackType = TypeWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_AsyncCallback, diagnostics, syntax));
156public override ImmutableArray<ImmutableArray<TypeWithAnnotations>> GetTypeParameterConstraintTypes()
157=> ImmutableArray<ImmutableArray<TypeWithAnnotations>>.Empty;
162public sealed override TypeWithAnnotations ReturnTypeWithAnnotations
217TypeWithAnnotations voidType,
218TypeWithAnnotations objectType,
219TypeWithAnnotations intPtrType,
264TypeWithAnnotations returnType,
357TypeWithAnnotations iAsyncResultType,
358TypeWithAnnotations objectType,
359TypeWithAnnotations asyncCallbackType,
399TypeWithAnnotations iAsyncResultType,
Symbols\Source\SourceMemberContainerSymbol.cs (14)
5001var parameterType = signatureBinder.BindType(typeSyntax, diagnostics, suppressUseSiteDiagnostics: false);
5152TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_Void)),
5191TypeWithAnnotations.Create(this),
5200TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_Void)),
5244TypeWithAnnotations.Create(compilation.GetWellKnownType(WellKnownType.System_Text_StringBuilder)),
5252returnType: TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_Boolean)),
5307returnType: TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_String)),
5481TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_Int32)),
5510TypeWithAnnotations.Create(compilation.GetWellKnownType(WellKnownType.System_Type)),
5571TypeWithAnnotations.Create(this),
5580TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_Boolean)),
6153builder.AddValue(TypeWithAnnotations.Create(baseType));
6157builder.AddValue(TypeWithAnnotations.Create(@interface));
6217AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeNullableAttributeIfNecessary(this, nullableContextValue, TypeWithAnnotations.Create(baseType)));
Symbols\Source\SourceNamedTypeSymbol.cs (24)
273internal ImmutableArray<TypeWithAnnotations> GetTypeParameterConstraintTypes(int ordinal)
276return (constraintTypes.Length > 0) ? constraintTypes[ordinal] : ImmutableArray<TypeWithAnnotations>.Empty;
279private ImmutableArray<ImmutableArray<TypeWithAnnotations>> GetTypeParameterConstraintTypes()
321private ImmutableArray<ImmutableArray<TypeWithAnnotations>> MakeTypeParameterConstraintTypes(BindingDiagnosticBag diagnostics)
517ImmutableArray<TypeWithAnnotations> originalConstraintTypes = constraint.ConstraintTypes;
518ArrayBuilder<TypeWithAnnotations> mergedConstraintTypes = null;
519SmallDictionary<TypeWithAnnotations, int> originalConstraintTypesMap = null;
566static bool mergeConstraints(ImmutableArray<TypeWithAnnotations> originalConstraintTypes,
567ref SmallDictionary<TypeWithAnnotations, int> originalConstraintTypesMap, ref ArrayBuilder<TypeWithAnnotations> mergedConstraintTypes,
587TypeWithAnnotations.EqualsComparer.IgnoreNullableModifiersForReferenceTypesComparer);
588SmallDictionary<TypeWithAnnotations, int> clauseConstraintTypesMap = toDictionary(clause.ConstraintTypes, originalConstraintTypesMap.Comparer);
592TypeWithAnnotations constraintType1 = mergedConstraintTypes?[index1] ?? originalConstraintTypes[index1];
602TypeWithAnnotations constraintType2 = clause.ConstraintTypes[index2];
616mergedConstraintTypes = ArrayBuilder<TypeWithAnnotations>.GetInstance(originalConstraintTypes.Length);
624foreach (var constraintType in clauseConstraintTypesMap.Keys)
636static SmallDictionary<TypeWithAnnotations, int> toDictionary(ImmutableArray<TypeWithAnnotations> constraintTypes, IEqualityComparer<TypeWithAnnotations> comparer)
638var result = new SmallDictionary<TypeWithAnnotations, int>(comparer);
671ImmutableArray<TypeWithAnnotations> originalConstraintTypes = constraint.ConstraintTypes;
704static void mergeConstraints(ref TypeParameterConstraintKind mergedKind, ImmutableArray<TypeWithAnnotations> originalConstraintTypes, TypeParameterConstraintClause clause)
745internal sealed override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotationsNoUseSiteDiagnostics
2012TypeWithAnnotations elementType = elementField.TypeWithAnnotations;
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (20)
69TypeWithAnnotations extendedType = extensionParameter.TypeWithAnnotations;
111ImmutableArray<TypeWithAnnotations> typeConstraints = typeParameter.GetConstraintTypes(ConsList<TypeParameterSymbol>.Empty);
118foreach (var typeConstraint in typeConstraints)
173TypeWithAnnotations pointedAtType = pointer.PointedAtTypeWithAnnotations;
242var typeArguments = ArrayBuilder<TypeWithAnnotations>.GetInstance();
254TypeWithAnnotations typeArgument = typeArguments[i];
283TypeWithAnnotations elementType = array.ElementTypeWithAnnotations;
314TypeWithAnnotations returnType = signature.ReturnTypeWithAnnotations;
332TypeWithAnnotations parameterType = parameter.TypeWithAnnotations;
433static void appendTypeWithAnnotation(TypeWithAnnotations type, StringBuilder builder)
509ImmutableArray<TypeWithAnnotations> tupleElementTypes = namedType.TupleElementTypesWithAnnotations;
512TypeWithAnnotations elementType = tupleElementTypes[i];
575ImmutableArray<TypeWithAnnotations> typeArguments = namedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics;
664ImmutableArray<TypeWithAnnotations> contraintTypes = typeParam.ConstraintTypesNoUseSiteDiagnostics;
1002TypeWithAnnotations parameterType = parameter.TypeWithAnnotations;
1230ImmutableArray<TypeWithAnnotations> typeArguments = MethodTypeInferrer.InferTypeArgumentsFromReceiverType(extension, receiverValue, compilation, conversions, ref discardedUseSiteInfo);
1237ImmutableArray<TypeWithAnnotations> typeArgsForConstruct = fillNotInferredTypeArguments(extension, typeArguments, out wasExtensionFullyInferred);
1252static ImmutableArray<TypeWithAnnotations> fillNotInferredTypeArguments(NamedTypeSymbol extension, ImmutableArray<TypeWithAnnotations> typeArgs, out bool wasFullyInferred)
1260(t, tp) => t.HasType ? t : TypeWithAnnotations.Create(tp));
Symbols\Synthesized\Records\SynthesizedRecordObjEquals.cs (3)
27protected override (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymbol> Parameters)
33return (ReturnType: TypeWithAnnotations.Create(Binder.GetSpecialType(compilation, SpecialType.System_Boolean, location, diagnostics)),
36TypeWithAnnotations.Create(Binder.GetSpecialType(compilation, SpecialType.System_Object, location, diagnostics), annotation),
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (3)
89protected override (TypeWithAnnotations ReturnType, ImmutableArray<ParameterSymbol> Parameters) MakeParametersAndBindReturnType(BindingDiagnosticBag diagnostics)
94return (ReturnType: TypeWithAnnotations.Create(Binder.GetSpecialType(compilation, SpecialType.System_Boolean, location, diagnostics)),
97TypeWithAnnotations.Create(Binder.GetWellKnownType(compilation, WellKnownType.System_Text_StringBuilder, diagnostics, location), annotation),
Symbols\Synthesized\SynthesizedDelegateSymbol.cs (8)
21SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(objectType), 0, RefKind.None, "object"),
22SynthesizedParameterSymbol.Create(this, TypeWithAnnotations.Create(intPtrType), 1, RefKind.None, "method"));
35internal ParameterDescription(TypeWithAnnotations type, RefKind refKind, ScopedKind scope, ConstantValue? defaultValue, bool isParams, bool hasUnscopedRefAttribute)
45internal readonly TypeWithAnnotations Type;
58TypeWithAnnotations returnType,
170public override TypeWithAnnotations ReturnTypeWithAnnotations { get; }
176public override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotations
178get { return ImmutableArray<TypeWithAnnotations>.Empty; }
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (14)
44return new ScriptEntryPoint(containingType, TypeWithAnnotations.Create(systemVoid));
125public override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotations
127get { return ImmutableArray<TypeWithAnnotations>.Empty; }
432public override TypeWithAnnotations ReturnTypeWithAnnotations => TypeWithAnnotations.Create(_userEntryPointInvocation.Type);
484private readonly TypeWithAnnotations _returnType;
486internal ScriptEntryPoint(NamedTypeSymbol containingType, TypeWithAnnotations returnType) :
498public override TypeWithAnnotations ReturnTypeWithAnnotations => _returnType;
524new SynthesizedLocal(this, TypeWithAnnotations.Create(_containingType), SynthesizedLocalKind.LoweringTemp),
574private readonly TypeWithAnnotations _returnType;
576internal SubmissionEntryPoint(NamedTypeSymbol containingType, TypeWithAnnotations returnType, TypeSymbol submissionArrayType) :
582TypeWithAnnotations.Create(submissionArrayType), 0, RefKind.None, "submissionArray"));
597public override TypeWithAnnotations ReturnTypeWithAnnotations => _returnType;
617new SynthesizedLocal(this, TypeWithAnnotations.Create(_containingType), SynthesizedLocalKind.LoweringTemp),
Symbols\TypeMap.cs (21)
23public static readonly Func<TypeWithAnnotations, TypeSymbol> AsTypeSymbol = t => t.Type;
25internal static ImmutableArray<TypeWithAnnotations> TypeParametersAsTypeSymbolsWithAnnotations(ImmutableArray<TypeParameterSymbol> typeParameters)
27return typeParameters.SelectAsArray(static (tp) => TypeWithAnnotations.Create(tp));
30internal static ImmutableArray<TypeWithAnnotations> TypeParametersAsTypeSymbolsWithIgnoredAnnotations(ImmutableArray<TypeParameterSymbol> typeParameters)
32return typeParameters.SelectAsArray(static (tp) => TypeWithAnnotations.Create(tp, NullableAnnotation.Ignored));
35internal static ImmutableArray<TypeSymbol> AsTypeSymbols(ImmutableArray<TypeWithAnnotations> typesOpt)
41internal TypeMap(ImmutableArray<TypeParameterSymbol> from, ImmutableArray<TypeWithAnnotations> to, bool allowAlpha = false)
55private TypeMap(SmallDictionary<TypeParameterSymbol, TypeWithAnnotations> mapping)
56: base(new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(mapping, ReferenceEqualityComparer.Instance))
61private static SmallDictionary<TypeParameterSymbol, TypeWithAnnotations> ForType(NamedTypeSymbol containingType)
65new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(substituted.TypeSubstitution.Mapping, ReferenceEqualityComparer.Instance) :
66new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(ReferenceEqualityComparer.Instance);
69internal TypeMap(NamedTypeSymbol containingType, ImmutableArray<TypeParameterSymbol> typeParameters, ImmutableArray<TypeWithAnnotations> typeArguments)
75TypeWithAnnotations ta = typeArguments[i];
83private static readonly SmallDictionary<TypeParameterSymbol, TypeWithAnnotations> s_emptyDictionary =
84new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(ReferenceEqualityComparer.Instance);
130result.Mapping.Add(tp, TypeWithAnnotations.Create(newTp));
194private static SmallDictionary<TypeParameterSymbol, TypeWithAnnotations> ConstructMapping(ImmutableArray<TypeParameterSymbol> from, ImmutableArray<TypeWithAnnotations> to)
196var mapping = new SmallDictionary<TypeParameterSymbol, TypeWithAnnotations>(ReferenceEqualityComparer.Instance);
203TypeWithAnnotations ta = to[i];
Symbols\TypeSymbolExtensions.cs (36)
121foreach (var constraintType in constraintTypes)
171public static TypeWithAnnotations GetNullableUnderlyingTypeWithAnnotations(this TypeSymbol type)
401internal static bool IsArrayInterface(this TypeSymbol type, out TypeWithAnnotations typeArgument)
404internal static bool IsReadOnlyArrayInterface(this TypeSymbol type, out TypeWithAnnotations typeArgument)
422internal static bool IsMutableArrayInterface(this TypeSymbol type, out TypeWithAnnotations typeArgument)
637public static bool TryGetElementTypesWithAnnotationsIfTupleType(this TypeSymbol type, out ImmutableArray<TypeWithAnnotations> elementTypes)
646elementTypes = default(ImmutableArray<TypeWithAnnotations>);
793/// <param name="useDefaultType">If true, use <see cref="TypeWithAnnotations.DefaultType"/>
794/// instead of <see cref="TypeWithAnnotations.Type"/> to avoid early resolution of nullable types</param>
796this TypeWithAnnotations typeWithAnnotationsOpt,
798Func<TypeWithAnnotations, T, bool, bool>? typeWithAnnotationsPredicate,
876TypeWithAnnotations next;
916(TypeWithAnnotations nextTypeWithAnnotations, TypeSymbol? nextType) = getNextIterationElements(fields[i].TypeWithAnnotations, canDigThroughNullable);
947(TypeWithAnnotations nextTypeWithAnnotations, TypeSymbol? nextType) = getNextIterationElements(typeArguments[i], canDigThroughNullable);
996static (TypeWithAnnotations, TypeSymbol?) getNextIterationElements(TypeWithAnnotations type, bool canDigThroughNullable)
997=> canDigThroughNullable ? (default(TypeWithAnnotations), type.NullableUnderlyingTypeOrSelf) : (type, null);
999static TypeSymbol? visitFunctionPointerType(FunctionPointerTypeSymbol type, Func<TypeWithAnnotations, T, bool, bool>? typeWithAnnotationsPredicate, Func<TypeSymbol, T, bool, bool>? typePredicate, T arg, bool useDefaultType, bool canDigThroughNullable, bool visitCustomModifiers, out TypeWithAnnotations next)
1026(TypeWithAnnotations nextTypeWithAnnotations, TypeSymbol? nextType) = getNextIterationElements(currentPointer.Parameters[i].TypeWithAnnotations, canDigThroughNullable);
1283public static void FindTypeParameters(this TypeWithAnnotations type, HashSet<TypeParameterSymbol> result)
1295foreach (var typeArgument in method.TypeArgumentsWithAnnotations)
1337internal static bool ContainsNativeIntegerWrapperType(this TypeWithAnnotations type)
1680foreach (var arg in type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics)
2036private static bool NormalizeTaskTypesInType(CSharpCompilation compilation, ref TypeWithAnnotations typeWithAnnotations)
2041typeWithAnnotations = TypeWithAnnotations.Create(type, customModifiers: typeWithAnnotations.CustomModifiers);
2054var typeArgumentsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance();
2059var typeWithModifier = typeArgumentsBuilder[i];
2065typeArgumentsBuilder[i] = TypeWithAnnotations.Create(typeArgNormalized, customModifiers: typeWithModifier.CustomModifiers);
2105var elementType = arrayType.ElementTypeWithAnnotations;
2116var pointedAtType = pointerType.PointedAtTypeWithAnnotations;
2128var returnType = funcPtrType.Signature.ReturnTypeWithAnnotations;
2131var paramTypes = ImmutableArray<TypeWithAnnotations>.Empty;
2135var paramsBuilder = ArrayBuilder<TypeWithAnnotations>.GetInstance(funcPtrType.Signature.ParameterCount);
2139var paramType = param.TypeWithAnnotations;
2168this TypeWithAnnotations type,
Symbols\TypeUnification.cs (18)
36return (NamedTypeSymbol)SubstituteAllTypeParameters(substitution, TypeWithAnnotations.Create(candidateSubtype)).Type;
51var substituted1 = SubstituteAllTypeParameters(substitution, TypeWithAnnotations.Create(t1));
52var substituted2 = SubstituteAllTypeParameters(substitution, TypeWithAnnotations.Create(t2));
61private static TypeWithAnnotations SubstituteAllTypeParameters(AbstractTypeMap? substitution, TypeWithAnnotations type)
65TypeWithAnnotations previous;
78return CanUnifyHelper(TypeWithAnnotations.Create(t1), TypeWithAnnotations.Create(t2), ref substitution);
98private static bool CanUnifyHelper(TypeWithAnnotations t1, TypeWithAnnotations t2, ref MutableTypeMap? substitution)
120TypeWithAnnotations tmp = t1;
226AddSubstitution(ref substitution, tp1, TypeWithAnnotations.Create(t2.Type));
234TypeWithAnnotations.Create(t2.Type,
253TypeWithAnnotations.Create(t1.Type,
268private static void AddSubstitution(ref MutableTypeMap? substitution, TypeParameterSymbol tp1, TypeWithAnnotations t2)
299foreach (TypeWithAnnotations typePart in typeParts)
Symbols\TypeWithAnnotations.cs (97)
29internal readonly TypeWithAnnotations Value;
30internal Boxed(TypeWithAnnotations value)
75internal static TypeWithAnnotations Create(bool isNullableEnabled, TypeSymbol typeSymbol, bool isAnnotated = false)
85internal static TypeWithAnnotations Create(TypeSymbol typeSymbol, NullableAnnotation nullableAnnotation = NullableAnnotation.Oblivious, ImmutableArray<CustomModifier> customModifiers = default)
108internal TypeWithAnnotations AsAnnotated()
118internal TypeWithAnnotations AsNotAnnotated()
168private static TypeWithAnnotations CreateNonLazyType(TypeSymbol typeSymbol, NullableAnnotation nullableAnnotation, ImmutableArray<CustomModifier> customModifiers)
173private static TypeWithAnnotations CreateLazyNullableTypeParameter(CSharpCompilation compilation, TypeWithAnnotations underlying)
178private static TypeWithAnnotations CreateLazySubstitutedType(TypeSymbol substitutedTypeSymbol, ImmutableArray<CustomModifier> customModifiers, TypeParameterSymbol typeParameter)
194public TypeWithAnnotations SetIsAnnotated(CSharpCompilation compilation)
222TypeWithAnnotations makeNullableT()
235private TypeWithAnnotations AsNullableReferenceType() => _extensions.AsNullableReferenceType(this);
236public TypeWithAnnotations AsNotNullableReferenceType() => _extensions.AsNotNullableReferenceType(this);
241internal TypeWithAnnotations MergeEquivalentTypes(TypeWithAnnotations other, VarianceKind variance)
250public TypeWithAnnotations WithModifiers(ImmutableArray<CustomModifier> customModifiers) =>
338public bool Equals(TypeWithAnnotations other, TypeCompareKind comparison)
390internal sealed class EqualsComparer : EqualityComparer<TypeWithAnnotations>
402public override int GetHashCode(TypeWithAnnotations obj)
411public override bool Equals(TypeWithAnnotations x, TypeWithAnnotations y)
421internal bool TypeSymbolEquals(TypeWithAnnotations other, TypeCompareKind comparison) =>
436public TypeWithAnnotations SubstituteType(AbstractTypeMap typeMap) =>
439internal TypeWithAnnotations SubstituteTypeCore(AbstractTypeMap typeMap)
446var newTypeWithModifiers = typeMap.SubstituteType(typeSymbol);
542private bool TypeSymbolEqualsCore(TypeWithAnnotations other, TypeCompareKind comparison)
567public TypeWithAnnotations WithTypeAndModifiers(TypeSymbol typeSymbol, ImmutableArray<CustomModifier> customModifiers) =>
570public TypeWithAnnotations WithType(TypeSymbol typeSymbol) =>
590TypeWithAnnotations typeWithAnnotationsOpt,
625private static void AddNullableTransforms(TypeWithAnnotations typeWithAnnotations, ArrayBuilder<byte> transforms)
661public bool ApplyNullableTransforms(byte defaultTransformFlag, ImmutableArray<byte> transforms, ref int position, out TypeWithAnnotations result)
724public TypeWithAnnotations WithTopLevelNonNullability()
735public TypeWithAnnotations SetUnknownNullabilityForReferenceTypes()
763return other is TypeWithAnnotations t && this.Equals(t, TypeCompareKind.ConsiderEverything);
781public static bool operator ==(TypeWithAnnotations? x, TypeWithAnnotations? y)
789public static bool operator !=(TypeWithAnnotations? x, TypeWithAnnotations? y)
795internal bool IsSameAs(TypeWithAnnotations other)
856internal abstract TypeWithAnnotations AsNullableReferenceType(TypeWithAnnotations type);
857internal abstract TypeWithAnnotations AsNotNullableReferenceType(TypeWithAnnotations type);
859internal abstract TypeWithAnnotations WithModifiers(TypeWithAnnotations type, ImmutableArray<CustomModifier> customModifiers);
873internal abstract TypeWithAnnotations WithTypeAndModifiers(TypeWithAnnotations type, TypeSymbol typeSymbol, ImmutableArray<CustomModifier> customModifiers);
875internal abstract bool TypeSymbolEquals(TypeWithAnnotations type, TypeWithAnnotations other, TypeCompareKind comparison);
876internal abstract TypeWithAnnotations SubstituteType(TypeWithAnnotations type, AbstractTypeMap typeMap);
877internal abstract void ReportDiagnosticsIfObsolete(TypeWithAnnotations type, Binder binder, SyntaxNode syntax, BindingDiagnosticBag diagnostics);
907internal override TypeWithAnnotations WithModifiers(TypeWithAnnotations type, ImmutableArray<CustomModifier> customModifiers)
914internal override TypeWithAnnotations WithTypeAndModifiers(TypeWithAnnotations type, TypeSymbol typeSymbol, ImmutableArray<CustomModifier> customModifiers)
919internal override TypeWithAnnotations AsNullableReferenceType(TypeWithAnnotations type)
924internal override TypeWithAnnotations AsNotNullableReferenceType(TypeWithAnnotations type)
930internal override bool TypeSymbolEquals(TypeWithAnnotations type, TypeWithAnnotations other, TypeCompareKind comparison)
935internal override TypeWithAnnotations SubstituteType(TypeWithAnnotations type, AbstractTypeMap typeMap)
940internal override void ReportDiagnosticsIfObsolete(TypeWithAnnotations type, Binder binder, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
1012internal override TypeWithAnnotations WithModifiers(TypeWithAnnotations type, ImmutableArray<CustomModifier> customModifiers)
1017internal override TypeWithAnnotations WithTypeAndModifiers(TypeWithAnnotations type, TypeSymbol typeSymbol, ImmutableArray<CustomModifier> customModifiers)
1022internal override TypeWithAnnotations AsNullableReferenceType(TypeWithAnnotations type)
1027internal override TypeWithAnnotations AsNotNullableReferenceType(TypeWithAnnotations type)
1033internal override void ReportDiagnosticsIfObsolete(TypeWithAnnotations type, Binder binder, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
1038internal override bool TypeSymbolEquals(TypeWithAnnotations type, TypeWithAnnotations other, TypeCompareKind comparison)
1043internal override TypeWithAnnotations SubstituteType(TypeWithAnnotations type, AbstractTypeMap typeMap)
1062private readonly TypeWithAnnotations _underlying;
1065public LazyNullableTypeParameter(CSharpCompilation compilation, TypeWithAnnotations underlying)
1112internal override TypeWithAnnotations WithModifiers(TypeWithAnnotations type, ImmutableArray<CustomModifier> customModifiers)
1122return TypeWithAnnotations.Create(resolvedType, type.NullableAnnotation, customModifiers: customModifiers);
1128internal override TypeWithAnnotations WithTypeAndModifiers(TypeWithAnnotations type, TypeSymbol typeSymbol, ImmutableArray<CustomModifier> customModifiers)
1132return TypeWithAnnotations.Create(typeSymbol, type.NullableAnnotation, customModifiers: customModifiers);
1138internal override TypeWithAnnotations AsNullableReferenceType(TypeWithAnnotations type)
1143internal override TypeWithAnnotations AsNotNullableReferenceType(TypeWithAnnotations type)
1152internal override TypeWithAnnotations SubstituteType(TypeWithAnnotations type, AbstractTypeMap typeMap)
1159var newUnderlying = _underlying.SubstituteTypeCore(typeMap);
1176internal override void ReportDiagnosticsIfObsolete(TypeWithAnnotations type, Binder binder, SyntaxNode syntax, BindingDiagnosticBag diagnostics)
1188internal override bool TypeSymbolEquals(TypeWithAnnotations type, TypeWithAnnotations other, TypeCompareKind comparison)