Binder\Binder_Conversions.cs (26)
307ReportUseSite(conversion.Method, diagnostics, syntax.Location);
539.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(Compilation, Conversions, includeNullability: false, syntax.Location, diagnostics));
1059ReportUseSite(collectionBuilderMethod, diagnostics, syntax.Location);
1067new ConstraintsHelper.CheckConstraintsArgs(Compilation, Conversions, syntax.Location, diagnostics));
1123diagnostics.Add(ErrorCode.ERR_NoNewAbstract, syntax.Location, namedType);
1140syntax.Location,
1182ReportConstructorUseSiteDiagnostics(node.Location, diagnostics, suppressUnsupportedRequiredMembersError: false, in overloadResolutionUseSiteInfo);
1212ReportConstructorUseSiteDiagnostics(typeNode.Location, diagnostics, suppressUnsupportedRequiredMembersError: false, in overloadResolutionUseSiteInfo);
1951source.Syntax.Location,
2288typeAndSyntax.Syntax.Location,
2304syntax.Location,
2392lambdaParameter.TryGetFirstLocation() ?? lambdaSymbol.SyntaxNode.Location);
2407ReportUnsafeIfNotAllowed(syntax.Location, diagnostics);
2464locationBuilder.Add(argument.NameColon?.Name.Location);
2470ImmutableArray.Create(tupleSyntax.Location));
2628return !methodSymbol.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, node.Location, diagnostics));
2681diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, receiverOpt.Type, memberSymbol.Name);
2686diagnostics.Add(ErrorCode.ERR_ObjectRequired, node.Location, memberSymbol);
2695diagnostics.Add(ErrorCode.ERR_InitializerAddHasWrongSignature, node.Location, memberSymbol);
2700diagnostics.Add(ErrorCode.ERR_BadAwaitArg, node.Location, receiverOpt.Type);
2704diagnostics.Add(ErrorCode.ERR_ObjectProhibited, node.Location, memberSymbol);
2711diagnostics.Add(ErrorCode.ERR_ObjectRequired, node.Location, memberSymbol);
2725diagnostics.Add(code, errorNode.Location, memberSymbol);
3007if (!MethodIsCompatibleWithDelegateOrFunctionPointer(receiverOpt, isExtensionMethod, selectedMethod, delegateOrFuncPtrType, syntax.Location, diagnostics) ||
3017Error(diagnostics, ErrorCode.ERR_DelegateOnConditional, syntax.Location, selectedMethod);
3025Error(diagnostics, ErrorCode.ERR_PartialMethodToDelegate, syntax.Location, selectedMethod);
Binder\Binder_Crefs.cs (10)
56diagnostics.Add(ErrorCode.WRN_BadXMLRef, syntax.Location, noTrivia.ToFullString());
109diagnostics.Add(ErrorCode.WRN_BadXMLRef, crefSyntax.Location, noTrivia.ToFullString());
141diagnostics.Add(ErrorCode.WRN_BadXMLRef, crefSyntax.Location, noTrivia.ToFullString());
741diagnostics.Add(ErrorCode.WRN_UnqualifiedNestedTypeInCref, parameterListSyntax.Parameters[i].Location);
904diagnostics.Add(ErrorCode.WRN_BadXMLRefTypeVar, crefSyntax.Location, crefSyntax.ToString());
910diagnostics.Add(ErrorCode.WRN_AmbiguousXMLReference, crefSyntax.Location, crefSyntax.ToString(), symbol, symbols[otherIndex]);
919diagnostics.Add(ErrorCode.WRN_BadXMLRefTypeVar, crefSyntax.Location, crefSyntax.ToString());
1066diagnostics.Add(ErrorCode.WRN_AmbiguousXMLReference, crefSyntax.Location, crefSyntax.ToString(), ambiguityWinner, viable[1]);
1182diagnostics.Add(ErrorCode.WRN_BadXMLRefReturnType, typeSyntax.Location);
1186diagnostics.Add(ErrorCode.WRN_BadXMLRefParamType, typeSyntax.Location, typeSyntax.ToString(), crefSyntax.ToString());
Binder\Binder_Expressions.cs (63)
329diagnostics.Add(op.NoCommonTypeError, op.Syntax.Location, trueArg, falseArg);
463diagnostics.Add(ErrorCode.WRN_CapturedPrimaryConstructorParameterInFieldInitializer, syntax.Location, parameter);
843diagnostics.Add(ErrorCode.ERR_InternalError, node.Location);
1036elementLocations.Add(nameSyntax.Location);
1040elementLocations.Add(argumentSyntax.Location);
1046diagnostics.Add(ErrorCode.ERR_VoidInTuple, argumentSyntax.Location);
1071tupleTypeOpt = NamedTypeSymbol.CreateTuple(node.Location, elements, locations, elementNames,
1389diagnostics.Add(ErrorCode.ERR_BadDynamicTypeof, node.Location);
1395diagnostics.Add(ErrorCode.ERR_BadNullableTypeof, node.Location);
1436bool typeHasErrors = type.IsErrorType() || CheckManagedAddr(Compilation, type, node.Location, diagnostics);
1819diagnostics.Add(ErrorCode.WRN_PrimaryConstructorParameterIsShadowedAndNotPassedToBase, node.Location, shadowedParameter);
2085diagnostics.Add(localSymbol.ForbiddenDiagnostic, node.Location, node);
2791diagnostics.Add(ErrorCode.ERR_ConvertToStaticClass, syntax.Location, targetType);
2797diagnostics.Add(ErrorCode.ERR_ValueCantBeNull, syntax.Location, targetType);
2808diagnostics.Add(ErrorCode.ERR_AmbigUDConv, syntax.Location, originalUserDefinedConversions[0], originalUserDefinedConversions[1], operand.Display, targetType);
2815diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, distinguisher1.First, distinguisher1.Second);
2826!MethodGroupConversionDoesNotExistOrHasErrors((BoundMethodGroup)operand, (NamedTypeSymbol)targetType, syntax.Location, diagnostics, out _))
2828diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, MessageID.IDS_SK_METHOD.Localize(), targetType);
2883diagnostics.Add(errorCode, syntax.Location, ((BoundUnconvertedAddressOfOperator)operand).Operand.Name, targetType);
2890diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, distinguisher.First, distinguisher.Second);
3171diagnostics.Add(ErrorCode.ERR_OutVariableCannotBeByRef, refType.Location);
3215diagnostics.Add(ErrorCode.ERR_OutVariableCannotBeByRef, refType.Location);
3240diagnostics.Add(ErrorCode.ERR_ScopedRefAndRefStructOnly, typeSyntax.Location);
3704diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerArgumentAttributeMalformed, unconvertedString.Syntax.Location, correspondingParameter, handlerType);
3812unconvertedString.Syntax.Location,
3831arguments[argumentIndex].Syntax.Location,
4171CheckManagedAddr(Compilation, bestType, node.Location, diagnostics, errorForManaged: true);
4529hasErrors = hasErrors || CheckManagedAddr(Compilation, elementType.Type, elementTypeSyntax.Location, diagnostics, errorForManaged: true);
5062diagnostics.Add(ErrorCode.WRN_CapturedPrimaryConstructorParameterPassedToBase, syntax.Location, parameter);
5210diagnostics.Add(ErrorCode.ERR_AnnotationDisallowedInObjectCreation, node.Location);
5233diagnostics.Add(ErrorCode.ERR_UnsafeTypeInObjectCreation, node.Location, type));
5243diagnostics.Add(ErrorCode.ERR_InvalidObjectCreation, node.Type.Location));
5259diagnostics.Add(ErrorCode.ERR_InsufficientStack, syntax.Location);
5361diagnostics.Add(ErrorCode.ERR_BadCtorArgCount, node.Location, type, 0);
5443hasErrors = MethodGroupConversionDoesNotExistOrHasErrors(methodGroup, type, node.Location, diagnostics, out conversion);
5450diagnostics.Add(ErrorCode.ERR_MethodNameExpected, argument.Syntax.Location);
5485diagnostics.Add(ErrorCode.ERR_MethDelegateMismatch, node.Location,
5511diagnostics.Add(ErrorCode.ERR_MethodNameExpected, argument.Syntax.Location);
5532diagnostics.Add(ErrorCode.ERR_InstantiatingStaticClass, node.Location, type);
5570diagnostics.Add(ErrorCode.ERR_InstantiatingStaticClass, node.Location, type);
5979diagnostics.Add(ErrorCode.ERR_InterpolatedStringsReferencingInstanceCannotBeInObjectInitializers, argument.Syntax.Location);
6212diagnostics.Add(ErrorCode.ERR_RequiredMembersMustBeAssignedValue, initializerExpression.Syntax.Location, requiredMember);
6229ObjectCreationExpressionSyntax { Type: { } type } => type.Location,
6231AttributeSyntax { Name: { } name } => name.Location,
6232_ => creationSyntax.Location
6696diagnostics.Add(ErrorCode.ERR_NoNewAbstract, node.Location, type);
6755typeNode.Location,
6792ReportConstructorUseSiteDiagnostics(typeNode.Location, diagnostics, suppressUnsupportedRequiredMembersError: false, in overloadResolutionUseSiteInfo);
6875ReportConstructorUseSiteDiagnostics(typeNode.Location, diagnostics, suppressUnsupportedRequiredMembersError: false, in overloadResolutionUseSiteInfo);
6959diagnostics.Add(ErrorCode.ERR_NoNewAbstract, node.Location, type);
7071diagnostics.Add(ErrorCode.ERR_BadCtorArgCount, typeNode.Location, interfaceType, analyzedArguments.Arguments.Count);
7100diagnostics.Add(ErrorCode.ERR_NoNewTyvar, node.Location, typeParameter);
7115diagnostics.Add(ErrorCode.ERR_NewTyvarWithArgs, node.Location, typeParameter);
7706diagnostics.Add(ErrorCode.ERR_BadUnaryOp, node.Location, SyntaxFacts.GetText(operatorToken.Kind()), msgId.Localize());
8208diagnostics.Add(new CSDiagnostic(lookupError, name.Location));
8838diagnostics.Add(errorInfo, expression.Location);
8952diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportRefFields, node.Location);
9397Error(diagnosticsForBindElementAccessCore, ErrorCode.ERR_InlineArrayBadIndex, node.Location);
9605diagnostics.Add(errorOpt ?? new CSDiagnosticInfo(ErrorCode.ERR_BadIndexLHS, expr.Display), node.Location);
10152location: syntax.Location,
11245var location = syntax.Location;
11433diagnostics.Add(new CSDiagnostic(diagnosticInfo, access.Syntax.Location));
11512diagnostics.Add(new CSDiagnostic(diagnosticInfo, node.Location));
Binder\Binder_InterpolatedString.cs (9)
112diagnostics.Add(ErrorCode.WRN_AlignmentMagnitude, alignment.Syntax.Location, alignmentConstant.Int32Value, magnitudeLimit);
117diagnostics.Add(ErrorCode.ERR_ConstantExpected, interpolation.AlignmentClause.Value.Location);
128diagnostics.Add(ErrorCode.ERR_EmptyFormatSpecifier, interpolation.FormatClause.Location);
133diagnostics.Add(ErrorCode.ERR_TrailingWhitespaceInFormatSpecifier, interpolation.FormatClause.Location);
804diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerCreationCannotUseDynamic, syntax.Location, interpolatedStringHandlerType.Name);
939parameterNamesAndLocationsBuilder.Add(("alignment", insert.Alignment.Syntax.Location));
945parameterNamesAndLocationsBuilder.Add(("format", insert.Format.Syntax.Location));
989diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnMalformed, part.Syntax.Location, method);
999diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnInconsistent, part.Syntax.Location, method, expected);
Binder\Binder_Invocation.cs (11)
172node.Location,
386diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_MethodNameExpected), expression.Location);
1036(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics))))
1463diagnostics.Add(ErrorCode.ERR_BadAttributeParamDefaultArgument, syntax.Location, parameter.Name);
1689diagnostics.Add(ErrorCode.ERR_BadAttributeArgument, syntax.Location);
1754diagnostics.Add(ErrorCode.ERR_NotNullRefDefaultParameter, syntax.Location, parameter.Name, parameterType);
2337diagnostics.Add(ErrorCode.ERR_NameofMethodGroupWithTypeParameters, argument.Location);
2384diagnostics.Add(ErrorCode.ERR_NameofExtensionMethod, methodGroup.Syntax.Location);
2429diagnostics.Add(ErrorCode.ERR_AliasQualifiedNameNotAnExpression, argument.Location);
2444diagnostics.Add(code, argument.Location);
2491node.Location,
Binder\Binder_Operators.cs (5)
3967hasErrors = CheckManagedAddr(Compilation, operandType, managedKind, node.Location, diagnostics);
4662isPatternDiagnostics.Add(ErrorCode.ERR_BadPatternExpression, node.Left.Location, operand.Display);
4703diagnostics.Add(ErrorCode.WRN_IsTypeNamedUnderscore, node.Right.Location, typeExpression.AliasOpt ?? (Symbol)targetType);
5778diagnostics.Add(ErrorCode.ERR_RefConditionalDifferentTypes, falseExpr.Syntax.Location, trueType);
5818diagnostics.Add(_inUnsafeRegion ? ErrorCode.WRN_MismatchedRefEscapeInTernary : ErrorCode.ERR_MismatchedRefEscapeInTernary, node.Location);
Binder\Binder_Patterns.cs (32)
31diagnostics.Add(ErrorCode.ERR_BadPatternExpression, node.Expression.Location, expression.Display);
67diagnostics.Add(ErrorCode.ERR_IsPatternImpossible, node.Location, expression.Type);
84diagnostics.Add(ErrorCode.WRN_IsPatternAlways, node.Location, expression.Type);
104diagnostics.Add(ErrorCode.WRN_GivenExpressionNeverMatchesPattern, node.Location);
111diagnostics.Add(ErrorCode.WRN_GivenExpressionAlwaysMatchesConstant, node.Location);
118diagnostics.Add(ErrorCode.WRN_GivenExpressionAlwaysMatchesPattern, node.Location);
212diagnostics.Add(ErrorCode.ERR_MisplacedSlicePattern, node.Location);
437diagnostics.Add(ErrorCode.ERR_CannotMatchOnINumberBase, node.Location, inputType);
477diagnostics.Add(ErrorCode.ERR_DefaultPattern, e.Location);
484diagnostics.Add(ErrorCode.ERR_IllegalSuppression, e.Location);
565diagnostics.Add(ErrorCode.ERR_ConstantValueOfTypeExpected, patternExpression.Location, strippedInputType);
569diagnostics.Add(ErrorCode.ERR_ConstantExpected, patternExpression.Location);
614diagnostics.Add(ErrorCode.ERR_ValueCantBeNull, expression.Syntax.Location, inputType);
624diagnostics.Add(ErrorCode.ERR_PatternWrongType, expression.Syntax.Location, inputType, expression.Display);
636expression.Syntax.Location, inputType, expression.Display, new CSharpRequiredLanguageVersion(requiredVersion));
655if (MessageID.IDS_FeatureSpanCharConstantPattern.CheckFeatureAvailability(diagnostics, Compilation, node.Location))
674diagnostics.Add(ErrorCode.ERR_PatternSpanCharCannotBeStringNull, convertedExpression.Syntax.Location, inputType);
738diagnostics.Add(ErrorCode.ERR_PointerTypeInPatternMatching, typeSyntax.Location);
968diagnostics.Add(ErrorCode.ERR_PointerTypeInPatternMatching, node.Location);
1086diagnostics.Add(ErrorCode.ERR_DeconstructParameterNameMismatch, subPattern.NameColon.Name.Location, name, parameterName);
1094diagnostics.Add(ErrorCode.ERR_IdentifierExpected, subPattern.ExpressionColon.Expression.Location);
1121diagnostics.Add(ErrorCode.ERR_ArgumentNameInITuplePattern, subpatternSyntax.NameColon.Location);
1125diagnostics.Add(ErrorCode.ERR_IdentifierExpected, subpatternSyntax.ExpressionColon.Expression.Location);
1165diagnostics.Add(ErrorCode.ERR_WrongNumberOfSubpatterns, node.Location, declType, elementTypesWithAnnotations.Length, node.Subpatterns.Count);
1184diagnostics.Add(ErrorCode.ERR_IdentifierExpected, subpatternSyntax.ExpressionColon.Expression.Location);
1311diagnostics.Add(ErrorCode.ERR_TupleElementNameMismatch, node.Location, name, $"Item{tupleIndex + 1}");
1327diagnostics.Add(ErrorCode.ERR_PointerTypeInPatternMatching, node.Location);
1438diagnostics.Add(ErrorCode.ERR_WrongNumberOfSubpatterns, tupleDesignation.Location,
1480diagnostics.Add(ErrorCode.ERR_PropertyPatternNameMissing, pattern.Location, pattern);
1650diagnostics.Add(ErrorCode.ERR_RelationalPatternWithNaN, node.Expression.Location);
1659diagnostics.Add(ErrorCode.ERR_UnsupportedTypeForRelationalPattern, node.Location, type.ToDisplayString());
1674diagnostics.Add(ErrorCode.ERR_CannotMatchOnINumberBase, node.Location, inputType);
Binder\Binder_Query.cs (10)
35diagnostics.Add(ErrorCode.ERR_BadDynamicQuery, fromClause.Expression.Location);
386diagnostics.Add(ErrorCode.ERR_BadDynamicQuery, join.InExpression.Location);
821node.Location
829new AnonymousTypeField(fieldName, fieldValue.Syntax.Location, TypeWithAnnotations.Create(TypeOrError(fieldValue)), RefKind.None, ScopedKind.None);
950diagnostics.Add(ErrorCode.ERR_NullNotValid, node.Location);
954diagnostics.Add(ErrorCode.ERR_DefaultLiteralNotValid, node.Location);
958diagnostics.Add(ErrorCode.ERR_ImplicitObjectCreationNotValid, node.Location);
962diagnostics.Add(ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax.Location, ((BoundNamespaceExpression)ultimateReceiver).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize());
967diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, MessageID.IDS_AnonMethod.Localize(), methodName);
989diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, "void", methodName);
Binder\Binder_Statements.cs (9)
415diagnostics.Add(ErrorCode.ERR_BadExceptionType, exprSyntax.Location);
1103localDiagnostics.Add(ErrorCode.ERR_ScopedRefAndRefStructOnly, typeSyntax.Location);
1310if (CheckManagedAddr(Compilation, elementType, initializerSyntax.Location, diagnostics))
1342additionalDiagnostics.Add(ErrorCode.WRN_PatternBadSignature, initializer.Syntax.Location, initializer.Type, "fixed", patternMethodSymbol);
1467diagnostics.Add(ErrorCode.ERR_VoidAssignment, op1.Syntax.Location);
2034_ => node.Location,
2263diagnostics.Add(ErrorCode.ERR_InternalError, syntax.Location);
2496var location = nodeForError.Location;
3452return node.Location;
Binder\Binder_Symbols.cs (23)
340var diagnosticInfo = diagnostics.Add(ErrorCode.ERR_BadSKknown, syntax.Location, syntax, symbol.Symbol.GetKindText(), MessageID.IDS_SK_TYPE.Localize());
564var location = syntax.Location;
569diagnostics.Add(diagnosticInfo, syntax.Location);
592return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(left, LookupResultKind.NotATypeOrNamespace, diagnostics.Add(ErrorCode.ERR_ColColWithTypeAlias, node.Alias.Location, node.Alias.Identifier.Text)));
606CheckManagedAddr(Compilation, elementType.Type, node.Location, diagnostics);
718locations.Add(argumentSyntax.Location);
742return NamedTypeSymbol.CreateTuple(syntax.Location,
1051if (!Compilation.HasDynamicEmitAttributes(bag, node.Location))
1059Symbol.ReportUseSiteDiagnostic(info, diagnostics, node.Location);
1229diagnostics.Add(ErrorCode.ERR_UnexpectedUnboundGenericName, node.Location);
1338diagnostics.Add(diagnosticInfo, node.Location);
1630type.CheckConstraintsForNamedType(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability, typeSyntax.Location, diagnostics),
1744diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, syntax.Location, descriptor.DeclaringTypeMetadataName, descriptor.Name);
1818return GetWellKnownType(type, diagnostics, node.Location);
1836return GetWellKnownType(compilation, type, diagnostics, node.Location);
2039diagnostics.Add(ErrorCode.WRN_SameFullNameThisNsAgg, where.Location, originalSymbols,
2050diagnostics.Add(ErrorCode.WRN_SameFullNameThisAggNs, where.Location, originalSymbols,
2061diagnostics.Add(ErrorCode.WRN_SameFullNameThisAggAgg, where.Location, originalSymbols,
2281diagnostics.Add(info, where.Location);
2302diagnostics.Add(errorInfo, where.Location);
2335diagnostics.Add(errorInfo, where.Location);
2383diagnostics.Add(new CSDiagnostic(result.Error, where.Location));
2595var location = where.Location;
Binder\ForEachLoopBinder.cs (22)
244messageId.CheckFeatureAvailability(diagnostics, Compilation, collectionExpr.Syntax.Location);
268diagnostics.Add(ErrorCode.ERR_BadGetAsyncEnumerator, expr.Location, getEnumeratorMethod.ReturnTypeWithAnnotations, getEnumeratorMethod);
330diagnostics.Add(ErrorCode.ERR_ScopedRefAndRefStructOnly, typeSyntax.Location);
815diagnostics.Add(errorCode, collectionSyntax.Location,
941diagnostics.Add(ErrorCode.ERR_AnonMethGrpInForEach, collectionSyntax.Location, collectionExpr.Display);
958diagnostics.Add(ErrorCode.ERR_BadDynamicAwaitForEach, collectionSyntax.Location);
990diagnostics.Add(ErrorCode.ERR_ForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetEnumeratorMethodName);
997diagnostics.Add(ErrorCode.ERR_AwaitForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetAsyncEnumeratorMethodName);
1066diagnostics.Add(isAsync ? ErrorCode.ERR_BadGetAsyncEnumerator : ErrorCode.ERR_BadGetEnumerator, collectionSyntax.Location, getEnumeratorMethod.ReturnType, getEnumeratorMethod);
1087diagnostics.Add(isAsync ? ErrorCode.ERR_MultipleIAsyncEnumOfT : ErrorCode.ERR_MultipleIEnumOfT, errorLocationSyntax.Location, unwrappedCollectionExprType,
1114diagnostics, errorLocationSyntax.Location, isOptional: false);
1122diagnostics.Add(ErrorCode.ERR_AwaitForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetAsyncEnumeratorMethodName);
1152diagnostics, errorLocationSyntax.Location, isOptional: false);
1159currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false);
1208diagnostics.Add(ErrorCode.ERR_NullNotValid, collectionExpr.Syntax.Location);
1480diagnostics.Add(ErrorCode.WRN_PatternNotPublicOrNotInstance, collectionSyntax.Location, patternType, patternName.Localize(), result);
1515diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, patternType, MessageID.IDS_Collection.Localize(),
1608diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, collectionExpr.Type, MessageID.IDS_Collection.Localize(),
1615location: collectionSyntax.Location,
1767diagnostics.Add(ErrorCode.WRN_PatternBadSignature, collectionSyntax.Location, enumeratorType, MessageID.IDS_Collection.Localize(), patternMemberCandidate);
1939diagnostics.Add(lookupResult.Error, collectionSyntax.Location);
1945diagnostics.Add(ErrorCode.ERR_NoSuchMember, collectionSyntax.Location, patternType, memberName);
Compiler\DocumentationCommentCompiler.cs (6)
1307diagnostics.Add(ErrorCode.WRN_UnmatchedParamTag, identifier.Location, identifier);
1310diagnostics.Add(ErrorCode.WRN_UnmatchedParamRefTag, identifier.Location, identifier, memberSymbol);
1313diagnostics.Add(ErrorCode.WRN_UnmatchedTypeParamTag, identifier.Location, identifier);
1316diagnostics.Add(ErrorCode.WRN_UnmatchedTypeParamRefTag, identifier.Location, identifier, memberSymbol);
1337diagnostics.Add(ErrorCode.WRN_DuplicateParamTag, syntax.Location, identifier);
1347diagnostics.Add(ErrorCode.WRN_DuplicateTypeParamTag, syntax.Location, identifier);
FlowAnalysis\DefiniteAssignment.cs (12)
1243Diagnostics.Add(ErrorCode.ERR_UseDefViolationOut, node.Location, symbolName);
1248Diagnostics.Add(ErrorCode.ERR_UseDefViolation, node.Location, symbolName);
1296Diagnostics.Add(ErrorCode.WRN_UseDefViolationThisSupportedVersion, node.Location);
1302node.Location,
1314Diagnostics.Add(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName);
1324Diagnostics.Add(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName);
1342node.Location,
1350node.Location,
1357node.Location,
1625LeaveParameter(param, node.Syntax, paramExpr.Syntax.Location);
2562_unsafeAddressTakenVariables.Add(variable, node.Syntax.Location);
2715_unsafeAddressTakenVariables.Add(receiver, node.Syntax.Location);
FlowAnalysis\NullableWalker.cs (8)
1361Diagnostics.Add(ErrorCode.WRN_ParameterConditionallyDisallowsNull, syntax.Location, parameter.Name, sense ? "true" : "false");
7997ReportDiagnostic(ErrorCode.WRN_DisallowNullAttributeForbidsMaybeNullAssignment, node.Location);
8631Diagnostics.Add(pair.UseSiteInfo.DiagnosticInfo, syntax.Location);
8661Diagnostics.Add(pair.UseSiteInfo.DiagnosticInfo, syntax.Location);
9080var locations = tupleOpt.TupleElements.SelectAsArray((element, location) => element.TryGetFirstLocation() ?? location, node.Syntax.Location);
9084tupleOpt.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(compilation, _conversions, includeNullability: true, node.Syntax.Location, diagnostics: null),
10331ReportNullabilityMismatchWithTargetDelegate(group.Syntax.Location, delegateType, delegateInvokeMethod, method, node.IsExtensionMethod);
10403ReportNullabilityMismatchWithTargetDelegate(arg.Syntax.Location, delegateType, delegateInvokeMethod, argInvokeMethod, invokedAsExtensionMethod: false);
Symbols\Source\SourceComplexParameterSymbol.cs (43)
284parameterEqualsValue.Value.Syntax.Location);
767diagnostics.Add(ErrorCode.ERR_DefaultValueUsedWithAttributes, arguments.AttributeSyntaxOpt.Name.Location);
773diagnostics.Add(ErrorCode.ERR_ExplicitParamArrayOrCollection, arguments.AttributeSyntaxOpt.Name.Location);
869diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.AttributeSyntaxOpt.Location);
874diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedTarget, arguments.AttributeSyntaxOpt.Location);
878diagnostics.Add(ErrorCode.ERR_UnscopedScoped, arguments.AttributeSyntaxOpt.Location);
933diagnostics.Add(ErrorCode.ERR_ParamDefaultValueDiffersFromAttribute, syntax.Location);
966diagnosticsOpt.Add(ErrorCode.ERR_DefaultValueUsedWithAttributes, node.Name.Location);
1004diagnosticsOpt.Add(ErrorCode.ERR_DefaultValueTypeMustMatch, node.Name.Location);
1014diagnosticsOpt.Add(ErrorCode.ERR_DefaultValueBadValueType, node.Name.Location, arg.TypeInternal);
1024diagnosticsOpt.Add(ErrorCode.ERR_DefaultValueTypeMustMatch, node.Name.Location);
1072diagnostics.Add(ErrorCode.WRN_CallerLineNumberParamForUnconsumedLocation, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1078diagnostics.Add(ErrorCode.ERR_NoConversionForCallerLineNumberParam, node.Name.Location, intType, TypeWithAnnotations.Type);
1085diagnostics.Add(ErrorCode.ERR_BadCallerLineNumberParamWithoutDefaultValue, node.Name.Location);
1100diagnostics.Add(ErrorCode.WRN_CallerFilePathParamForUnconsumedLocation, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1106diagnostics.Add(ErrorCode.ERR_NoConversionForCallerFilePathParam, node.Name.Location, stringType, TypeWithAnnotations.Type);
1113diagnostics.Add(ErrorCode.ERR_BadCallerFilePathParamWithoutDefaultValue, node.Name.Location);
1118diagnostics.Add(ErrorCode.WRN_CallerLineNumberPreferredOverCallerFilePath, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1133diagnostics.Add(ErrorCode.WRN_CallerMemberNameParamForUnconsumedLocation, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1139diagnostics.Add(ErrorCode.ERR_NoConversionForCallerMemberNameParam, node.Name.Location, stringType, TypeWithAnnotations.Type);
1146diagnostics.Add(ErrorCode.ERR_BadCallerMemberNameParamWithoutDefaultValue, node.Name.Location);
1151diagnostics.Add(ErrorCode.WRN_CallerLineNumberPreferredOverCallerMemberName, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1156diagnostics.Add(ErrorCode.WRN_CallerFilePathPreferredOverCallerMemberName, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1174diagnostics.Add(ErrorCode.WRN_CallerArgumentExpressionParamForUnconsumedLocation, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1180diagnostics.Add(ErrorCode.ERR_NoConversionForCallerArgumentExpressionParam, node.Name.Location, stringType, TypeWithAnnotations.Type);
1187diagnostics.Add(ErrorCode.ERR_BadCallerArgumentExpressionParamWithoutDefaultValue, node.Name.Location);
1192diagnostics.Add(ErrorCode.WRN_CallerLineNumberPreferredOverCallerArgumentExpression, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1197diagnostics.Add(ErrorCode.WRN_CallerFilePathPreferredOverCallerArgumentExpression, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1202diagnostics.Add(ErrorCode.WRN_CallerMemberNamePreferredOverCallerArgumentExpression, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1208diagnostics.Add(ErrorCode.WRN_CallerArgumentExpressionAttributeHasInvalidParameterName, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1213diagnostics.Add(ErrorCode.WRN_CallerArgumentExpressionAttributeSelfReferential, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1223diagnostics.Add(ErrorCode.WRN_UnconsumedEnumeratorCancellationAttributeUsage, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1254diagnostics.Add(ErrorCode.ERR_TypeIsNotAnInterpolatedStringHandlerType, arguments.AttributeSyntaxOpt.Location, Type);
1262diagnostics.Add(ErrorCode.WRN_InterpolatedStringHandlerArgumentAttributeIgnoredOnLambdaParameters, arguments.AttributeSyntaxOpt.Location);
1268diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerArgumentDisallowed, arguments.AttributeSyntaxOpt.Location);
1296diagnostics.Add(ErrorCode.ERR_NullInvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt!.Location);
1337diagnostics.Add(ErrorCode.ERR_NullInvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt.Location);
1357diagnostics.Add(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt.Location, ContainingSymbol);
1369diagnostics.Add(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt.Location, ContainingSymbol);
1380diagnostics.Add(ErrorCode.ERR_InvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt.Location, name, ContainingSymbol);
1387diagnostics.Add(ErrorCode.ERR_CannotUseSelfAsInterpolatedStringHandlerArgument, arguments.AttributeSyntaxOpt.Location);
1396diagnostics.Add(ErrorCode.WRN_ParameterOccursAfterInterpolatedStringHandlerParameter, arguments.AttributeSyntaxOpt.Location, parameter.Name, this.Name);
1686diagnostics.Add(syntax.Location, useSiteInfo);
Symbols\Source\SourceMethodSymbolWithAttributes.cs (24)
585diagnostics.Add(ErrorCode.ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync, arguments.AttributeSyntaxOpt.Location, arguments.AttributeSyntaxOpt.GetErrorDisplayName());
619diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.AttributeSyntaxOpt.Location);
633diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedMemberTarget, arguments.AttributeSyntaxOpt.Location);
710diagnostics.Add(ErrorCode.ERR_AttributeNotOnEventAccessor, arguments.AttributeSyntaxOpt.Name.Location, description.FullName, attributeUsage.GetValidTargetsErrorArgument());
732diagnostics.Add(ErrorCode.ERR_AttributeNotOnAccessor, node.Name.Location, node.GetErrorDisplayName(), attributeUsage.GetValidTargetsErrorArgument());
737diagnostics.Add(ErrorCode.ERR_ConditionalOnInterfaceMethod, node.Location);
742diagnostics.Add(ErrorCode.ERR_ConditionalOnOverride, node.Location, this);
747diagnostics.Add(ErrorCode.ERR_ConditionalOnSpecialMethod, node.Location, this);
752diagnostics.Add(ErrorCode.ERR_ConditionalMustReturnVoid, node.Location, this);
757diagnostics.Add(ErrorCode.ERR_ConditionalWithOutParam, node.Location, this);
761diagnostics.Add(ErrorCode.ERR_ConditionalOnLocalFunction, node.Location, this);
840diagnostics.Add(ErrorCode.ERR_DllImportOnInvalidMethod, arguments.AttributeSyntaxOpt.Name.Location);
856diagnostics.Add(ErrorCode.ERR_DllImportOnGenericMethod, arguments.AttributeSyntaxOpt.Name.Location);
893diagnostics.Add(ErrorCode.ERR_InvalidNamedArgument, arguments.AttributeSyntaxOpt.ArgumentList.Arguments[position].Location, namedArg.Key);
960diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeOrdinary, arguments.AttributeSyntaxOpt.Location);
970diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeAccessibleOutsideTopLevelType, arguments.AttributeSyntaxOpt.Location, Name);
978diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeStaticParameterlessVoid, arguments.AttributeSyntaxOpt.Location, Name);
984diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodAndContainingTypesMustNotBeGeneric, arguments.AttributeSyntaxOpt.Location, Name);
992diagnostics.Add(ErrorCode.ERR_ModuleInitializerCannotBeUnmanagedCallersOnly, arguments.AttributeSyntaxOpt.Location);
1025var attributeLocation = attributeNameSyntax.Location;
1169var attributeLocation = attributeSyntax.Location;
1391DecodeUnmanagedCallersOnlyAttributeData(this, arguments.Attribute, arguments.AttributeSyntaxOpt.Location, diagnostics);
1417diagnostics.Add(ErrorCode.ERR_CannotUseRefInUnmanagedCallersOnly, syntax.Location);
1433diagnostics.Add(ErrorCode.ERR_CannotUseManagedTypeInUnmanagedCallersOnly, syntax.Location, type, (isParam ? MessageID.IDS_Parameter : MessageID.IDS_Return).Localize());
Symbols\Source\SourceNamedTypeSymbol.cs (10)
1160diagnostics.Add(ErrorCode.ERR_CantUseRequiredAttribute, arguments.AttributeSyntaxOpt.Name.Location);
1191diagnostics.Add(ErrorCode.ERR_CollectionBuilderAttributeInvalidType, arguments.AttributeSyntaxOpt.Name.Location);
1201diagnostics.Add(ErrorCode.ERR_CollectionBuilderAttributeInvalidMethodName, arguments.AttributeSyntaxOpt.Name.Location);
1219diagnostics.Add(ErrorCode.ERR_AttributeOnBadSymbolType, arguments.AttributeSyntaxOpt.Name.Location, arguments.AttributeSyntaxOpt.GetErrorDisplayName(), "struct");
1223diagnostics.Add(ErrorCode.ERR_InlineArrayAttributeOnRecord, arguments.AttributeSyntaxOpt.Name.Location);
1313diagnosticsOpt.Add(ErrorCode.ERR_AttributeUsageOnNonAttributeClass, node.Name.Location, node.GetErrorDisplayName());
1399diagnostics.Add(ErrorCode.ERR_ConditionalOnNonAttributeClass, node.Location, node.GetErrorDisplayName());
1608diagnostics.Add(ErrorCode.ERR_ComImportWithoutUuidAttribute, allAttributeSyntaxNodes[index].Name.Location);
1656diagnostics.Add(ErrorCode.WRN_CoClassWithoutComImport, allAttributeSyntaxNodes[index].Location, this.Name);
1665diagnostics.Add(ErrorCode.ERR_DefaultMemberOnIndexedType, allAttributeSyntaxNodes[index].Name.Location);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (12)
334diagnostics.Add(ErrorCode.HDN_DuplicateWithGlobalUsing, namespaceOrType.UsingDirective!.NamespaceOrType.Location, namespaceOrType.NamespaceOrType);
482diagnostics.Add(ErrorCode.ERR_ExternAliasNotAllowed, aliasSyntax.Location);
663Location location = usingDirective.Alias.Name.Location;
699diagnostics.Add(ErrorCode.ERR_DuplicateAlias, usingDirective.Location, identifierValueText);
775diagnostics.Add(ErrorCode.ERR_BadUsingType, usingDirective.NamespaceOrType.Location, imported);
782usingDirective.NamespaceOrType.Location, imported);
793diagnostics.Add(ErrorCode.ERR_BadUsingNamespace, usingDirective.NamespaceOrType.Location, imported);
800diagnostics.Add(ErrorCode.ERR_GlobalUsingStaticFileType, usingDirective.NamespaceOrType.Location, imported);
808usingDirective.NamespaceOrType.Location, importedType);
820diagnostics.Add(ErrorCode.ERR_BadUsingStaticType, usingDirective.NamespaceOrType.Location, imported.GetKindText());
832diagnostics.Add(ErrorCode.ERR_BadSKknown, usingDirective.NamespaceOrType.Location,
1020var location = usingDirective.NamespaceOrType.Location;
Symbols\Symbol_Attributes.cs (6)
223arguments.Diagnostics.DiagnosticBag.Add(ErrorCode.ERR_ExplicitReservedAttr, arguments.AttributeSyntaxOpt.Location, AttributeDescription.CompilerFeatureRequiredAttribute.FullName);
235arguments.Diagnostics.DiagnosticBag.Add(ErrorCode.ERR_AttributeCannotBeAppliedManually, arguments.AttributeSyntaxOpt!.Location, args: [AttributeDescription.MetadataUpdateDeletedAttribute.FullName]);
482attributesToBind[i].ArgumentList?.Arguments[0].Expression.Location is { } location)
906diagnostics.Add(ErrorCode.ERR_DuplicateAttribute, node.Name.Location, node.GetErrorDisplayName());
926diagnostics.Add(ErrorCode.ERR_AttributeOnBadSymbolType, node.Name.Location, node.GetErrorDisplayName(), attributeUsageInfo.GetValidTargetsErrorArgument());
941diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidTarget, node.Name.Location, node.GetErrorDisplayName());
Symbols\Tuples\TupleTypeSymbol.cs (3)
65constructedType.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(compilation, compilation.Conversions, includeNullability, syntax.Location, diagnostics),
299diagnostics.Add(ErrorCode.WRN_TupleLiteralNameMismatch, literal.Arguments[i].Syntax.Parent!.Location, sourceName, destination);
503diagnostics.Add(useSiteInfo, static syntax => syntax?.Location ?? Location.None, syntax);