Binder\Binder.cs (10)
539internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, CSharpSyntaxNode syntax)
544internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, CSharpSyntaxNode syntax, params object[] args)
549internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, SyntaxToken token)
554internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, SyntaxToken token, params object[] args)
559internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, SyntaxNodeOrToken syntax)
566internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, SyntaxNodeOrToken syntax, params object[] args)
573internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, Location location)
578internal static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, Location location, params object[] args)
764? ErrorCode.ERR_UnmanagedCallersOnlyMethodsCannotBeConvertedToDelegate
765: ErrorCode.ERR_UnmanagedCallersOnlyMethodsCannotBeCalledDirectly,
Binder\Binder.ValueChecks.cs (147)
743Error(diagnostics, ErrorCode.ERR_BadSKknown, node, ns.NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
748Error(diagnostics, ErrorCode.ERR_BadSKknown, node, type.Type, MessageID.IDS_SK_TYPE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
777var errorCode = GetRangeLvalueError(valueKind);
778if (errorCode is ErrorCode.ERR_InvalidAddrOp or ErrorCode.ERR_RefLocalOrParamExpected)
794Error(diagnostics, ErrorCode.ERR_UnboxNotLValue, node);
814Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
826Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
851Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
937Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
964Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
988Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
1008var errorCode = GetThisLvalueError(valueKind, isValueType, isPrimaryConstructorParameter);
1009if (errorCode is ErrorCode.ERR_InvalidAddrOp or ErrorCode.ERR_IncrementLvalueExpected or ErrorCode.ERR_RefReturnThis or ErrorCode.ERR_RefLocalOrParamExpected or ErrorCode.ERR_RefLvalueExpected)
1024Error(diagnostics, ErrorCode.ERR_BadSKknown, expr.Syntax, ((BoundNamespaceExpression)expr).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
1027Error(diagnostics, ErrorCode.ERR_BadSKunknown, expr.Syntax, expr.Type, MessageID.IDS_SK_TYPE.Localize());
1040Error(diagnostics, ErrorCode.WRN_AddressOfInAsync, node);
1044Error(diagnostics, ErrorCode.ERR_AddressOfInIterator, node);
1062diagnostics.Add(ErrorCode.WRN_AssignmentToLockOrDispose, local.Syntax.Location, localSymbol);
1078diagnostics.Add(ErrorCode.ERR_RefLocalOrParamExpected, node.Location);
1112Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_RefReturnLocal2 : ErrorCode.ERR_RefReturnLocal2, local.Syntax, localSymbol);
1116Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_RefReturnLocal : ErrorCode.ERR_RefReturnLocal, node, localSymbol);
1123Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_RefReturnNonreturnableLocal2 : ErrorCode.ERR_RefReturnNonreturnableLocal2, local.Syntax, localSymbol);
1127Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_RefReturnNonreturnableLocal : ErrorCode.ERR_RefReturnNonreturnableLocal, node, localSymbol);
1132Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_EscapeVariable : ErrorCode.ERR_EscapeVariable, node, localSymbol);
1156Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
1196diagnostics.Add(ErrorCode.WRN_AssignmentToLockOrDispose, parameter.Syntax.Location, parameterSymbol.Name);
1210ErrorCode errorCode;
1214errorCode = ErrorCode.ERR_RefReturnReadonlyPrimaryConstructorParameter2;
1218errorCode = ErrorCode.ERR_RefReadonlyPrimaryConstructorParameter2;
1222errorCode = ErrorCode.ERR_AssgReadonlyPrimaryConstructorParameter2;
1229ErrorCode errorCode;
1233errorCode = ErrorCode.ERR_RefReturnReadonlyPrimaryConstructorParameter;
1237errorCode = ErrorCode.ERR_RefReadonlyPrimaryConstructorParameter;
1241errorCode = ErrorCode.ERR_AssgReadonlyPrimaryConstructorParameter;
1292Error(diagnostics, _inUnsafeRegion ? ErrorCode.WRN_EscapeVariable : ErrorCode.ERR_EscapeVariable, node, parameter);
1315Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_RefReturnStructThis : ErrorCode.ERR_RefReturnStructThis, node);
1322(checkingReceiver: true, isRefScoped: true, inUnsafeRegion: false, _) => (ErrorCode.ERR_RefReturnScopedParameter2, parameter.Syntax),
1323(checkingReceiver: true, isRefScoped: true, inUnsafeRegion: true, _) => (ErrorCode.WRN_RefReturnScopedParameter2, parameter.Syntax),
1324(checkingReceiver: true, isRefScoped: false, inUnsafeRegion: false, { IsReturnOnly: true }) => (ErrorCode.ERR_RefReturnOnlyParameter2, parameter.Syntax),
1325(checkingReceiver: true, isRefScoped: false, inUnsafeRegion: true, { IsReturnOnly: true }) => (ErrorCode.WRN_RefReturnOnlyParameter2, parameter.Syntax),
1326(checkingReceiver: true, isRefScoped: false, inUnsafeRegion: false, _) => (ErrorCode.ERR_RefReturnParameter2, parameter.Syntax),
1327(checkingReceiver: true, isRefScoped: false, inUnsafeRegion: true, _) => (ErrorCode.WRN_RefReturnParameter2, parameter.Syntax),
1328(checkingReceiver: false, isRefScoped: true, inUnsafeRegion: false, _) => (ErrorCode.ERR_RefReturnScopedParameter, node),
1329(checkingReceiver: false, isRefScoped: true, inUnsafeRegion: true, _) => (ErrorCode.WRN_RefReturnScopedParameter, node),
1330(checkingReceiver: false, isRefScoped: false, inUnsafeRegion: false, { IsReturnOnly: true }) => (ErrorCode.ERR_RefReturnOnlyParameter, node),
1331(checkingReceiver: false, isRefScoped: false, inUnsafeRegion: true, { IsReturnOnly: true }) => (ErrorCode.WRN_RefReturnOnlyParameter, node),
1332(checkingReceiver: false, isRefScoped: false, inUnsafeRegion: false, _) => (ErrorCode.ERR_RefReturnParameter, node),
1333(checkingReceiver: false, isRefScoped: false, inUnsafeRegion: true, _) => (ErrorCode.WRN_RefReturnParameter, node)
1398Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
1616Error(diagnostics, ErrorCode.ERR_WinRtEventPassedByRef, eventSyntax);
1680Error(diagnostics, ErrorCode.ERR_ReturnNotLValue, callSyntaxOpt, methodSymbol);
1698Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
1731Error(diagnostics, ErrorCode.ERR_ReturnNotLValue, expr.Syntax, propertySymbol);
1735Error(diagnostics, ErrorCode.ERR_RefProperty, node);
1762Error(diagnostics, ErrorCode.ERR_AssgReadonlyProp, node, propertySymbol);
1772Error(diagnostics, ErrorCode.ERR_AssignmentInitOnly, node, propertySymbol);
1793Error(diagnostics, ErrorCode.ERR_BadProtectedAccess, node, propertySymbol, accessThroughType, this.ContainingType);
1797Error(diagnostics, ErrorCode.ERR_InaccessibleSetter, node, propertySymbol);
1827Error(diagnostics, ErrorCode.ERR_PropertyLacksGet, node, propertySymbol);
1842Error(diagnostics, ErrorCode.ERR_BadProtectedAccess, node, propertySymbol, accessThroughType, this.ContainingType);
1846Error(diagnostics, ErrorCode.ERR_InaccessibleGetter, node, propertySymbol);
1866Error(diagnostics, ErrorCode.ERR_RefLocalOrParamExpected, node);
1937Error(diagnostics, ErrorCode.ERR_AbstractBaseCall, node, propertyOrEventSymbolOpt ?? member);
2826ErrorCode errorCode = GetStandardCallEscapeError(checkingReceiver);
2948Error(diagnostics, ErrorCode.ERR_CallArgMixing, syntax, symbolForReporting, parameterName);
3018Error(diagnostics, ErrorCode.ERR_CallArgMixing, syntax, symbolForReporting, parameterName);
3082private static ErrorCode GetStandardCallEscapeError(bool checkingReceiver)
3084return checkingReceiver ? ErrorCode.ERR_EscapeCall2 : ErrorCode.ERR_EscapeCall;
3191ErrorCode[] ReadOnlyLocalErrors =
3193ErrorCode.ERR_RefReadonlyLocalCause,
3194ErrorCode.ERR_AssgReadonlyLocalCause,
3196ErrorCode.ERR_RefReadonlyLocal2Cause,
3197ErrorCode.ERR_AssgReadonlyLocal2Cause
3205private static ErrorCode GetThisLvalueError(BindValueKind kind, bool isValueType, bool isPrimaryConstructorParameter)
3211return ErrorCode.ERR_AssgReadonlyLocal;
3214return ErrorCode.ERR_RefReadonlyLocal;
3217return ErrorCode.ERR_InvalidAddrOp;
3220return isValueType ? ErrorCode.ERR_AssgReadonlyLocal : ErrorCode.ERR_IncrementLvalueExpected;
3224return isPrimaryConstructorParameter ? ErrorCode.ERR_RefReturnPrimaryConstructorParameter : ErrorCode.ERR_RefReturnThis;
3227return ErrorCode.ERR_RefLocalOrParamExpected;
3232return ErrorCode.ERR_RefLvalueExpected;
3238private static ErrorCode GetRangeLvalueError(BindValueKind kind)
3245return ErrorCode.ERR_QueryRangeVariableReadOnly;
3248return ErrorCode.ERR_InvalidAddrOp;
3252return ErrorCode.ERR_RefReturnRangeVariable;
3255return ErrorCode.ERR_RefLocalOrParamExpected;
3260return ErrorCode.ERR_QueryOutRefRangeVariable;
3266private static ErrorCode GetMethodGroupOrFunctionPointerLvalueError(BindValueKind valueKind)
3270return ErrorCode.ERR_RefReadonlyLocalCause;
3274return ErrorCode.ERR_AssgReadonlyLocalCause;
3277private static ErrorCode GetStandardLvalueError(BindValueKind kind)
3283return ErrorCode.ERR_AssgLvalueExpected;
3286return ErrorCode.ERR_InvalidAddrOp;
3289return ErrorCode.ERR_IncrementLvalueExpected;
3292return ErrorCode.ERR_FixedNeedsLvalue;
3296return ErrorCode.ERR_RefReturnLvalueExpected;
3299return ErrorCode.ERR_RefLocalOrParamExpected;
3304return ErrorCode.ERR_RefLvalueExpected;
3313private static ErrorCode GetStandardRValueRefEscapeError(SafeContext escapeTo)
3317return ErrorCode.ERR_RefReturnLvalueExpected;
3320return ErrorCode.ERR_EscapeOther;
3336ErrorCode[] ReadOnlyErrors =
3338ErrorCode.ERR_RefReturnReadonly,
3339ErrorCode.ERR_RefReadonly,
3340ErrorCode.ERR_AssgReadonly,
3341ErrorCode.ERR_RefReturnReadonlyStatic,
3342ErrorCode.ERR_RefReadonlyStatic,
3343ErrorCode.ERR_AssgReadonlyStatic,
3344ErrorCode.ERR_RefReturnReadonly2,
3345ErrorCode.ERR_RefReadonly2,
3346ErrorCode.ERR_AssgReadonly2,
3347ErrorCode.ERR_RefReturnReadonlyStatic2,
3348ErrorCode.ERR_RefReadonlyStatic2,
3349ErrorCode.ERR_AssgReadonlyStatic2
3371Error(diagnostics, ErrorCode.ERR_InvalidAddrOp, node);
3377ErrorCode[] ReadOnlyErrors =
3379ErrorCode.ERR_RefReturnReadonlyNotField,
3380ErrorCode.ERR_RefReadonlyNotField,
3381ErrorCode.ERR_AssignReadonlyNotField,
3382ErrorCode.ERR_RefReturnReadonlyNotField2,
3383ErrorCode.ERR_RefReadonlyNotField2,
3384ErrorCode.ERR_AssignReadonlyNotField2,
4881Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_EscapeVariable : ErrorCode.ERR_EscapeVariable, node, expr.Syntax);
4890Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_EscapeVariable : ErrorCode.ERR_EscapeVariable, node, localSymbol);
4904Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_EscapeStackAlloc : ErrorCode.ERR_EscapeStackAlloc, node, expr.Type);
5213Error(diagnostics, ErrorCode.ERR_CollectionExpressionEscape, node, expr.Type);
5413diagnostics.Add(ErrorCode.ERR_InternalError, node.Location);
5665Error(diagnostics, _inUnsafeRegion ? ErrorCode.WRN_EscapeVariable : ErrorCode.ERR_EscapeVariable, initExpr.Syntax, expr.Syntax);
Binder\Binder_Attributes.cs (10)
252Error(diagnostics, ErrorCode.ERR_AttributeCtorInParameter, node, attributeConstructor.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat));
405Error(diagnostics, ErrorCode.ERR_BadAttributeParamType, syntax, parameter.Name, paramType.Type);
473diagnostics.Add(ErrorCode.ERR_NamedArgumentExpected, argument.Expression.GetLocation());
501Error(diagnostics, ErrorCode.ERR_DuplicateNamedAttributeArgument, argument, argumentName);
662diagnostics.Add(ErrorCode.ERR_BadNamedAttributeArgument,
675diagnostics.Add(ErrorCode.ERR_BadNamedAttributeArgumentType,
733diagnostics.Add(ErrorCode.ERR_BadAttributeArgument, syntax.Location);
891Binder.Error(diagnostics, ErrorCode.ERR_BadAttributeArgument, node.Syntax);
962Binder.Error(diagnostics, ErrorCode.ERR_AttrArgWithTypeVars, node.Syntax, typeOfArgument.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat));
1046Binder.Error(diagnostics, ErrorCode.ERR_BadAttributeArgument, node.Syntax);
Binder\Binder_Await.cs (22)
161info = new CSDiagnosticInfo(ErrorCode.ERR_BadAwaitInStaticVariableInitializer);
179new CSDiagnosticInfo(ErrorCode.ERR_BadAwaitInQuery) :
180new CSDiagnosticInfo(ErrorCode.ERR_BadAwaitWithoutAsyncLambda, ((LambdaSymbol)method).MessageID.Localize());
185new CSDiagnosticInfo(ErrorCode.ERR_BadAwaitWithoutVoidAsyncMethod) :
186new CSDiagnosticInfo(ErrorCode.ERR_BadAwaitWithoutAsyncMethod, method.ReturnType);
193info = new CSDiagnosticInfo(ErrorCode.ERR_BadAwaitWithoutAsync);
207Error(diagnostics, ErrorCode.ERR_AwaitInUnsafeContext, nodeOrToken.GetLocation()!);
212Error(diagnostics, ErrorCode.ERR_BadAwaitInLock, nodeOrToken.GetLocation()!);
217Error(diagnostics, ErrorCode.ERR_BadAwaitInCatchFilter, nodeOrToken.GetLocation()!);
223Error(diagnostics, ErrorCode.ERR_BadAwaitInFinally, nodeOrToken.GetLocation()!);
229Error(diagnostics, ErrorCode.ERR_BadAwaitInCatch, nodeOrToken.GetLocation()!);
305Error(diagnostics, ErrorCode.ERR_BadAwaitArgIntrinsic, node, expression.Display);
328Error(diagnostics, ErrorCode.ERR_BadAwaitArgVoidCall, node);
342Error(diagnostics, ErrorCode.ERR_BadAwaitArg, node, expression.Type);
353Error(diagnostics, ErrorCode.ERR_BadAwaitArg, node, expression.Type);
381Error(diagnostics, ErrorCode.ERR_NoSuchMember, node, awaiterType, WellKnownMemberNames.IsCompleted);
389Error(diagnostics, ErrorCode.ERR_PropertyLacksGet, node, isCompletedProperty);
396Error(diagnostics, ErrorCode.ERR_BadAwaiterPattern, node, awaiterType, awaitedExpressionType);
420Error(diagnostics, ErrorCode.ERR_DoesntImplementAwaitInterface, node, awaiterType, INotifyCompletion);
449Error(diagnostics, ErrorCode.ERR_NoSuchMember, node, awaiterType, WellKnownMemberNames.GetResult);
459Error(diagnostics, ErrorCode.ERR_NoSuchMember, node, awaiterType, WellKnownMemberNames.GetResult);
467Error(diagnostics, ErrorCode.ERR_BadAwaiterPattern, node, awaiterType, awaitedExpressionType);
Binder\Binder_Constraints.cs (24)
77diagnostics.Add(ErrorCode.ERR_DuplicateConstraintClause, clause.Name.Location, name);
89diagnostics.Add(ErrorCode.ERR_TyVarNotFoundInConstraint, clause.Name.Location, name, containingSymbol.ConstructedFrom());
201diagnostics.Add(ErrorCode.ERR_NewBoundWithVal, syntax.GetFirstToken().GetLocation());
205diagnostics.Add(ErrorCode.ERR_NewBoundWithUnmanaged, syntax.GetFirstToken().GetLocation());
210diagnostics.Add(ErrorCode.ERR_NewBoundMustBeLast, syntax.GetFirstToken().GetLocation());
220diagnostics.Add(ErrorCode.ERR_DefaultConstraintOverrideOnly, syntax.GetLocation());
304diagnostics.Add(ErrorCode.ERR_AllowsClauseMustBeLast, syntax.GetFirstToken().GetLocation());
315diagnostics.Add(ErrorCode.ERR_RefStructConstraintAlreadySpecified, allowsConstraint);
323Error(diagnostics, ErrorCode.ERR_RuntimeDoesNotSupportByRefLikeGenerics, allowsConstraint);
353diagnostics.Add(ErrorCode.ERR_OverrideWithConstraints, syntax.GetLocation());
360diagnostics.Add(ErrorCode.ERR_TypeConstraintsMustBeUniqueAndFirst, syntax.GetLocation());
455diagnostics.Add(ErrorCode.ERR_BadVisBound, location, containingSymbol, constraintType.Type);
471diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, location, constraintType.Type, containingSymbol);
499Error(diagnostics, ErrorCode.ERR_DuplicateBound, syntax, type.Type.SetUnknownNullabilityForReferenceTypes(), typeParameter.Name);
513Error(diagnostics, ErrorCode.ERR_ClassBoundNotFirst, syntax, type.Type);
528Error(diagnostics, ErrorCode.ERR_RefValBoundWithClass, syntax, type.Type);
537Error(diagnostics, ErrorCode.ERR_RefValBoundWithClass, syntax, type.Type);
543Error(diagnostics, ErrorCode.ERR_UnmanagedBoundWithClass, syntax, type.Type);
578Error(diagnostics, ErrorCode.ERR_SpecialTypeAsBound, syntax, type);
593Error(diagnostics, ErrorCode.ERR_DynamicTypeAsBound, syntax);
604Error(diagnostics, ErrorCode.ERR_ConstraintIsStaticClass, syntax, type);
613Error(diagnostics, ErrorCode.ERR_BadBoundType, syntax, type);
620Error(diagnostics, ErrorCode.ERR_BadConstraintType, syntax.GetLocation());
633Error(diagnostics, ErrorCode.ERR_ConstructedDynamicTypeAsBound, syntax, type);
Binder\Binder_Conversions.cs (5)
284diagnostics.Add(ErrorCode.WRN_ConvertingLock, source.Syntax);
425Error(diagnostics, ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, syntax);
441Error(diagnostics, ErrorCode.ERR_RuntimeDoesNotSupportInlineArrayTypes, syntax);
463Error(diagnostics, ErrorCode.ERR_InlineArrayConversionToReadOnlySpanNotSupported, syntax, destination);
477Error(diagnostics, ErrorCode.ERR_InlineArrayConversionToSpanNotSupported, syntax, destination);
Binder\Binder_Crefs.cs (13)
54diagnostics.Add(ErrorCode.WRN_BadXMLRef, syntax.Location, noTrivia.ToFullString());
107diagnostics.Add(ErrorCode.WRN_BadXMLRef, crefSyntax.Location, noTrivia.ToFullString());
136diagnostics.Add(ErrorCode.WRN_BadXMLRef, crefSyntax.Location, noTrivia.ToFullString());
543diagnostics.Add(ErrorCode.WRN_UnqualifiedNestedTypeInCref, parameterListSyntax.Parameters[i].Location);
706diagnostics.Add(ErrorCode.WRN_BadXMLRefTypeVar, crefSyntax.Location, crefSyntax.ToString());
712diagnostics.Add(ErrorCode.WRN_AmbiguousXMLReference, crefSyntax.Location, crefSyntax.ToString(), symbol, symbols[otherIndex]);
721diagnostics.Add(ErrorCode.WRN_BadXMLRefTypeVar, crefSyntax.Location, crefSyntax.ToString());
868diagnostics.Add(ErrorCode.WRN_AmbiguousXMLReference, crefSyntax.Location, crefSyntax.ToString(), ambiguityWinner, viable[1]);
984diagnostics.Add(ErrorCode.WRN_BadXMLRefReturnType, typeSyntax.Location);
988diagnostics.Add(ErrorCode.WRN_BadXMLRefParamType, typeSyntax.Location, typeSyntax.ToString(), crefSyntax.ToString());
1009switch ((ErrorCode)diag.Code)
1011case ErrorCode.ERR_DeprecatedSymbolStr:
1012case ErrorCode.ERR_DeprecatedCollectionInitAddStr:
Binder\Binder_Deconstruct.cs (18)
60Error(diagnostics, ErrorCode.ERR_DeclarationExpressionNotPermitted, declaration);
64Error(diagnostics, ErrorCode.ERR_DeclarationExpressionNotPermitted, declaration);
228Error(diagnostics, ErrorCode.ERR_DeconstructRequiresExpression, boundRHS.Syntax);
264Error(diagnostics, ErrorCode.ERR_DeconstructWrongCardinality, syntax, tupleOrDeconstructedTypes.Length, variables.Count);
272Error(diagnostics, ErrorCode.ERR_DeconstructTooFewElements, syntax);
414Error(diagnostics, ErrorCode.ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable, pending.Syntax, "_");
496Error(diagnostics, ErrorCode.ERR_DeconstructRequiresExpression, element.Syntax);
514Error(diagnostics, ErrorCode.ERR_DeconstructRequiresExpression, element.Syntax);
624Error(diagnostics, ErrorCode.ERR_CannotDeconstructDynamic, rightSyntax);
720Error(diagnostics, ErrorCode.ERR_MissingDeconstruct, rightSyntax, receiver.Type!, numParameters);
759Error(diagnostics, ErrorCode.ERR_DeconstructionVarFormDisallowsSpecificType, component.Designation);
782Error(diagnostics, ErrorCode.ERR_TupleElementNamesInDeconstruction, arg.NameColon);
825diagnostics.Add(ErrorCode.ERR_ScopedDiscard, scopedType.ScopedKeyword.GetLocation());
831diagnostics.Add(ErrorCode.ERR_DeconstructVariableCannotBeByRef, refType.RefKeyword.GetLocation());
891diagnostics.Add(ErrorCode.ERR_DeconstructVariableCannotBeByRef, refType.RefKeyword.GetLocation());
902diagnostics.Add(ErrorCode.ERR_ScopedRefAndRefStructOnly, typeSyntax.Location);
935diagnostics.Add(ErrorCode.ERR_UnexpectedToken, scopedType.ScopedKeyword.GetLocation(), scopedType.ScopedKeyword.ValueText);
941diagnostics.Add(ErrorCode.ERR_UnexpectedToken, refType.RefKeyword.GetLocation(), refType.RefKeyword.ValueText);
Binder\Binder_Expressions.cs (211)
302diagnostics.Add(ErrorCode.ERR_SwitchExpressionNoBestType, exprSyntax.SwitchKeyword.GetLocation());
320if (op.NoCommonTypeError == ErrorCode.ERR_InvalidQM && trueArg is Symbol trueSymbol && falseArg is Symbol falseSymbol)
358diagnostics.Add(ErrorCode.ERR_DefaultLiteralNoTargetType, defaultExpr.Syntax.GetLocation());
381diagnostics.Add(ErrorCode.ERR_ImplicitObjectCreationNoTargetType, expr.Syntax.GetLocation(), expr.Display);
401diagnostics.Add(ErrorCode.ERR_CollectionExpressionNoTargetType, expr.Syntax.GetLocation());
427diagnostics.Add(ErrorCode.ERR_CannotInferDelegateType, syntax.GetLocation());
463diagnostics.Add(ErrorCode.WRN_CapturedPrimaryConstructorParameterInFieldInitializer, syntax.Location, parameter);
549Error(diagnostics, ErrorCode.ERR_IllegalArglist, node);
613return BindUnexpectedArrayInitializer((InitializerExpressionSyntax)node, diagnostics, ErrorCode.ERR_ArrayInitInBadPlace);
843diagnostics.Add(ErrorCode.ERR_InternalError, node.Location);
859diagnostics.Add(ErrorCode.ERR_UnexpectedToken, firstToken.GetLocation(), firstToken.ValueText);
868diagnostics.Add(ErrorCode.ERR_UnexpectedToken, firstToken.GetLocation(), firstToken.ValueText);
875diagnostics.Add(ErrorCode.ERR_UnexpectedToken, firstToken.GetLocation(), firstToken.ValueText);
886diagnostics.Add(ErrorCode.ERR_ThrowMisplaced, node.ThrowKeyword.GetLocation());
939Error(diagnostics, ErrorCode.ERR_DeclarationExpressionNotPermitted, node);
1046diagnostics.Add(ErrorCode.ERR_VoidInTuple, argumentSyntax.Location);
1256Error(diagnostics, ErrorCode.ERR_MethodArgCantBeRefAny, node, argument.Type);
1326Error(diagnostics, ErrorCode.ERR_ArgsInvalid, node);
1340Error(diagnostics, ErrorCode.ERR_SpecialByRefInLambda, node, runtimeArgumentHandleType);
1389diagnostics.Add(ErrorCode.ERR_BadDynamicTypeof, node.Location);
1395diagnostics.Add(ErrorCode.ERR_BadNullableTypeof, node.Location);
1415diagnostics.Add(ErrorCode.ERR_AttrDependentTypeNotAllowed, attributeName, type);
1421diagnostics.Add(ErrorCode.ERR_AttrTypeArgCannotBeTypeVar, attributeName, type);
1452diagnostics.Add(ErrorCode.WRN_FieldIsAmbiguous, node, Compilation.LanguageVersion.ToDisplayString());
1479diagnostics.Add(ErrorCode.ERR_NoSuchMember, node, ContainingMember(), "field");
1518diagnostics.Add(ErrorCode.ERR_VariableDeclarationNamedField, syntax, requiredVersion.ToDisplayString());
1546diagnostics.Add(ErrorCode.ERR_ManagedAddr, location, type);
1550diagnostics.Add(ErrorCode.WRN_ManagedAddr, location, type);
1717Error(diagnostics, ErrorCode.ERR_QueryOuterKey, node, name);
1721Error(diagnostics, ErrorCode.ERR_QueryInnerKey, node, name);
1725Error(diagnostics, ErrorCode.ERR_NameNotInContext, node, name);
1817diagnostics.Add(ErrorCode.WRN_PrimaryConstructorParameterIsShadowedAndNotPassedToBase, node.Location, shadowedParameter);
2061Error(diagnostics, ErrorCode.ERR_VariableUsedBeforeDeclarationAndHidesField, node, node, possibleField);
2065Error(diagnostics, ErrorCode.ERR_VariableUsedBeforeDeclaration, node, node);
2098Error(diagnostics, ErrorCode.ERR_SpecialByRefInLambda, node, type);
2102Error(diagnostics, ErrorCode.ERR_AnonDelegateCantUseLocal, node, localSymbol);
2122Error(diagnostics, ErrorCode.ERR_InvalidPrimaryConstructorParameterReference, node, parameter);
2130Error(diagnostics, ErrorCode.ERR_InvalidExtensionParameterReference, node, parameter);
2146Error(diagnostics, ErrorCode.ERR_AnonDelegateCantUse, node, parameter.Name);
2150Error(diagnostics, ErrorCode.ERR_SpecialByRefInLambda, node, parameter.Type);
2155Error(diagnostics, ErrorCode.ERR_AnonDelegateCantUseRefLike, node, parameter.Name);
2169Error(diagnostics, ErrorCode.ERR_UnsupportedPrimaryConstructorParameterCapturingRef, node, parameter.Name);
2173Error(diagnostics, ErrorCode.ERR_UnsupportedPrimaryConstructorParameterCapturingRefAny, node, parameter.Type);
2178Error(diagnostics, ErrorCode.ERR_UnsupportedPrimaryConstructorParameterCapturingRefLike, node, parameter.Name);
2190Error(diagnostics, ErrorCode.ERR_AnonDelegateCantUseStructPrimaryConstructorParameterInMember, node);
2194Error(diagnostics, ErrorCode.ERR_AnonDelegateCantUseStructPrimaryConstructorParameterCaptured, node);
2278Error(diagnostics, ErrorCode.ERR_SimpleProgramLocalIsReferencedOutsideOfTopLevelStatement, node, node);
2316diagnosticInfoOpt = new CSDiagnosticInfo(ErrorCode.ERR_FieldInitRefNonstatic, member);
2321diagnosticInfoOpt = new CSDiagnosticInfo(ErrorCode.ERR_ObjectRequired, member);
2333diagnosticInfoOpt = new CSDiagnosticInfo(ErrorCode.ERR_ObjectRequired, member);
2451Error(diagnostics, ErrorCode.ERR_LabelNotFound, node, labelName);
2507Error(diagnostics, inStaticContext ? ErrorCode.ERR_ThisInStaticMeth : ErrorCode.ERR_ThisInBadContext, node);
2544return new CSDiagnosticInfo(ErrorCode.ERR_ThisStructNotInAnonMeth);
2560Error(diagnostics, inStaticContext ? ErrorCode.ERR_BaseInStaticMeth : ErrorCode.ERR_BaseInBadContext, node.Token);
2565Error(diagnostics, ErrorCode.ERR_NoBaseClass, node);
2570Error(diagnostics, ErrorCode.ERR_BaseIllegal, node.Token);
2621Error(diagnostics, ErrorCode.ERR_ValConstraintNotSatisfied, node, nullableType, nullableType.TypeParameters.Single(), indexType);
2701Error(diagnostics, ErrorCode.ERR_ValConstraintNotSatisfied, node, nullableType, nullableType.TypeParameters.Single(), rangeType);
2728Error(diagnostics, ErrorCode.ERR_ValConstraintNotSatisfied, operand, nullableType, nullableType.TypeParameters.Single(), indexType);
2789diagnostics.Add(ErrorCode.ERR_ConvertToStaticClass, syntax.Location, targetType);
2795diagnostics.Add(ErrorCode.ERR_ValueCantBeNull, syntax.Location, targetType);
2806diagnostics.Add(ErrorCode.ERR_AmbigUDConv, syntax.Location, originalUserDefinedConversions[0], originalUserDefinedConversions[1], operand.Display, targetType);
2813diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, distinguisher1.First, distinguisher1.Second);
2826diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, MessageID.IDS_SK_METHOD.Localize(), targetType);
2848Error(diagnostics, ErrorCode.ERR_ConversionNotTupleCompatible, syntax, tuple.Arguments.Length, targetType);
2858Error(diagnostics, ErrorCode.ERR_StackAllocConversionNotPossible, syntax, stackAllocExpression.ElementType, targetType);
2874var errorCode = targetType.TypeKind switch
2876TypeKind.FunctionPointer => ErrorCode.ERR_MethFuncPtrMismatch,
2877TypeKind.Delegate => ErrorCode.ERR_CannotConvertAddressOfToDelegate,
2878_ => ErrorCode.ERR_AddressOfToNonFunctionPointer
2888diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, distinguisher.First, distinguisher.Second);
3163diagnostics.Add(ErrorCode.ERR_ScopedDiscard, scopedType.ScopedKeyword.GetLocation());
3169diagnostics.Add(ErrorCode.ERR_OutVariableCannotBeByRef, refType.Location);
3213diagnostics.Add(ErrorCode.ERR_OutVariableCannotBeByRef, refType.Location);
3238diagnostics.Add(ErrorCode.ERR_ScopedRefAndRefStructOnly, typeSyntax.Location);
3258diagnostics.Add(ErrorCode.ERR_UnexpectedToken, scopedType.ScopedKeyword.GetLocation(), scopedType.ScopedKeyword.ValueText);
3264diagnostics.Add(ErrorCode.ERR_UnexpectedToken, refType.RefKeyword.GetLocation(), refType.RefKeyword.ValueText);
3384Error(diagnostics, ErrorCode.ERR_NamedArgumentSpecificationBeforeFixedArgument, argumentSyntax,
3701diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerArgumentAttributeMalformed, unconvertedString.Syntax.Location, correspondingParameter, handlerType);
3801ErrorCode.ERR_InterpolatedStringHandlerArgumentOptionalNotSpecified,
3820ErrorCode.ERR_InterpolatedStringHandlerArgumentLocatedAfterInterpolatedString,
3919ErrorCode.WRN_BadArgRef,
3931ErrorCode.WRN_RefReadonlyNotVariable,
3942ErrorCode.WRN_ArgExpectedRefOrIn,
3950ErrorCode.WRN_ArgExpectedIn,
4056Error(diagnostics, ErrorCode.ERR_MissingArraySize, firstRankSpecifier);
4071Error(diagnostics, ErrorCode.ERR_InvalidArray, arg);
4097Error(diagnostics, ErrorCode.ERR_NegativeArraySize, dimension);
4127Error(diagnostics, ErrorCode.ERR_ImplicitlyTypedArrayNoBestType, node);
4134Error(diagnostics, ErrorCode.ERR_ArrayElementCantBeRefAny, node, bestType);
4154Error(diagnostics, ErrorCode.ERR_ImplicitlyTypedArrayNoBestType, node);
4229Error(diagnostics, ErrorCode.ERR_ArrayInitializerExpected, expression);
4332Error(diagnostics, ErrorCode.ERR_ArrayInitializerIncorrectLength, node, knownSizeOpt.Value);
4366ErrorCode errorCode,
4446Error(diagnostics, ErrorCode.ERR_ConstantExpected, size.Syntax);
4480Error(diagnostics, ErrorCode.ERR_BadIndexCount, nonNullSyntax, type.Rank);
4500Error(diagnostics, ErrorCode.ERR_BadStackAllocExpr, typeSyntax);
4527Error(diagnostics, ErrorCode.ERR_BadStackAllocExpr, typeSyntax);
4557Error(diagnostics, ErrorCode.ERR_NegativeStackAllocSize, countSyntax);
4563Error(diagnostics, ErrorCode.ERR_MissingArraySize, rankSpecifiers[0]);
4592Error(diagnostics, ErrorCode.ERR_StackallocInCatchFinally, node);
4683Error(diagnostics, ErrorCode.ERR_ConstantExpected, sizeOpt.Syntax);
4688Error(diagnostics, ErrorCode.ERR_ArrayInitializerIncorrectLength, node, constantSizeOpt.Value);
4872diagnostics.Add(ErrorCode.ERR_ObjectCallingBaseConstructor, constructor.GetFirstLocation(), containingType);
4883diagnostics.Add(ErrorCode.ERR_StructWithBaseConstructorCall, constructor.GetFirstLocation(), containingType);
4925diagnostics.Add(ErrorCode.ERR_NoDynamicPhantomOnBaseCtor, errorLocation);
5002diagnostics.Add(ErrorCode.ERR_RecursiveConstructorCall,
5051diagnostics.Add(ErrorCode.WRN_CapturedPrimaryConstructorParameterPassedToBase, syntax.Location, parameter);
5069diagnostics.Add(ErrorCode.ERR_ChainingToSetsRequiredMembersRequiresSetsRequiredMembers, errorLocation);
5115diagnostics.Add(ErrorCode.ERR_CopyConstructorMustInvokeBaseCopyConstructor, errorLocation);
5124diagnostics.Add(ErrorCode.ERR_CopyConstructorMustInvokeBaseCopyConstructor, errorLocation);
5199diagnostics.Add(ErrorCode.ERR_AnnotationDisallowedInObjectCreation, node.Location);
5226diagnostics.Add(ErrorCode.ERR_UnsafeTypeInObjectCreation, node.Location, type));
5234diagnostics.Add(ErrorCode.ERR_InvalidObjectCreation, node.Type.Location));
5250diagnostics.Add(ErrorCode.ERR_InsufficientStack, syntax.Location);
5352diagnostics.Add(ErrorCode.ERR_BadCtorArgCount, node.Location, type, 0);
5365diagnostics.Add(ErrorCode.ERR_MethodNameExpected, loc);
5371Error(diagnostics, ErrorCode.ERR_ObjectOrCollectionInitializerWithDelegateCreation, node);
5441diagnostics.Add(ErrorCode.ERR_MethodNameExpected, argument.Syntax.Location);
5476diagnostics.Add(ErrorCode.ERR_MethDelegateMismatch, node.Location,
5502diagnostics.Add(ErrorCode.ERR_MethodNameExpected, argument.Syntax.Location);
5523diagnostics.Add(ErrorCode.ERR_InstantiatingStaticClass, node.Location, type);
5528diagnostics.Add(ErrorCode.ERR_NewWithTupleTypeSyntax, node.Type.GetLocation());
5561diagnostics.Add(ErrorCode.ERR_InstantiatingStaticClass, node.Location, type);
5763Error(diagnostics, ErrorCode.ERR_InvalidInitializerElementInitializer, memberInitializer);
5791Error(diagnostics, ErrorCode.ERR_InvalidInitializerElementInitializer, memberInitializer);
5929Error(diagnostics, ErrorCode.ERR_ReadonlyValueTypeInObjectInitializer, leftSyntax, fieldSymbol, fieldSymbol.Type);
5970diagnostics.Add(ErrorCode.ERR_InterpolatedStringsReferencingInstanceCannotBeInObjectInitializers, argument.Syntax.Location);
6052Error(diagnostics, ErrorCode.ERR_ValueTypePropertyInObjectInitializer, memberNameSyntax, propertySymbol, propertySymbol.Type);
6087Error(diagnostics, ErrorCode.ERR_NoSuchMember, memberNameSyntax, implicitReceiver.Type, member);
6096Error(diagnostics, ErrorCode.ERR_MemberCannotBeInitialized, memberNameSyntax, member);
6126Error(diagnostics, ErrorCode.ERR_MemberAlreadyInitialized, memberNameSyntax, memberName);
6203diagnostics.Add(ErrorCode.ERR_RequiredMembersMustBeAssignedValue, initializerExpression.Syntax.Location, requiredMember);
6229diagnostics.Add(ErrorCode.ERR_RequiredMemberMustBeSet, location, member);
6264Error(diagnostics, ErrorCode.ERR_CollectionInitRequiresIEnumerable, initializerSyntax, initializerType);
6353Error(diagnostics, ErrorCode.ERR_InvalidInitializerElementInitializer, elementInitializer);
6398Error(diagnostics, ErrorCode.ERR_EmptyElementInitializer, elementInitializer);
6552if (!((ErrorCode)diagnostic.Code is ErrorCode.WRN_ArgExpectedRefOrIn or ErrorCode.WRN_ArgExpectedIn))
6687diagnostics.Add(ErrorCode.ERR_NoNewAbstract, node.Location, type);
6950diagnostics.Add(ErrorCode.ERR_NoNewAbstract, node.Location, type);
6964Error(diagnostics, ErrorCode.ERR_MissingCoClass, node, coClassType, interfaceType);
6982Error(diagnostics, ErrorCode.ERR_BadCoClassSig, node, coClassType, interfaceType);
7008Error(diagnostics, ErrorCode.ERR_NoExplicitConv, node, distinguisher.First, distinguisher.Second);
7062diagnostics.Add(ErrorCode.ERR_BadCtorArgCount, typeNode.Location, interfaceType, analyzedArguments.Arguments.Count);
7091diagnostics.Add(ErrorCode.ERR_NoNewTyvar, node.Location, typeParameter);
7106diagnostics.Add(ErrorCode.ERR_NewTyvarWithArgs, node.Location, typeParameter);
7235diagnostics.Add(ErrorCode.ERR_BadAccess, errorLocation, result.ValidResult.Member);
7260if ((ErrorCode)diagnostic.Code == ErrorCode.ERR_RequiredMembersInvalid)
7346diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.Create(node.SyntaxTree, new TextSpan(token.Span.End - 1, 1)));
7350diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.Create(node.SyntaxTree, new TextSpan(token.Span.End - 2, 1)));
7602Error(diagnostics, ErrorCode.ERR_TypeArgsNotAllowed, right, right.Identifier.Text, SymbolKind.Property.Localize());
7614Error(diagnostics, ErrorCode.ERR_BadTypeArgument, typeArgumentsSyntax[i], typeArgument.Type);
7680diagnostics.Add(ErrorCode.ERR_BadUnaryOp, operatorToken.GetLocation(), SyntaxFacts.GetText(operatorToken.Kind()), leftType);
7687DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, SyntaxFacts.GetText(operatorToken.Kind()), boundLeft.Display);
7697diagnostics.Add(ErrorCode.ERR_BadUnaryOp, node.Location, SyntaxFacts.GetText(operatorToken.Kind()), msgId.Localize());
7773Error(diagnostics, ErrorCode.ERR_BadUnaryOp, node, operatorToken.Text, boundLeft.Display);
7901Error(diagnostics, ErrorCode.ERR_LookupInTypeVariable, boundLeft.Syntax, leftType);
7945Error(diagnostics, ErrorCode.WRN_DotOnDefault, node, boundLeft.Type);
7973Error(diagnostics, ErrorCode.ERR_BadSKunknown, methodGroup.NameSyntax, method, MessageID.IDS_SK_METHOD.Localize());
8151Error(diagnostics, ErrorCode.ERR_OmittedTypeArgument, node);
8211Error(diagnostics, ErrorCode.ERR_NoSuchMember, name, boundLeft.Display, plainName);
8218Error(diagnostics, ErrorCode.ERR_NoSuchMember, name, boundLeft.Type, plainName);
8222Error(diagnostics, ErrorCode.ERR_NoSuchMemberOrExtensionNeedUsing, name, boundLeft.Type, plainName, "System");
8226Error(diagnostics, ErrorCode.ERR_NoSuchMemberOrExtension, name, boundLeft.Type, plainName);
8451Error(diagnostics, ErrorCode.ERR_BadTypeReference, right, plainName, symbol);
8820var errorInfo = new CSDiagnosticInfo(ErrorCode.ERR_ExtensionResolutionFailed, receiverType, memberName);
8904Error(diagnostics, ErrorCode.ERR_BindToBogus, node, fieldSymbol);
8944Error(diagnostics, isFixedStatementExpression ? ErrorCode.ERR_FixedNotNeeded : ErrorCode.ERR_FixedBufferNotFixed, node);
8989diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportRefFields, node.Location);
9085Error(diagnostics, ErrorCode.ERR_BadAbstractStaticMemberAccess, node);
9091Error(diagnostics, ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, node);
9099Error(diagnostics, ErrorCode.ERR_BadNonVirtualInterfaceMemberAccessOnAllowsRefLike, node);
9105Error(diagnostics, ErrorCode.ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation, node);
9115Error(diagnostics, ErrorCode.ERR_RuntimeDoesNotSupportProtectedAccessForInterfaceMember, node);
9190ErrorCode errorCode = this.Flags.Includes(BinderFlags.ObjectInitializerMember) ?
9191ErrorCode.ERR_StaticMemberInObjectInitializer :
9192ErrorCode.ERR_ObjectProhibited;
9207Error(diagnostics, ErrorCode.ERR_ObjectRequired, node, symbol);
9431{ Code: (int)ErrorCode.ERR_BadIndexLHS, Arguments: [TypeSymbol type] } && type.Equals(expr.Type, TypeCompareKind.ConsiderEverything))
9434Error(diagnosticsForBindElementAccessCore, ErrorCode.ERR_InlineArrayBadIndex, node.Location);
9486Error(diagnostics, ErrorCode.ERR_NamedArgumentForInlineArray, node);
9523Error(diagnostics, ErrorCode.ERR_RefReturnLvalueExpected, location);
9562Error(diagnostics, ErrorCode.ERR_RuntimeDoesNotSupportInlineArrayTypes, node);
9589Error(diagnostics, ErrorCode.ERR_InlineArrayIndexOutOfRange, location);
9642diagnostics.Add(errorOpt ?? new CSDiagnosticInfo(ErrorCode.ERR_BadIndexLHS, expr.Display), node.Location);
9699Error(diagnostics, ErrorCode.ERR_NamedArgumentForArray, node);
9714Error(diagnostics, ErrorCode.ERR_BadIndexCount, node, rank);
9736Error(diagnostics, ErrorCode.WRN_NegativeArrayIndex, index.Syntax);
9908Error(diagnostics, ErrorCode.ERR_NamedArgumentForArray, node);
9923Error(diagnostics, ErrorCode.ERR_PtrIndexSingle, node);
9931Error(diagnostics, ErrorCode.ERR_VoidError, expr.Syntax);
9949Error(diagnostics, ErrorCode.ERR_BadArgExtraRef, analyzedArguments.Argument(i).Syntax, i + 1, refKind.ToArgumentDisplayString());
10037mustHaveAllOptionalParameters ? ErrorCode.ERR_IndexedPropertyMustHaveAllOptionalParams : ErrorCode.ERR_IndexedPropertyRequiresParams,
10082Error(diagnostics, ErrorCode.ERR_NoDynamicPhantomOnBaseIndexer, syntax);
10328? ErrorCode.ERR_ImplicitIndexIndexerWithName
10329: ErrorCode.ERR_ImplicitRangeIndexerWithName,
11296diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_InvalidDelegateType, possibleDelegateType), getErrorLocation());
11309if (diagnosticInfo.Code == (int)ErrorCode.ERR_InvalidDelegateType)
11311diagnostics.Add(new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_InvalidDelegateType, possibleDelegateType), getErrorLocation()));
11426DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_CannotBeMadeNullable, access.Display);
11505DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadUnaryOp, SyntaxFacts.GetText(operatorToken.Kind()), msgId.Localize());
11515Error(diagnostics, ErrorCode.ERR_BadUnaryOp, operatorToken.GetLocation(), operatorToken.Text, receiver.Display);
11522Error(diagnostics, ErrorCode.ERR_BadUnaryOp, operatorToken.GetLocation(), operatorToken.Text, receiverType);
11529Error(diagnostics, ErrorCode.ERR_BadUnaryOp, operatorToken.GetLocation(), operatorToken.Text, receiverType);
Binder\Binder_InterpolatedString.cs (18)
35ErrorCode.ERR_AltInterpolatedVerbatimStringsNotAvailable,
83ErrorCode.ERR_NewlinesAreNotAllowedInsideANonVerbatimInterpolatedString,
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);
763var nonOutConstructorHasArityError = nonOutConstructorDiagnostics.DiagnosticBag?.AsEnumerableWithoutResolution().Any(d => (ErrorCode)d.Code == ErrorCode.ERR_BadCtorArgCount) ?? false;
764var outConstructorHasArityError = outConstructorDiagnostics.DiagnosticBag?.AsEnumerableWithoutResolution().Any(d => (ErrorCode)d.Code == ErrorCode.ERR_BadCtorArgCount) ?? false;
804diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerCreationCannotUseDynamic, syntax.Location, interpolatedStringHandlerType.Name);
836if (!((ErrorCode)diagnostic.Code is ErrorCode.WRN_BadArgRef
837or ErrorCode.WRN_RefReadonlyNotVariable
838or ErrorCode.WRN_ArgExpectedRefOrIn
839or ErrorCode.WRN_ArgExpectedIn))
989diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnMalformed, part.Syntax.Location, method);
999diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnInconsistent, part.Syntax.Location, method, expected);
Binder\Binder_Invocation.cs (35)
171ErrorCode.ERR_BadSKknown,
291Error(diagnostics, ErrorCode.ERR_CantUseVoidInArglist, argument.Syntax);
306Error(diagnostics, ErrorCode.ERR_CantUseInOrOutInArglist, argument.Syntax);
379diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_MethodNameExpected), expression.Location);
414Error(diagnostics, ErrorCode.ERR_NoDynamicPhantomOnBase, node, methodGroup.Name);
518Error(diagnostics, ErrorCode.ERR_NamedArgumentSpecificationBeforeFixedArgumentInDynamicInvocation, arguments.Arguments[i].Syntax);
558Error(diagnostics, ErrorCode.ERR_CannotDynamicInvokeOnExpression, receiver.Syntax, receiver.Type);
568Error(diagnostics, ErrorCode.ERR_InDynamicMethodArg, arguments[argIndex].Syntax);
581Error(diagnostics, ErrorCode.ERR_BadDynamicQuery, node);
589Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArgLambda, arg.Syntax);
595Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArgMemgrp, arg.Syntax);
603Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, arg.Syntax, "__arglist");
612Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, arg.Syntax, arg.Type);
685ErrorCode.ERR_DynamicDispatchToParamsCollection,
834Error(diagnostics, ErrorCode.ERR_BadArgTypeDynamicExtension, syntax, methodGroup.ReceiverOpt.Type, methodGroup.Name);
867Error(diagnostics, ErrorCode.WRN_DynamicDispatchToConditionalMethod, syntax, methodGroup.Name);
925ErrorCode.ERR_DynamicLocalFunctionTypeParameter,
940ErrorCode.ERR_DynamicLocalFunctionParamsParameter,
1069Error(diagnostics, ErrorCode.ERR_NoImplicitConv, call.ReceiverOpt.Syntax, distinguisher.First, distinguisher.Second);
1075Error(diagnostics, ErrorCode.ERR_NoImplicitConv, call.ReceiverOpt.Syntax, distinguisher.First, distinguisher.Second);
1089Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, dynInvoke.Expression.Syntax, dynInvoke.Expression.Type);
1334ErrorCode code = hasBaseReceiver
1335? ErrorCode.ERR_CallingBaseFinalizeDeprecated
1336: ErrorCode.ERR_CallingFinalizeDeprecated;
1440diagnostics.Add(ErrorCode.ERR_BadAttributeParamDefaultArgument, syntax.Location, parameter.Name);
1666diagnostics.Add(ErrorCode.ERR_BadAttributeArgument, syntax.Location);
1731diagnostics.Add(ErrorCode.ERR_NotNullRefDefaultParameter, syntax.Location, parameter.Name, parameterType);
1848Error(diagnostics, ErrorCode.WRN_ImplicitCopyInReadOnlyMember, receiver.Syntax, method, ThisParameterSymbol.SymbolName);
1902if (code == (int)ErrorCode.WRN_PrimaryConstructorParameterIsShadowedAndNotPassedToBase &&
2288diagnostics.Add(ErrorCode.ERR_NameofMethodGroupWithTypeParameters, argument.Location);
2328diagnostics.Add(ErrorCode.ERR_NameofExtensionMethod, methodGroup.Syntax.Location);
2373diagnostics.Add(ErrorCode.ERR_AliasQualifiedNameNotAnExpression, argument.Location);
2387var code = top ? ErrorCode.ERR_ExpressionHasNoName : ErrorCode.ERR_SubexpressionNotInNameof;
Binder\Binder_Lambda.cs (10)
165Error(diagnostics, ErrorCode.ERR_DefaultValueNotAllowed, p.Default.EqualsToken);
175Error(diagnostics, ErrorCode.ERR_IllegalVarArgs, p);
284Error(diagnostics, syntax.Kind() == SyntaxKind.SimpleLambdaExpression ? ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression : ErrorCode.ERR_AttributesNotAllowed, attributeList);
299diagnostics.Add(ErrorCode.ERR_LambdaExplicitReturnTypeVar, syntax.Location);
311diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, syntax.Location, type);
335diagnostics.Add(ErrorCode.ERR_InconsistentLambdaParameterUsage,
343diagnostics.Add(ErrorCode.ERR_ImplicitlyTypedDefaultParameter,
405diagnostics.Add(ErrorCode.ERR_DuplicateParamName, lambda.ParameterLocation(i), name);
448diagnostics.Add(ErrorCode.INF_TooManyBoundLambdas, GetAnonymousFunctionLocation(pair.Key), truncatedToHundreds);
Binder\Binder_Lookup.cs (20)
377CSDiagnosticInfo diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_ConflictingAliasAndDefinition, name, existingDefinition.GetKindText());
777diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_AbstractAttributeClass, symbol) : null;
808diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_NotAnAttributeClass, symbol) : null;
925var diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_CircularBase, type, other);
1513diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_CantCallSpecialMethod, unwrappedSymbol) : null;
1528diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_BadAccess, new[] { unwrappedSymbol }, unwrappedSymbols, additionalLocations: ImmutableArray<Location>.Empty) : null;
1544diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadProtectedAccess, unwrappedSymbol, accessThroughType, this.ContainingType);
1548diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_FriendRefNotEqualToThis, unwrappedSymbol.ContainingAssembly.Identity.ToString(), AssemblyIdentity.PublicKeyToString(this.Compilation.Assembly.PublicKey));
1552diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadAccess, new[] { unwrappedSymbol }, ImmutableArray.Create<Symbol>(unwrappedSymbol), additionalLocations: ImmutableArray<Location>.Empty);
1564diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_ObjectRequired, unwrappedSymbol) : null;
1569diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_ObjectProhibited, unwrappedSymbol) : null;
1574diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_BadSKunknown, unwrappedSymbol, unwrappedSymbol.GetKindText()) : null;
1579diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_LabelNotFound, unwrappedSymbol.Name) : null;
1654new CSDiagnosticInfo(ErrorCode.ERR_BindToBogusProp2, symbol, method1, method2) :
1655new CSDiagnosticInfo(ErrorCode.ERR_BindToBogusProp1, symbol, method1 ?? method2);
1866diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_HasNoTypeVars, namedType, MessageID.IDS_SK_TYPE.Localize()) : null;
1871diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_BadArity, namedType, MessageID.IDS_SK_TYPE.Localize(), namedType.Arity) : null;
1887diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_HasNoTypeVars, method, MessageID.IDS_SK_METHOD.Localize()) : null;
1892diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_BadArity, method, MessageID.IDS_SK_METHOD.Localize(), method.Arity) : null;
1902diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_TypeArgsNotAllowed, symbol, symbol.Kind.Localize()) : null;
Binder\Binder_NameConflicts.cs (5)
74diagnostics.Add(ErrorCode.ERR_LocalSameNameAsExtensionTypeParameter, GetLocation(p), name);
79diagnostics.Add(ErrorCode.ERR_TypeParameterSameNameAsExtensionParameter, tp.GetFirstLocationOrNone(), name);
84diagnostics.Add(ErrorCode.ERR_LocalSameNameAsTypeParam, GetLocation(p), name);
92diagnostics.Add(ErrorCode.ERR_LocalSameNameAsExtensionParameter, GetLocation(p), name);
97diagnostics.Add(ErrorCode.ERR_DuplicateParamName, GetLocation(p), name);
Binder\Binder_Operators.cs (80)
89Error(diagnostics, ErrorCode.ERR_BadBinaryOps, node, node.OperatorToken.Text, left.Display, right.Display);
235Error(diagnostics, ErrorCode.ERR_VoidError, node);
295Error(diagnostics, ErrorCode.ERR_MissingPredefinedMember, node, delegateType, SourceEventSymbol.GetAccessorName(eventSymbol.Name, isAddition));
305Error(diagnostics, ErrorCode.ERR_BadAccess, node, method);
384Error(diagnostics, ErrorCode.ERR_BadBinaryOps, node, node.OperatorToken.Text, left.Display, right.Display);
399Error(diagnostics, ErrorCode.ERR_InvalidDynamicCondition, node.Left, left.Type, kind == BinaryOperatorKind.LogicalAnd ? "false" : "true");
477Error(diagnostics, ErrorCode.ERR_PossibleBadNegCast, node);
486Error(diagnostics, ErrorCode.ERR_PossibleBadNegCast, node);
609Error(diagnostics, ErrorCode.WRN_DoNotCompareFunctionPointers, node.OperatorToken);
617Error(diagnostics, ErrorCode.ERR_VoidError, node);
662if ((ErrorCode)code is not ErrorCode.WRN_ConvertingLock)
805ErrorCode errorCode = resultKind == LookupResultKind.Ambiguous ?
806ErrorCode.ERR_AmbigUnaryOp : // Operator '{0}' is ambiguous on an operand of type '{1}'
807ErrorCode.ERR_BadUnaryOp; // Operator '{0}' cannot be applied to operand of type '{1}'
839Error(diagnostics, ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, node, operatorToken.Text, "default");
842Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnDefault, node, operatorToken.Text, left.Display, right.Display);
846Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnUnconstrainedDefault, node, operatorToken.Text, right.Type);
850Error(diagnostics, ErrorCode.ERR_AmbigBinaryOpsOnUnconstrainedDefault, node, operatorToken.Text, left.Type);
853Error(diagnostics, ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, node, operatorToken.Text, left.Display);
856Error(diagnostics, ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, node, operatorToken.Text, right.Display);
861ErrorCode errorCode;
866errorCode = ErrorCode.ERR_AmbigBinaryOps; // Operator '{0}' is ambiguous on operands of type '{1}' and '{2}'
870errorCode = ErrorCode.ERR_BadBinaryReadOnlySpanConcatenation; // Operator '{0}' cannot be applied to operands of type '{1}' and '{2}' that are not UTF-8 byte representations
874errorCode = ErrorCode.ERR_BadBinaryOps; // Operator '{0}' cannot be applied to operands of type '{1}' and '{2}'
1168Error(diagnostics, ErrorCode.ERR_BadBoolOp, syntax, signature.Method);
1193Error(diagnostics, ErrorCode.ERR_MustHaveOpTF, syntax, signature.Method, t);
1830Error(diagnostics, ErrorCode.ERR_IntDivByZero, syntax);
1854Error(diagnostics, ErrorCode.ERR_ConstantStringTooLong, right.Syntax);
1869Error(diagnostics, ErrorCode.ERR_DecConstError, syntax);
1886Error(diagnostics, ErrorCode.WRN_CompileTimeCheckedOverflow, syntax, resultTypeSymbol);
1905Error(diagnostics, ErrorCode.ERR_CheckedOverflow, syntax);
2358Error(diagnostics, ErrorCode.ERR_VoidError, node);
2395Error(diagnostics, ErrorCode.ERR_BadAbstractStaticMemberAccess, node);
2405Error(diagnostics, ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, node);
2453Error(diagnostics, ErrorCode.ERR_IllegalSuppression, expr.Syntax);
2459Error(diagnostics, ErrorCode.ERR_DuplicateNullSuppression, expr.Syntax);
2493Error(diagnostics, ErrorCode.ERR_PtrExpected, node);
2507Error(diagnostics, ErrorCode.ERR_VoidError, node);
2553Error(diagnostics, isFixedStatementAddressOfExpression ? ErrorCode.ERR_FixedNotNeeded : ErrorCode.ERR_FixedNeeded, node);
2723Error(diagnostics, ErrorCode.ERR_IllegalSuppression, expr.Syntax);
2737Error(diagnostics, ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, node, operatorText, operand.Display);
2888Error(diagnostics, ErrorCode.WRN_CompileTimeCheckedOverflow, syntax, resultTypeSymbol);
2907Error(diagnostics, ErrorCode.ERR_CheckedOverflow, syntax);
3170Error(diagnostics, ErrorCode.ERR_LambdaInIsAs, node);
3182Error(diagnostics, ErrorCode.ERR_BadUnaryOp, node, SyntaxFacts.GetText(SyntaxKind.IsKeyword), operand.Display);
3206Error(diagnostics, ErrorCode.WRN_StaticInAsOrIs, node, targetType);
3212Error(diagnostics, ErrorCode.ERR_PointerInAsOrIs, node);
3240isPatternDiagnostics.Add(ErrorCode.ERR_BadPatternExpression, node.Left.Location, operand.Display);
3269Error(diagnostics, ErrorCode.ERR_IsNullableType, node.Right, targetType);
3281diagnostics.Add(ErrorCode.WRN_IsTypeNamedUnderscore, node.Right.Location, typeExpression.AliasOpt ?? (Symbol)targetType);
3310Error(diagnostics, ErrorCode.WRN_IsAlwaysFalse, node, targetType);
3319Error(diagnostics, ErrorCode.WRN_IsDynamicIsConfusing,
3371Error(diagnostics, ErrorCode.ERR_BadBinaryOps, syntax, "is", operandType, targetType);
3377ErrorCode errorCode = constantValue == ConstantValue.True ? ErrorCode.WRN_IsAlwaysTrue : ErrorCode.WRN_IsAlwaysFalse;
3718Error(diagnostics, ErrorCode.ERR_LambdaInIsAs, node);
3727Error(diagnostics, ErrorCode.ERR_TypelessTupleInAs, node);
3741Error(diagnostics, ErrorCode.ERR_AsNullableType, node.Right, targetType);
3751Error(diagnostics, ErrorCode.ERR_AsWithTypeVar, node, targetType);
3755Error(diagnostics, ErrorCode.ERR_PointerInAsOrIs, node);
3759Error(diagnostics, ErrorCode.ERR_AsMustHaveReferenceType, node, targetType);
3776Error(diagnostics, ErrorCode.WRN_StaticInAsOrIs, node, targetType);
3810Error(diagnostics, ErrorCode.ERR_PointerInAsOrIs, node);
3897Error(diagnostics, ErrorCode.ERR_NoExplicitBuiltinConv, node, distinguisher.First, distinguisher.Second);
3930Error(diagnostics, ErrorCode.ERR_BadBinaryOps, node, "as", operandType, targetType);
3935Error(diagnostics, ErrorCode.WRN_AlwaysNull, node, targetType);
3977Error(diagnostics, ErrorCode.ERR_BadBinaryOps, node, SyntaxFacts.GetText(node.OperatorToken.Kind()), leftOperand.Display, rightOperand.Display);
4003Error(diagnostics, ErrorCode.ERR_BadOpOnNullOrDefaultOrNew, node, node.OperatorToken.Text, "default");
4235Error(diagnostics, ErrorCode.ERR_BadBinaryOps, node, SyntaxFacts.GetText(node.OperatorToken.Kind()), leftOperand.Display, rightOperand.Display);
4285diagnostics.Add(ErrorCode.ERR_RefConditionalNeedsTwoRefs, whenFalse.GetFirstToken().GetLocation());
4290diagnostics.Add(ErrorCode.ERR_RefConditionalNeedsTwoRefs, whenTrue.GetFirstToken().GetLocation());
4314ErrorCode noCommonTypeError = hadMultipleCandidates ? ErrorCode.ERR_AmbigQM : ErrorCode.ERR_InvalidQM;
4356diagnostics.Add(ErrorCode.ERR_RefConditionalDifferentTypes, falseExpr.Syntax.Location, trueType);
4396diagnostics.Add(_inUnsafeRegion ? ErrorCode.WRN_MismatchedRefEscapeInTernary : ErrorCode.ERR_MismatchedRefEscapeInTernary, node.Location);
Binder\Binder_Patterns.cs (45)
30diagnostics.Add(ErrorCode.ERR_BadPatternExpression, node.Expression.Location, expression.Display);
66diagnostics.Add(ErrorCode.ERR_IsPatternImpossible, node.Location, expression.Type);
83diagnostics.Add(ErrorCode.WRN_IsPatternAlways, node.Location, expression.Type);
103diagnostics.Add(ErrorCode.WRN_GivenExpressionNeverMatchesPattern, node.Location);
110diagnostics.Add(ErrorCode.WRN_GivenExpressionAlwaysMatchesConstant, node.Location);
117diagnostics.Add(ErrorCode.WRN_GivenExpressionAlwaysMatchesPattern, node.Location);
211diagnostics.Add(ErrorCode.ERR_MisplacedSlicePattern, node.Location);
306Error(diagnostics, ErrorCode.ERR_UnsupportedTypeForListPattern, node, inputType);
378Error(diagnostics, ErrorCode.ERR_ListPatternRequiresLength, node, inputType);
436diagnostics.Add(ErrorCode.ERR_CannotMatchOnINumberBase, node.Location, inputType);
476diagnostics.Add(ErrorCode.ERR_DefaultPattern, e.Location);
483diagnostics.Add(ErrorCode.ERR_IllegalSuppression, e.Location);
564diagnostics.Add(ErrorCode.ERR_ConstantValueOfTypeExpected, patternExpression.Location, strippedInputType);
568diagnostics.Add(ErrorCode.ERR_ConstantExpected, patternExpression.Location);
613diagnostics.Add(ErrorCode.ERR_ValueCantBeNull, expression.Syntax.Location, inputType);
623diagnostics.Add(ErrorCode.ERR_PatternWrongType, expression.Syntax.Location, inputType, expression.Display);
634diagnostics.Add(ErrorCode.ERR_ConstantPatternVsOpenType,
673diagnostics.Add(ErrorCode.ERR_PatternSpanCharCannotBeStringNull, convertedExpression.Syntax.Location, inputType);
737diagnostics.Add(ErrorCode.ERR_PointerTypeInPatternMatching, typeSyntax.Location);
743Error(diagnostics, ErrorCode.ERR_PatternNullableType, typeSyntax, patternType.GetNullableUnderlyingType());
748Error(diagnostics, ErrorCode.ERR_PatternNullableType, typeSyntax, patternType);
753Error(diagnostics, ErrorCode.ERR_VarDeclIsStaticClass, typeSyntax, patternType);
760Error(diagnostics, ErrorCode.ERR_PatternDynamicType, typeSyntax);
776Error(diagnostics, ErrorCode.ERR_PatternWrongGenericTypeInVersion, typeSyntax,
786Error(diagnostics, ErrorCode.ERR_PatternWrongType, typeSyntax, inputType, patternType);
882diagnostics.Add(ErrorCode.ERR_DesignatorBeneathPatternCombinator, identifier.GetLocation());
967diagnostics.Add(ErrorCode.ERR_PointerTypeInPatternMatching, node.Location);
1085diagnostics.Add(ErrorCode.ERR_DeconstructParameterNameMismatch, subPattern.NameColon.Name.Location, name, parameterName);
1093diagnostics.Add(ErrorCode.ERR_IdentifierExpected, subPattern.ExpressionColon.Expression.Location);
1120diagnostics.Add(ErrorCode.ERR_ArgumentNameInITuplePattern, subpatternSyntax.NameColon.Location);
1124diagnostics.Add(ErrorCode.ERR_IdentifierExpected, subpatternSyntax.ExpressionColon.Expression.Location);
1164diagnostics.Add(ErrorCode.ERR_WrongNumberOfSubpatterns, node.Location, declType, elementTypesWithAnnotations.Length, node.Subpatterns.Count);
1183diagnostics.Add(ErrorCode.ERR_IdentifierExpected, subpatternSyntax.ExpressionColon.Expression.Location);
1310diagnostics.Add(ErrorCode.ERR_TupleElementNameMismatch, node.Location, name, $"Item{tupleIndex + 1}");
1326diagnostics.Add(ErrorCode.ERR_PointerTypeInPatternMatching, node.Location);
1335diagnostics.Add(ErrorCode.ERR_VarMayNotBindToType, node.VarKeyword.GetLocation(), foundSymbol.ToDisplayString());
1437diagnostics.Add(ErrorCode.ERR_WrongNumberOfSubpatterns, tupleDesignation.Location,
1479diagnostics.Add(ErrorCode.ERR_PropertyPatternNameMissing, pattern.Location, pattern);
1524Error(diagnostics, ErrorCode.ERR_InvalidNameInSubpattern, expr);
1584Error(diagnostics, ErrorCode.ERR_NoSuchMember, memberName, implicitReceiver.Type, name);
1593Error(diagnostics, ErrorCode.ERR_PropertyLacksGet, memberName, name);
1638diagnostics.Add(ErrorCode.ERR_InvalidExprTerm, node.OperatorToken.GetLocation(), node.OperatorToken.Text);
1649diagnostics.Add(ErrorCode.ERR_RelationalPatternWithNaN, node.Expression.Location);
1658diagnostics.Add(ErrorCode.ERR_UnsupportedTypeForRelationalPattern, node.Location, type.ToDisplayString());
1673diagnostics.Add(ErrorCode.ERR_CannotMatchOnINumberBase, node.Location, inputType);
Binder\Binder_Query.cs (11)
35diagnostics.Add(ErrorCode.ERR_BadDynamicQuery, fromClause.Expression.Location);
386diagnostics.Add(ErrorCode.ERR_BadDynamicQuery, join.InExpression.Location);
735Error(d, ErrorCode.ERR_QueryRangeVariableAssignedBadValue, errorLocation, yExpression.Display);
740Error(d, ErrorCode.ERR_QueryRangeVariableAssignedBadValue, errorLocation, yExpression.Type!);
939diagnostics.Add(ErrorCode.ERR_NullNotValid, node.Location);
943diagnostics.Add(ErrorCode.ERR_DefaultLiteralNotValid, node.Location);
947diagnostics.Add(ErrorCode.ERR_ImplicitObjectCreationNotValid, node.Location);
951diagnostics.Add(ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax.Location, ((BoundNamespaceExpression)ultimateReceiver).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize());
956diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, MessageID.IDS_AnonMethod.Localize(), methodName);
966Error(diagnostics, ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax, ultimateReceiver.Type, MessageID.IDS_SK_TYVAR.Localize());
978diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, "void", methodName);
Binder\Binder_Statements.cs (130)
55Error(diagnostics, ErrorCode.ERR_AttributesNotAllowed, attributeList);
176Error(diagnostics, ErrorCode.ERR_IllegalUnsafe, node.UnsafeKeyword);
256Error(diagnostics, ErrorCode.ERR_BadYieldInFinally, node.YieldKeyword);
260Error(diagnostics, ErrorCode.ERR_BadYieldInTryOfCatch, node.YieldKeyword);
264Error(diagnostics, ErrorCode.ERR_BadYieldInCatch, node.YieldKeyword);
268Error(diagnostics, ErrorCode.ERR_YieldNotAllowedInScript, node.YieldKeyword);
272Error(diagnostics, ErrorCode.ERR_BadYieldInUnsafe, node.YieldKeyword);
283Error(diagnostics, ErrorCode.ERR_BadYieldInFinally, node.YieldKeyword);
287Error(diagnostics, ErrorCode.ERR_YieldNotAllowedInScript, node.YieldKeyword);
327diagnostics.Add(ErrorCode.ERR_BadEmbeddedStmt, node.GetLocation());
345diagnostics.Add(ErrorCode.ERR_BadEmbeddedStmt, node.GetLocation());
380diagnostics.Add(ErrorCode.WRN_PossibleMistakenNullStatement, node.GetLocation());
415diagnostics.Add(ErrorCode.ERR_BadExceptionType, exprSyntax.Location);
446diagnostics.Add(ErrorCode.ERR_BadEmptyThrow, node.ThrowKeyword.GetLocation());
457diagnostics.Add(ErrorCode.ERR_BadEmptyThrowInFinally, node.ThrowKeyword.GetLocation());
486Error(diagnostics, ErrorCode.ERR_DuplicateLabel, node.Identifier, node.Identifier.ValueText);
498Error(diagnostics, ErrorCode.ERR_LabelShadow, node.Identifier, node.Identifier.ValueText);
534Error(diagnostics, ErrorCode.ERR_InvalidGotoCase, node);
584diagnostics.Add(ErrorCode.ERR_LocalFunctionMissingBody, localSymbol.GetFirstLocation(), localSymbol);
590diagnostics.Add(ErrorCode.ERR_ExternHasBody, localSymbol.GetFirstLocation(), localSymbol);
630blockDiagnostics.Add(ErrorCode.ERR_ReturnExpected, localSymbol.GetFirstLocation(), localSymbol);
659Error(diagnostics, ErrorCode.ERR_IllegalStatement, syntax);
684Error(diagnostics, ErrorCode.WRN_UnobservedAwaitableExpression, expression.Syntax);
809Error(diagnostics, ErrorCode.ERR_ImplicitlyTypedVariableCannotBeConst, declarationNode);
833Error(diagnostics, ErrorCode.ERR_ImplicitlyTypedVariableMultipleDeclarator, declarationNode);
849Error(diagnostics, ErrorCode.ERR_VarDeclIsStaticClass, typeSyntax, declType.Type);
854Error(diagnostics, ErrorCode.ERR_BadConstType, typeSyntax, declType.Type);
879Error(diagnostics, ErrorCode.ERR_ImplicitlyTypedVariableWithNoInitializer, errorSyntax);
888diagnostics, ErrorCode.ERR_ImplicitlyTypedVariableAssignedArrayInitializer, errorSyntax);
903Error(diagnostics, ErrorCode.ERR_ImplicitlyTypedVariableAssignedBadValue, errorSyntax, expression.Display);
924Error(diagnostics, ErrorCode.ERR_InitializeByValueVariableWithReference, node);
936Error(diagnostics, ErrorCode.ERR_ByReferenceVariableMustBeInitialized, node);
941Error(diagnostics, ErrorCode.ERR_InitializeByReferenceVariableWithValue, node);
1029Error(localDiagnostics, ErrorCode.ERR_ImplicitlyTypedVariableAssignedBadValue, declarator, declTypeOpt.Type);
1038Error(localDiagnostics, ErrorCode.ERR_VarDeclIsStaticClass, typeSyntax, initializerType);
1080Error(localDiagnostics, ErrorCode.ERR_ImplicitlyTypedLocalCannotBeFixed, declarator);
1089Error(localDiagnostics, declTypeOpt.Type.IsFunctionPointer() ? ErrorCode.ERR_CannotUseFunctionPointerAsFixedLocal : ErrorCode.ERR_BadFixedInitType, declarator);
1103localDiagnostics.Add(ErrorCode.ERR_ScopedRefAndRefStructOnly, typeSyntax.Location);
1119Error(localDiagnostics, ErrorCode.ERR_FixedMustInit, declarator);
1237Error(diagnostics, ErrorCode.ERR_ExprCannotBeFixed, initializerSyntax);
1305Error(diagnostics, ErrorCode.ERR_ExprCannotBeFixed, initializerSyntax);
1342additionalDiagnostics.Add(ErrorCode.WRN_PatternBadSignature, initializer.Syntax.Location, initializer.Type, "fixed", patternMethodSymbol);
1467diagnostics.Add(ErrorCode.ERR_VoidAssignment, op1.Syntax.Location);
1568var errorCode = (rightEscape, _inUnsafeRegion) switch
1570({ IsReturnOnly: true }, false) => ErrorCode.ERR_RefAssignReturnOnly,
1571({ IsReturnOnly: true }, true) => ErrorCode.WRN_RefAssignReturnOnly,
1572(_, false) => ErrorCode.ERR_RefAssignNarrower,
1573(_, true) => ErrorCode.WRN_RefAssignNarrower
1597var errorCode = _inUnsafeRegion ? ErrorCode.WRN_RefAssignValEscapeWider : ErrorCode.ERR_RefAssignValEscapeWider;
1764new CSDiagnosticInfo(ErrorCode.ERR_BadEventUsage, leastOverridden, leastOverridden.ContainingType) :
1765new CSDiagnosticInfo(ErrorCode.ERR_BadEventUsageNoField, leastOverridden);
1857result = BindUnexpectedArrayInitializer((InitializerExpressionSyntax)node, diagnostics, ErrorCode.ERR_ArrayInitToNonArrayType);
1882Error(diagnostics, ErrorCode.ERR_AttributesNotAllowed, node.AttributeLists[0]);
1965Error(diagnostics, ErrorCode.ERR_RefAssignmentMustHaveIdentityConversion, expression.Syntax, targetType);
1987ErrorCode.ERR_NoImplicitConv,
2060conversionError(diagnostics, ErrorCode.ERR_CannotInferDelegateType);
2068conversionError(diagnostics, ErrorCode.ERR_AnonMethToNonDel, id, targetType);
2075conversionError(diagnostics, ErrorCode.ERR_ExpressionTreeMustHaveDelegate, ((NamedTypeSymbol)targetType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Type);
2082conversionError(diagnostics, ErrorCode.ERR_AnonymousMethodToExpressionTree);
2088conversionError(diagnostics, ErrorCode.ERR_CantConvAnonMethReturnType, id, targetType);
2114conversionError(diagnostics, ErrorCode.ERR_CantConvAnonMethNoParams, targetType);
2126conversionError(diagnostics, ErrorCode.ERR_BadDelArgCount, delegateType, anonymousFunction.ParameterCount);
2167Error(diagnostics, ErrorCode.ERR_BadParamExtraRef, lambdaParameterLocation, i + 1, lambdaRefKind.ToParameterDisplayString());
2172Error(diagnostics, ErrorCode.ERR_BadParamRef, lambdaParameterLocation, i + 1, delegateRefKind.ToParameterDisplayString());
2203conversionError(diagnostics, ErrorCode.ERR_CantConvAnonMethParams, id, targetType);
2222Error(diagnostics, ErrorCode.ERR_BadParamType, lambdaParameterLocation,
2240diagnostics.Add(ErrorCode.ERR_InternalError, syntax.Location);
2242void conversionError(BindingDiagnosticBag diagnostics, ErrorCode code, params object[] args)
2263Error(diagnostics, ErrorCode.ERR_LiteralDoubleCast, syntax, (targetType.SpecialType == SpecialType.System_Single) ? "F" : "M", targetType);
2274Error(diagnostics, ErrorCode.ERR_ConstOutOfRange, syntax, sourceConstantValueOpt.Value, targetType);
2279Error(diagnostics, ErrorCode.ERR_NoImplicitConvCast, syntax, distinguisher.First, distinguisher.Second);
2289Error(diagnostics, ErrorCode.ERR_AmbigUDConv, syntax, originalUserDefinedConversions[0], originalUserDefinedConversions[1], sourceType, targetType);
2296Error(diagnostics, ErrorCode.ERR_NoImplicitConv, syntax, distinguisher.First, distinguisher.Second);
2305Error(diagnostics, ErrorCode.ERR_NoImplicitConv, syntax, sourceType, targetType);
2310Error(diagnostics, ErrorCode.ERR_NoImplicitConv, syntax, distinguisher.First, distinguisher.Second);
2332Error(diagnostics, ErrorCode.ERR_NoImplicitConv, syntax, operand.Display, targetType);
2364Error(diagnostics, ErrorCode.ERR_ConversionNotTupleCompatible, syntax, tuple.Arguments.Length, targetType);
2387Error(diagnostics, ErrorCode.ERR_TypeVarCantBeNull, syntax, targetType);
2392Error(diagnostics, ErrorCode.ERR_ValueCantBeNull, syntax, targetType);
2401Error(diagnostics, ErrorCode.ERR_StackAllocConversionNotPossible, syntax, stackAllocExpression.ElementType, targetType);
2424Error(diagnostics, ErrorCode.ERR_InvalidAddrOp, ((BoundAddressOfOperator)operand).Operand.Syntax);
2480ErrorCode errorCode;
2485errorCode = ErrorCode.ERR_MethFuncPtrMismatch;
2488Error(diagnostics, ErrorCode.ERR_MissingAddressOf, location);
2491errorCode = ErrorCode.ERR_CannotConvertAddressOfToDelegate;
2494errorCode = ErrorCode.ERR_MethDelegateMismatch;
2500errorCode = ErrorCode.ERR_AddressOfToNonFunctionPointer;
2506Error(diagnostics, ErrorCode.ERR_CannotInferDelegateType, location);
2511errorCode = ErrorCode.ERR_MethGrpToNonDel;
2704Error(diagnostics, ErrorCode.WRN_IncorrectBooleanAssg, assignment.Syntax);
2850Error(diagnostics, ErrorCode.ERR_ImplicitlyTypedVariableMultipleDeclarator, nodeOpt);
2920Error(diagnostics, ErrorCode.ERR_NoBreakOrCont, node);
2931Error(diagnostics, ErrorCode.ERR_NoBreakOrCont, node);
3029diagnostics.Add(ErrorCode.ERR_ReturnInIterator, syntax.ReturnKeyword.GetLocation());
3037diagnostics.Add(ErrorCode.ERR_MustNotHaveRefReturn, syntax.ReturnKeyword.GetLocation());
3042diagnostics.Add(ErrorCode.ERR_ReturnInIterator, syntax.ReturnKeyword.GetLocation());
3048var errorCode = refKind != RefKind.None
3049? ErrorCode.ERR_MustNotHaveRefReturn
3050: ErrorCode.ERR_MustHaveRefReturn;
3080Error(diagnostics, ErrorCode.ERR_RetNoObjectRequiredLambda, syntax.ReturnKeyword);
3084Error(diagnostics, ErrorCode.ERR_TaskRetNoObjectRequiredLambda, syntax.ReturnKeyword, retType);
3100Error(diagnostics, ErrorCode.ERR_RetNoObjectRequired, syntax.ReturnKeyword, container);
3104Error(diagnostics, ErrorCode.ERR_TaskRetNoObjectRequired, syntax.ReturnKeyword, container, retType);
3120Error(diagnostics, ErrorCode.ERR_RetObjectRequired, syntax.ReturnKeyword, requiredType);
3134Error(diagnostics, ErrorCode.ERR_CantReturnVoid, expressionSyntax);
3182Error(diagnostics, ErrorCode.ERR_RefReturnMustHaveIdentityConversion, argument.Syntax, returnType);
3199Error(diagnostics, ErrorCode.ERR_BadAsyncReturnExpression, argument.Syntax, returnType, argument.Type);
3241diagnostics.Add(ErrorCode.ERR_TooManyCatches, catchSyntax.CatchKeyword.GetLocation());
3279Error(diagnostics, ErrorCode.ERR_BadExceptionType, declaration.Type);
3321Error(diagnostics, ErrorCode.ERR_UnreachableCatch, declaration.Type, previousType);
3336Error(diagnostics, ErrorCode.WRN_UnreachableGeneralCatch, node.CatchKeyword);
3377? ErrorCode.WRN_FilterIsConstantTrue
3379? ErrorCode.WRN_FilterIsConstantFalseRedundantTryCatch
3380: ErrorCode.WRN_FilterIsConstantFalse;
3403Error(diagnostics, ErrorCode.ERR_CantConvAsyncAnonFuncReturns,
3410Error(diagnostics, ErrorCode.ERR_CantConvAnonMethReturns,
3474Error(diagnostics, ErrorCode.ERR_MustNotHaveRefReturn, syntax);
3482var errorCode = refKind != RefKind.None
3483? ErrorCode.ERR_MustNotHaveRefReturn
3484: ErrorCode.ERR_MustHaveRefReturn;
3500Error(diagnostics, ErrorCode.ERR_IllegalStatement, syntax);
3516Error(diagnostics, ErrorCode.ERR_ReturnInIterator, syntax);
3749Error(diagnostics, ErrorCode.ERR_UnexpectedOrMissingConstructorInitializerInRecord, initializer?.ThisOrBaseKeyword ?? constructor.Identifier);
3760Error(diagnostics, ErrorCode.ERR_RecordStructConstructorCallsDefaultConstructor, initializer.ThisOrBaseKeyword);
3949diagnostics.Add(ErrorCode.ERR_BadCtorArgCount, diagnosticsLocation, baseType, /*desired param count*/ 0);
3963diagnostics.Add(ErrorCode.ERR_BadAccess, diagnosticsLocation, baseConstructor);
4003diagnostics.Add(ErrorCode.ERR_NoCopyConstructorInBaseType, diagnosticsLocation, baseType);
Binder\Binder_Symbols.cs (54)
340var diagnosticInfo = diagnostics.Add(ErrorCode.ERR_BadSKknown, syntax.Location, syntax, symbol.Symbol.GetKindText(), MessageID.IDS_SK_TYPE.Localize());
497diagnostics.Add(ErrorCode.ERR_BadRefInUsingAlias, refToken.GetLocation());
501diagnostics.Add(ErrorCode.ERR_UnexpectedToken, refToken.GetLocation(), refToken.ToString());
515diagnostics.Add(ErrorCode.ERR_UnexpectedToken, scopedToken.GetLocation(), scopedToken.ToString());
592return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(left, LookupResultKind.NotATypeOrNamespace, diagnostics.Add(ErrorCode.ERR_ColColWithTypeAlias, node.Alias.Location, node.Alias.Identifier.Text)));
614diagnostics.Add(ErrorCode.ERR_TypeExpected, syntax.GetLocation());
628return new CSDiagnosticInfo(ErrorCode.ERR_NullableUnconstrainedTypeParameter, new CSharpRequiredLanguageVersion(requiredVersion));
646Error(diagnostics, ErrorCode.ERR_ArrayOfStaticClass, node.ElementType, type.Type);
657Error(diagnostics, ErrorCode.ERR_ArrayElementCantBeRefAny, node.ElementType, type.Type);
674Error(diagnostics, ErrorCode.ERR_ArraySizeInDeclaration, rankSpecifier);
761var info = new CSDiagnosticInfo(ErrorCode.ERR_TupleElementNamesAttributeMissing,
801Error(diagnostics, ErrorCode.ERR_TupleReservedElementNameAnyPosition, syntax, name);
806Error(diagnostics, ErrorCode.ERR_TupleReservedElementName, syntax, name, reserved);
811Error(diagnostics, ErrorCode.ERR_TupleDuplicateElementName, syntax);
870new CSDiagnosticInfo(ErrorCode.ERR_SingleTypeNameNotFound, identifierValueText)));
1058var info = new CSDiagnosticInfo(ErrorCode.ERR_DynamicAttributeMissing, AttributeDescription.DynamicAttribute.FullName);
1229diagnostics.Add(ErrorCode.ERR_UnexpectedUnboundGenericName, node.Location);
1337var diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_LookupInTypeVariable, qualifierOpt);
1407Error(diagnostics, ErrorCode.ERR_BadArity, typeSyntax, type, MessageID.IDS_SK_TYPE.Localize(), typeArgumentsSyntax.Count);
1439Error(diagnostics, ErrorCode.ERR_BadArity, syntax, plainName, MessageID.IDS_MethodGroup.Localize(), typeArgumentsSyntax.Count);
1467Error(diagnostics, ErrorCode.ERR_AmbiguousPrimaryConstructorParameterAsColorColorReceiver, colorColorValueReceiver.Syntax, parameter.Name, parameter.Type, parameter);
1704diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, syntax.Location, descriptor.DeclaringTypeMetadataName, descriptor.Name);
1875useSiteInfo = new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, memberDescriptor.DeclaringTypeMetadataName, memberDescriptor.Name));
1999diagnostics.Add(ErrorCode.WRN_SameFullNameThisNsAgg, where.Location, originalSymbols,
2010diagnostics.Add(ErrorCode.WRN_SameFullNameThisAggNs, where.Location, originalSymbols,
2021diagnostics.Add(ErrorCode.WRN_SameFullNameThisAggAgg, where.Location, originalSymbols,
2076info = new CSDiagnosticInfo(ErrorCode.ERR_AmbigContext, originalSymbols,
2087info = new CSDiagnosticInfo(ErrorCode.ERR_SameFullNameAggAgg, originalSymbols,
2112info = new CSDiagnosticInfo(ErrorCode.ERR_SameFullNameNsAgg, originalSymbols,
2127info = new CSDiagnosticInfo(ErrorCode.ERR_SameFullNameNsAgg, originalSymbols,
2169info = new CSDiagnosticInfo(ErrorCode.ERR_SameFullNameThisAggThisNs, originalSymbols,
2176info = new CSDiagnosticInfo(ErrorCode.ERR_AmbigMember, originalSymbols,
2190info = new CSDiagnosticInfo(ErrorCode.ERR_AmbigMember, originalSymbols,
2216info = new CSDiagnosticInfo(ErrorCode.ERR_AmbiguousAttribute, originalSymbols,
2222info = new CSDiagnosticInfo(ErrorCode.ERR_AmbigContext, originalSymbols,
2232info = new CSDiagnosticInfo(ErrorCode.ERR_AmbigMember, originalSymbols,
2261var errorInfo = new CSDiagnosticInfo(ErrorCode.ERR_SystemVoid);
2292if (errorInfo != null && errorInfo.Code == (int)ErrorCode.ERR_CircularBase)
2580return diagnostics.Add(ErrorCode.ERR_DottedTypeNameNotFoundInAgg, location, whereText, qualifierOpt);
2592? diagnostics.Add(ErrorCode.ERR_GlobalSingleTypeNameNotFound, location, whereText)
2593: diagnostics.Add(ErrorCode.ERR_GlobalSingleTypeNameNotFoundFwd, location, whereText, forwardedToAssembly);
2607? diagnostics.Add(ErrorCode.ERR_DottedTypeNameNotFoundInNS, location, whereText, container)
2608: diagnostics.Add(ErrorCode.ERR_DottedTypeNameNotFoundInNSFwd, location, whereText, container, forwardedToAssembly);
2615return diagnostics.Add(ErrorCode.ERR_AliasNotFound, location, whereText);
2620var code = (where.Parent is QueryClauseSyntax) ? ErrorCode.ERR_TypeVarNotFoundRangeVariable : ErrorCode.ERR_TypeVarNotFound;
2629? diagnostics.Add(ErrorCode.ERR_SingleTypeNameNotFoundFwd, location, whereText, forwardedToAssembly)
2630: diagnostics.Add(ErrorCode.ERR_DottedTypeNameNotFoundInNSFwd, location, whereText, qualifierOpt, forwardedToAssembly);
2633return diagnostics.Add(ErrorCode.ERR_SingleTypeNameNotFound, location, whereText);
2654if (diagInfo.Code == (int)ErrorCode.ERR_CycleInTypeForwarder)
2657diagnostics.Add(ErrorCode.ERR_CycleInTypeForwarder, location, metadataName.FullName, forwardedType.ContainingAssembly.Name);
2659else if (diagInfo.Code == (int)ErrorCode.ERR_TypeForwardedToMultipleAssemblies)
2773diagnostics?.Add(ErrorCode.WRN_ErrorOverride, getLocation(data), diagInfo, (int)diagInfo.Code);
Binder\Binder_TupleOperators.cs (3)
189Error(diagnostics, ErrorCode.ERR_BadBinaryOps, node, node.OperatorToken.Text, left.Display, right.Display);
225Error(diagnostics, ErrorCode.ERR_TupleSizesMismatchForBinOps, node, leftCardinality, rightCardinality);
321diagnostics.Add(ErrorCode.WRN_TupleBinopLiteralNameMismatch, location, complaintName);
Binder\BindingDiagnosticBag.cs (5)
154internal CSDiagnosticInfo Add(ErrorCode code, Location location)
161internal CSDiagnosticInfo Add(ErrorCode code, SyntaxNode syntax, params object[] args)
164internal CSDiagnosticInfo Add(ErrorCode code, SyntaxToken syntax, params object[] args)
167internal CSDiagnosticInfo Add(ErrorCode code, Location location, params object[] args)
174internal CSDiagnosticInfo Add(ErrorCode code, Location location, ImmutableArray<Symbol> symbols, params object[] args)
Binder\ExecutableCodeBinder.cs (7)
120diagnostics.Add(ErrorCode.ERR_BadIteratorArgType, location);
125diagnostics.Add(ErrorCode.ERR_UnsafeIteratorArgType, parameter.GetFirstLocation());
133diagnostics.Add(ErrorCode.ERR_VarargsIterator, errorLocation);
150Error(diagnostics, ErrorCode.ERR_BadIteratorReturnRef, errorLocation, iterator);
154Error(diagnostics, ErrorCode.ERR_BadIteratorReturn, errorLocation, iterator, returnType);
159Error(diagnostics, ErrorCode.ERR_IteratorRefLikeElementType, errorLocation);
165diagnostics.Add(ErrorCode.ERR_IteratorMustBeAsync, errorLocation, iterator, returnType);
Binder\ForEachLoopBinder.cs (33)
248Error(diagnostics, ErrorCode.ERR_RefLvalueExpected, collectionExpr.Syntax);
254Error(diagnostics, ErrorCode.ERR_RefLvalueExpected, collectionExpr.Syntax);
268diagnostics.Add(ErrorCode.ERR_BadGetAsyncEnumerator, expr.Location, getEnumeratorMethod.ReturnTypeWithAnnotations, getEnumeratorMethod);
330diagnostics.Add(ErrorCode.ERR_ScopedRefAndRefStructOnly, typeSyntax.Location);
400Error(diagnostics, ErrorCode.ERR_MustDeclareForeachIteration, variables);
418Error(diagnostics, ErrorCode.ERR_MustDeclareForeachIteration, variables);
483Error(diagnostics, ErrorCode.ERR_RefAssignmentMustHaveIdentityConversion, collectionExpr.Syntax, iterationVariableType.Type);
495diagnostics.Add(ErrorCode.ERR_AmbigUDConv, foreachKeyword.GetLocation(), originalUserDefinedConversions[0], originalUserDefinedConversions[1], inferredType.Type, iterationVariableType);
500diagnostics.Add(ErrorCode.ERR_NoExplicitConv, foreachKeyword.GetLocation(), distinguisher.First, distinguisher.Second);
802ErrorCode errorCode = (wrongAsync, isAsync, isSpread) switch
804(true, true, _) => ErrorCode.ERR_AwaitForEachMissingMemberWrongAsync,
805(true, false, _) => ErrorCode.ERR_ForEachMissingMemberWrongAsync,
806(false, true, _) => ErrorCode.ERR_AwaitForEachMissingMember,
807(false, false, true) => ErrorCode.ERR_SpreadMissingMember,
808(false, false, false) => ErrorCode.ERR_ForEachMissingMember,
858diagnostics.Add(ErrorCode.ERR_InlineArrayForEachNotSupported, collectionExpr.Syntax.GetLocation(), collectionExpr.Type);
906diagnostics.Add(ErrorCode.ERR_InlineArrayForEachNotSupported, collectionExpr.Syntax.GetLocation(), collectionExpr.Type);
937diagnostics.Add(ErrorCode.ERR_AnonMethGrpInForEach, collectionSyntax.Location, collectionExpr.Display);
954diagnostics.Add(ErrorCode.ERR_BadDynamicAwaitForEach, collectionSyntax.Location);
986diagnostics.Add(ErrorCode.ERR_ForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetEnumeratorMethodName);
993diagnostics.Add(ErrorCode.ERR_AwaitForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetAsyncEnumeratorMethodName);
1062diagnostics.Add(isAsync ? ErrorCode.ERR_BadGetAsyncEnumerator : ErrorCode.ERR_BadGetEnumerator, collectionSyntax.Location, getEnumeratorMethod.ReturnType, getEnumeratorMethod);
1083diagnostics.Add(isAsync ? ErrorCode.ERR_MultipleIAsyncEnumOfT : ErrorCode.ERR_MultipleIEnumOfT, errorLocationSyntax.Location, unwrappedCollectionExprType,
1118diagnostics.Add(ErrorCode.ERR_AwaitForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetAsyncEnumeratorMethodName);
1204diagnostics.Add(ErrorCode.ERR_NullNotValid, collectionExpr.Syntax.Location);
1272Error(diagnostics, ErrorCode.ERR_BadAllowByRefLikeEnumerator, expr.Syntax, enumeratorType);
1475diagnostics.Add(ErrorCode.WRN_PatternNotPublicOrNotInstance, collectionSyntax.Location, patternType, patternName.Localize(), result);
1510diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, patternType, MessageID.IDS_Collection.Localize(),
1603diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, collectionExpr.Type, MessageID.IDS_Collection.Localize(),
1762diagnostics.Add(ErrorCode.WRN_PatternBadSignature, collectionSyntax.Location, enumeratorType, MessageID.IDS_Collection.Localize(), patternMemberCandidate);
1939diagnostics.Add(ErrorCode.ERR_NoSuchMember, collectionSyntax.Location, patternType, memberName);
Binder\InMethodBinder.cs (6)
268diagnostics.Add(ErrorCode.ERR_LocalIllegallyOverrides, newLocation, name);
284diagnostics.Add(ErrorCode.ERR_QueryRangeVariableOverrides, newLocation, name);
297diagnostics.Add(ErrorCode.ERR_LocalSameNameAsExtensionTypeParameter, newLocation, name);
302diagnostics.Add(ErrorCode.ERR_LocalSameNameAsTypeParam, newLocation, name);
320diagnostics.Add(ErrorCode.ERR_QueryRangeVariableSameAsTypeParam, newLocation, name);
326diagnostics.Add(ErrorCode.ERR_InternalError, newLocation);
Binder\LockBinder.cs (5)
48Error(diagnostics, ErrorCode.ERR_LockNeedsReference, exprSyntax, expr.Display);
54Error(diagnostics, ErrorCode.ERR_LockNeedsReference, exprSyntax, exprType);
82Error(diagnostics, ErrorCode.ERR_MissingPredefinedMember, syntax, LockTypeFullName, WellKnownMemberNames.EnterScopeMethodName);
90Error(diagnostics, ErrorCode.ERR_MissingPredefinedMember, syntax, LockTypeFullName, WellKnownMemberNames.EnterScopeMethodName);
97Error(diagnostics, ErrorCode.ERR_MissingPredefinedMember, syntax, $"{LockTypeFullName}+{WellKnownMemberNames.LockScopeTypeName}", WellKnownMemberNames.DisposeMethodName);
Binder\RefSafetyAnalysis.cs (3)
842Error(_diagnostics, ErrorCode.ERR_CallArgMixing, argument.Syntax, constructor, parameter.Name);
1132private static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, SyntaxNodeOrToken syntax, params object[] args)
1139private static void Error(BindingDiagnosticBag diagnostics, ErrorCode code, Location location, params object[] args)
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (48)
479diagnostics.Add(ErrorCode.ERR_FunctionPointersCannotBeCalledWithNamedArguments, badName);
515ErrorCode.ERR_ParamsCollectionMissingConstructor :
516ErrorCode.ERR_CollectionExpressionMissingConstructor,
522diagnostics.Add(ErrorCode.ERR_CollectionExpressionMissingAdd, location, receiver.Type);
588(ErrorCode)diagInfo.Code,
599ErrorCode.ERR_WrongFuncPtrCallingConvention,
633ErrorCode.ERR_BadAccess,
662diagnostics.Add(ErrorCode.ERR_QueryNoProvider, location, receiverOpt.Type, symbol.Name);
666diagnostics.Add(ErrorCode.ERR_InitializerAddHasWrongSignature, location, symbol);
670diagnostics.Add(ErrorCode.ERR_BadAwaitArg, location, receiverOpt.Type);
674diagnostics.Add(ErrorCode.ERR_FuncPtrMethMustBeStatic, location, symbol);
678ErrorCode errorCode =
681? ErrorCode.ERR_FieldInitRefNonstatic
682: ErrorCode.ERR_ObjectRequired
683: ErrorCode.ERR_ObjectProhibited;
702diagnostics.Add(delegateOrFunctionPointerType.IsFunctionPointer() ? ErrorCode.ERR_FuncPtrRefMismatch : ErrorCode.ERR_DelegateRefMismatch,
711diagnostics.Add(ErrorCode.ERR_BadRetType, location, method, method.ReturnType);
758ErrorCode.ERR_CantInferMethTypeArgs,
778ErrorCode.ERR_NoSuchMemberOrExtension,
804ErrorCode.ERR_NamedArgumentUsedInPositional,
824ErrorCode.ERR_BadNonTrailingNamedArgument,
837diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_DuplicateNamedArgument, name), location);
865ErrorCode code = (object)delegateTypeBeingInvoked != null ?
866ErrorCode.ERR_BadNamedArgumentForDelegateInvoke :
867ErrorCode.ERR_BadNamedArgument;
917ErrorCode.ERR_NoCorrespondingArgument,
940(ErrorCode code, object target) = (typeContainingConstructor, delegateTypeBeingInvoked, functionPointerMethodBeingInvoked) switch
942(object t, _, _) => (ErrorCode.ERR_BadCtorArgCount, t),
943(_, object t, _) => (ErrorCode.ERR_BadDelArgCount, t),
944(_, _, object t) => (ErrorCode.ERR_BadFuncPointerArgCount, t),
945_ => (ErrorCode.ERR_BadArgCount, name)
1125diagnostics.Add(ErrorCode.ERR_InitializerAddHasParamModifiers, location, symbols, method);
1132diagnostics.Add(ErrorCode.ERR_CollectionExpressionMissingAdd, location, receiver.Type);
1137diagnostics.Add(ErrorCode.ERR_BadArgTypesForCollectionAdd, location, symbols, method);
1180ErrorCode.ERR_BadArgType,
1229diagnostics.Add(ErrorCode.ERR_MissingAddressOf, sourceLocation);
1246ErrorCode.ERR_BadArgType,
1265diagnostics.Add(ErrorCode.ERR_ExpectedInterpolatedString, sourceLocation);
1271ErrorCode.ERR_BadArgExtraRefLangVersion,
1282ErrorCode.ERR_BadArgExtraRef,
1292ErrorCode.ERR_BadArgRef,
1313ErrorCode.ERR_BadInstanceArgType,
1334diagnostics.Add(ErrorCode.ERR_ExpectedInterpolatedString, sourceLocation);
1349ErrorCode.ERR_BadArgType,
1360ErrorCode.ERR_BadArgType,
1410diagnostics.Add(ErrorCode.ERR_QueryMultipleProviders, location, receiver.Type, name);
1520return new DiagnosticInfoWithSymbols(ErrorCode.ERR_AmbigCall, arguments, symbols);
CommandLine\CSharpCommandLineParser.cs (103)
153AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", name.ToString());
208AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "/langversion:");
214AddDiagnostic(diagnostics, ErrorCode.ERR_LanguageVersionCannotHaveLeadingZeroes, value);
222AddDiagnostic(diagnostics, ErrorCode.ERR_BadCompatMode, value);
235AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsNumber, nameMemory.ToString());
241AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsNumber, nameMemory.ToString());
306AddDiagnostic(diagnostics, ErrorCode.ERR_StdInOptionProvidedButConsoleInputIsNotRedirected);
348AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", arg);
361AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", name);
368AddDiagnostic(diagnostics, ErrorCode.FTL_BadCodepage, value);
379AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", name);
386AddDiagnostic(diagnostics, ErrorCode.FTL_BadChecksumAlgorithm, value);
417AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), name);
441AddDiagnostic(diagnostics, ErrorCode.ERR_BadNullableContextOption, value);
471AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", name);
496AddDiagnostic(diagnostics, ErrorCode.ERR_MissingGuidForOption, "<text>", name);
503AddDiagnostic(diagnostics, ErrorCode.ERR_InvalidFormatForGuidForOption, value, name);
513AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", arg);
532AddDiagnostic(diagnostics, ErrorCode.WRN_BadUILang, value);
546AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
559AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
585AddDiagnostic(diagnostics, ErrorCode.FTL_InvalidTarget);
600AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", arg);
605AddDiagnostic(diagnostics, ErrorCode.ERR_InvalidAssemblyName, "<text>", arg);
618AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "modulename");
632AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<string>", arg);
649AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
666AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), arg);
679AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), arg);
687AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "/doc:"); // Different argument.
699AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "/addmodule:");
703AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
774AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
791AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), name);
807AddDiagnostic(diagnostics, ErrorCode.ERR_BadDebugType, value);
902AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsNumber, name);
923AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsNumber, name);
950AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsNumber, name);
958AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsNumber, name);
962AddDiagnostic(diagnostics, ErrorCode.ERR_BadWarningLevel);
1027AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, "keyfile");
1048AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "keycontainer");
1092AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsNumber, name);
1096AddDiagnostic(diagnostics, ErrorCode.ERR_BadBaseNumber, value);
1110AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "subsystemversion");
1122AddDiagnostic(diagnostics, ErrorCode.ERR_InvalidSubsystemVersion, value);
1131AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "touchedfiles");
1159AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", name);
1193AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsNumber, name);
1197AddDiagnostic(diagnostics, ErrorCode.ERR_InvalidFileAlignment, value);
1201AddDiagnostic(diagnostics, ErrorCode.ERR_InvalidFileAlignment, value);
1213AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
1266AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, ErrorLogOptionFormat, RemoveQuotesAndSlashes(arg));
1273AddDiagnostic(diagnostics, ErrorCode.ERR_BadSwitchValue, valueMemory.Value.ToString(), "/errorlog:", ErrorLogOptionFormat);
1282AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, ":<text>", RemoveQuotesAndSlashes(arg));
1294AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<text>", name);
1308AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<file list>", name);
1323AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, "<file list>", name);
1358AddDiagnostic(diagnostics, ErrorCode.ERR_StdInOptionProvidedButConsoleInputIsNotRedirected);
1375AddDiagnostic(diagnostics, ErrorCode.ERR_BadSwitch, arg);
1391AddDiagnostic(diagnostics, diagnosticOptions, ErrorCode.ERR_NoRefOutWhenRefOnly);
1396AddDiagnostic(diagnostics, diagnosticOptions, ErrorCode.ERR_NoNetModuleOutputWhenRefOutOrRefOnly);
1401AddDiagnostic(diagnostics, diagnosticOptions, ErrorCode.WRN_NoSources);
1413AddDiagnostic(diagnostics, ErrorCode.ERR_BadBaseNumber, string.Format("0x{0:X}", baseAddress));
1437AddDiagnostic(diagnostics, ErrorCode.ERR_NoOutputDirectory);
1452AddDiagnostic(diagnostics, ErrorCode.ERR_SourceLinkRequiresPdb);
1462AddDiagnostic(diagnostics, ErrorCode.ERR_CannotEmbedWithoutPdb);
1538diagnostics.Add(new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_NullableOptionNotAvailable,
1604AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_PathList.Localize(), switchName);
1613AddDiagnostic(diagnostics, ErrorCode.WRN_InvalidSearchPathDir, path, origin.Localize(), MessageID.IDS_DirectoryHasInvalidPath.Localize());
1617AddDiagnostic(diagnostics, ErrorCode.WRN_InvalidSearchPathDir, path, origin.Localize(), MessageID.IDS_DirectoryDoesNotExist.Localize());
1630AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
1637AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
1667AddDiagnostic(diagnostics, ErrorCode.ERR_OutputNeedsName);
1681AddDiagnostic(diagnostics, ErrorCode.FTL_InvalidInputFileName, outputFileName);
1692AddDiagnostic(diagnostics, ErrorCode.FTL_InvalidInputFileName, outputFileName);
1707AddDiagnostic(diagnostics, ErrorCode.ERR_AssemblyNameOnNonModule);
1761outputDiagnostics.Add(Diagnostic.Create(CSharp.MessageProvider.Instance, (int)ErrorCode.WRN_DefineIdentifierRequired, valueMemory.ToString()));
1793outputDiagnostics.Add(Diagnostic.Create(CSharp.MessageProvider.Instance, (int)ErrorCode.WRN_DefineIdentifierRequired, id));
1821AddDiagnostic(diagnostics, ErrorCode.ERR_BadPlatformType, value);
1849AddDiagnostic(diagnostics, ErrorCode.FTL_InvalidTarget);
1858AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Namespace1.Localize(), arg);
1872AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), arg);
1877AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
1899AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), arg);
1906AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
1931AddDiagnostic(diagnostics, ErrorCode.ERR_BadExternIdentifier, alias);
1967AddDiagnostic(diagnostics, ErrorCode.ERR_OneAliasPerReference);
1973AddDiagnostic(diagnostics, ErrorCode.ERR_AliasMissingFile, alias);
1985AddDiagnostic(diagnostics, ErrorCode.ERR_CantHaveWin32ResAndIcon);
1990AddDiagnostic(diagnostics, ErrorCode.ERR_CantHaveWin32ResAndManifest);
1996AddDiagnostic(diagnostics, ErrorCode.WRN_CantHaveManifestForModule);
2012AddDiagnostic(diagnostics, ErrorCode.ERR_InvalidInstrumentationKind, kind);
2066AddDiagnostic(diagnostics, ErrorCode.ERR_BadResourceVis, accessibility);
2072AddDiagnostic(diagnostics, ErrorCode.ERR_NoFileSpec, arg);
2079AddDiagnostic(diagnostics, ErrorCode.FTL_InvalidInputFileName, filePath);
2108ids.Add(CSharp.MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_MissingNonNullTypesContextForAnnotation));
2109ids.Add(CSharp.MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_MissingNonNullTypesContextForAnnotationInGeneratedCode));
2115ErrorFacts.IsWarning((ErrorCode)number))
2157AddDiagnostic(diagnostics, ErrorCode.WRN_UnimplementedCommandLineSwitch, "/" + switchName);
2165private static void AddDiagnostic(IList<Diagnostic> diagnostics, ErrorCode errorCode)
2170private static void AddDiagnostic(IList<Diagnostic> diagnostics, ErrorCode errorCode, params object[] arguments)
2178private static void AddDiagnostic(IList<Diagnostic> diagnostics, Dictionary<string, ReportDiagnostic> warningOptions, ErrorCode errorCode, params object[] arguments)
CommandLine\CSharpCompiler.cs (8)
109diagnostics.Add(new DiagnosticInfo(MessageProvider, (int)ErrorCode.WRN_FileAlreadyIncluded,
143diagnostics.Add(new DiagnosticInfo(MessageProvider, (int)ErrorCode.ERR_CantReadConfigFile, appConfigPath, ex.Message));
364(int)ErrorCode.ERR_NoSourceFile,
388{ Code: (int)ErrorCode.ERR_BadAccess, Arguments: [Symbol s] } => s,
389{ Code: (int)ErrorCode.ERR_InaccessibleGetter, Arguments: [Symbol s] } => s,
390{ Code: (int)ErrorCode.ERR_InaccessibleSetter, Arguments: [Symbol s] } => s,
391{ Code: (int)ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, Arguments: [_, Symbol s, _] } => s,
403new CSDiagnosticInfo(ErrorCode.ERR_SymbolDefinedInAssembly, symbol, symbol.ContainingAssembly),
Compilation\CSharpCompilation.cs (30)
530diagnostics.Add(ErrorCode.ERR_DebugEntryPointNotSourceMethodDefinition, Location.None);
1776ErrorCode.ERR_GlobalSingleTypeNameNotFound,
1878diagnostics.Add(ErrorCode.ERR_SimpleProgramNotAnExecutable, simpleProgramEntryPointSymbol.ReturnTypeSyntax.Location);
1906diagnostics.Add(ErrorCode.ERR_SimpleProgramDisallowsMainType, NoLocation.Singleton);
1939diagnostics.Add(ErrorCode.WRN_MainIgnored, NoLocation.Singleton, mainTypeName);
1946diagnostics.Add(ErrorCode.ERR_MainClassNotFound, NoLocation.Singleton, mainTypeName);
1953diagnostics.Add(ErrorCode.ERR_MainClassNotClass, mainTypeOrNamespace.GetFirstLocation(), mainTypeOrNamespace);
1974diagnostics.Add(ErrorCode.WRN_MainIgnored, main.GetFirstLocation(), main);
2002noMainFoundDiagnostics.Add(ErrorCode.WRN_InvalidMainSig, candidate.GetFirstLocation(), candidate);
2010noMainFoundDiagnostics.Add(ErrorCode.WRN_MainCantBeGeneric, candidate.GetFirstLocation(), candidate);
2033diagnostics.Add(ErrorCode.ERR_NonTaskMainCantBeAsync, candidate.GetFirstLocation());
2066ErrorCode.WRN_SyncAndAsyncEntryPoints,
2094if (diagnostic.Code == (int)ErrorCode.WRN_InvalidMainSig || diagnostic.Code == (int)ErrorCode.WRN_MainCantBeGeneric)
2108diagnostics.Add(ErrorCode.ERR_NoEntryPoint, NoLocation.Singleton);
2112diagnostics.Add(ErrorCode.ERR_NoMainInClass, mainType.GetFirstLocation(), mainType);
2123diagnostics.Add(ErrorCode.ERR_EntryPointCannotBeUnmanagedCallersOnly, viableEntryPoint.GetFirstLocation());
2131ErrorCode.ERR_MultipleEntryPoints,
2257=> code == (int)ErrorCode.ERR_NoTypeDef;
2666ErrorCode code = info.Kind == SyntaxKind.ExternAliasDirective
2667? ErrorCode.HDN_UnusedExternAlias
2668: ErrorCode.HDN_UnusedUsingDirective;
2994builder.Add(new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_NullableOptionNotAvailable,
3479excludeDiagnostics.Add((int)ErrorCode.ERR_ConcreteMissingBody);
3499diagnostics.Add(ErrorCode.ERR_ModuleEmitFailure, NoLocation.Singleton, ((Cci.INamedEntity)moduleBeingBuilt).Name,
3639_diagnostics.Add(ErrorCode.ERR_FileTypeNonUniquePath, location, symbol, filePath);
3673diagnostics.Add(ErrorCode.ERR_DuplicateInterceptor, attributeLocation);
3763diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_BindToBogus, m), NoLocation.Singleton);
3805runtimeMDVersionDiagnostics.Add(ErrorCode.WRN_NoRuntimeMetadataVersion, NoLocation.Singleton);
3869diagnostics.Add(ErrorCode.WRN_ConflictingChecksum, new SourceLocation(checksumDirective), path);
Compiler\ClsComplianceChecker.cs (41)
132this.AddDiagnostic(ErrorCode.WRN_CLS_NotOnModules, warningLocation);
136this.AddDiagnostic(ErrorCode.WRN_CLS_NotOnModules2, warningLocation);
155this.AddDiagnostic(ErrorCode.WRN_CLS_ModuleMissingCLS, warningLocation);
260this.AddDiagnostic(ErrorCode.WRN_CLS_BadAttributeType, symbol.GetFirstLocation(), symbol);
335this.AddDiagnostic(ErrorCode.WRN_CLS_NoVarArgs, symbol.GetFirstLocation());
350this.AddDiagnostic(ErrorCode.ERR_AttributeNotOnAccessor, attributeLocation, attribute.AttributeClass.Name, attributeUsage.GetValidTargetsErrorArgument());
414this.AddDiagnostic(ErrorCode.WRN_CLS_VolatileField, symbol.GetFirstLocation(), symbol);
460this.AddDiagnostic(ErrorCode.WRN_CLS_MeaninglessOnPrivateType, symbol.GetFirstLocation(), symbol);
504this.AddDiagnostic(ErrorCode.WRN_CLS_BadInterfaceMember, symbol.GetFirstLocation(), symbol);
508this.AddDiagnostic(ErrorCode.WRN_CLS_NoAbstractMembers, symbol.GetFirstLocation(), symbol);
525this.AddDiagnostic(ErrorCode.WRN_CLS_BadInterface, symbol.GetFirstLocation(), symbol, interfaceType);
536this.AddDiagnostic(ErrorCode.WRN_CLS_BadBase, symbol.GetFirstLocation(), symbol, baseType);
549this.AddDiagnostic(ErrorCode.WRN_CLS_IllegalTrueInFalse, symbol.GetFirstLocation(), symbol, containingType);
566this.AddDiagnostic(ErrorCode.WRN_CLS_BadTypeVar, typeParameter.GetFirstLocation(), constraintType.Type);
580this.AddDiagnostic(ErrorCode.WRN_CLS_BadArgType, parameter.GetFirstLocation(), parameter.Type);
612this.AddDiagnostic(ErrorCode.WRN_CLS_ArrayArgumentToAttribute, warningLocation);
628this.AddDiagnostic(ErrorCode.WRN_CLS_ArrayArgumentToAttribute, warningLocation);
646this.AddDiagnostic(ErrorCode.WRN_CLS_ArrayArgumentToAttribute, warningLocation);
697this.AddDiagnostic(ErrorCode.WRN_CLS_MeaninglessOnParam, attributeLocation);
707this.AddDiagnostic(ErrorCode.WRN_CLS_MeaninglessOnReturn, attributeLocation);
715ErrorCode code;
720code = ErrorCode.WRN_CLS_BadFieldPropType;
724code = ErrorCode.WRN_CLS_BadFieldPropType;
728code = ErrorCode.WRN_CLS_BadFieldPropType;
732code = ErrorCode.WRN_CLS_BadReturnType;
792ErrorCode code = IsTrue(compliance)
793? ErrorCode.WRN_CLS_AssemblyNotCLS
794: ErrorCode.WRN_CLS_AssemblyNotCLS2;
896this.AddDiagnostic(ErrorCode.WRN_CLS_BadIdentifierCase, symbol.GetFirstLocation(), symbol);
909ErrorCode code;
921this.AddDiagnostic(ErrorCode.WRN_CLS_BadIdentifierCase, symbol.GetFirstLocation(), symbol);
956this.AddDiagnostic(ErrorCode.WRN_CLS_BadIdentifier, symbol.GetFirstLocation(), name);
1253private void AddDiagnostic(ErrorCode code, Location location)
1260private void AddDiagnostic(ErrorCode code, Location location, params object[] args)
1316private static bool TryGetCollisionErrorCode(Symbol x, Symbol y, out ErrorCode code)
1323code = ErrorCode.Void;
1410sawArrayOfArraysDifference ? ErrorCode.WRN_CLS_OverloadUnnamed :
1411sawArrayRankDifference ? ErrorCode.WRN_CLS_OverloadRefOut : // Lumping rank difference with refkind is odd, but matches dev11.
1412sawRefKindDifference ? ErrorCode.WRN_CLS_OverloadRefOut :
1413ErrorCode.Void;
1415return code != ErrorCode.Void;
Compiler\DocumentationCommentCompiler.cs (13)
112diagnostics.Add(ErrorCode.ERR_DocFileGen, Location.None, e.Message);
312_diagnostics.Add(ErrorCode.WRN_MissingXMLComment, location, symbol);
383_diagnostics.Add(ErrorCode.WRN_MissingParamTag, location, parameter.Name, symbol);
397_diagnostics.Add(ErrorCode.WRN_MissingTypeParamTag, location, typeParameter, symbol);
558_diagnostics.Add(ErrorCode.WRN_XMLParseError, location, GetDescription(e));
741if ((ErrorCode)diag.Code == ErrorCode.WRN_XMLParseError)
1163diagnostics.Add(ErrorCode.WRN_UnmatchedParamTag, identifier.Location, identifier);
1166diagnostics.Add(ErrorCode.WRN_UnmatchedParamRefTag, identifier.Location, identifier, memberSymbol);
1169diagnostics.Add(ErrorCode.WRN_UnmatchedTypeParamTag, identifier.Location, identifier);
1172diagnostics.Add(ErrorCode.WRN_UnmatchedTypeParamRefTag, identifier.Location, identifier, memberSymbol);
1193diagnostics.Add(ErrorCode.WRN_DuplicateParamTag, syntax.Location, identifier);
1203diagnostics.Add(ErrorCode.WRN_DuplicateTypeParamTag, syntax.Location, identifier);
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (7)
283_diagnostics.Add(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, new LocalizableErrorArgument(MessageID.IDS_OperationCausedStackOverflow));
304includeDiagnostics.Add(ErrorCode.WRN_InvalidInclude, location, subMessage);
315includeDiagnostics.Add(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, new CodeAnalysisResourcesLocalizableErrorArgument(nameof(CodeAnalysisResources.XmlReferencesNotSupported)));
325includeDiagnostics.Add(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, new CodeAnalysisResourcesLocalizableErrorArgument(nameof(CodeAnalysisResources.FileNotFound)));
346includeDiagnostics.Add(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, e.Message);
358includeDiagnostics.Add(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, errorMessage);
405includeDiagnostics.Add(ErrorCode.WRN_XMLParseIncludeError, errorLocation, GetDescription(e)); //NOTE: location is in included file.
CSharpCompilationOptions.cs (11)
671builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_NoMainOnDLL));
676builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(MainTypeName), MainTypeName));
682builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadPlatformType, Platform.ToString()));
687MetadataHelpers.CheckAssemblyOrModuleName(ModuleName, MessageProvider.Instance, (int)ErrorCode.ERR_BadModuleName, builder);
692builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(OutputKind), OutputKind.ToString()));
697builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(OptimizationLevel), OptimizationLevel.ToString()));
702builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(ScriptClassName), ScriptClassName ?? "null"));
707builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(WarningLevel), WarningLevel));
712builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(Usings), Usings.Where(u => !u.IsValidClrNamespaceName()).First() ?? "null"));
717builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadPrefer32OnLib));
722builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(MetadataImportOptions), MetadataImportOptions.ToString()));
Declarations\DeclarationTreeBuilder.cs (12)
196bag.Add(ErrorCode.ERR_SimpleProgramIsEmpty, ((EmptyStatementSyntax)firstGlobalStatement.Statement).SemicolonToken.GetLocation());
450diagnostics.Add(ErrorCode.ERR_GlobalUsingOutOfOrder, directive.GlobalKeyword.GetLocation());
536diagnostics.Add(ErrorCode.ERR_MultipleFileScopedNamespace, node.Name.GetLocation());
545diagnostics.Add(ErrorCode.ERR_FileScopedAndNormalNamespace, node.Name.GetLocation());
563diagnostics.Add(ErrorCode.ERR_FileScopedNamespaceNotBeforeAllMembers, node.Name.GetLocation());
575diagnostics.Add(ErrorCode.ERR_FileScopedAndNormalNamespace, node.Name.GetLocation());
582diagnostics.Add(ErrorCode.ERR_UnexpectedGenericName, node.Name.GetLocation());
587diagnostics.Add(ErrorCode.ERR_UnexpectedAliasedName, node.Name.GetLocation());
592diagnostics.Add(ErrorCode.ERR_BadModifiersOnNamespace, node.AttributeLists[0].GetLocation());
597diagnostics.Add(ErrorCode.ERR_BadModifiersOnNamespace, node.Modifiers[0].GetLocation());
604diagnostics.Add(ErrorCode.ERR_GlobalUsingInNamespace, directive.GlobalKeyword.GetLocation());
743diagnostics.Add(ErrorCode.ERR_UnexpectedParameterList, node.ParameterList.GetLocation());
Emitter\Model\PEModuleBuilder.cs (10)
175diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_ReferencedAssemblyDoesNotHaveStrongName, assembly), NoLocation.Singleton);
182diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_RefCultureMismatch, assembly, refIdentity.CultureName), NoLocation.Singleton);
201diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_ConflictingMachineAssembly, assembly), NoLocation.Singleton);
695diagnostics.Add(ErrorCode.ERR_ExportedTypeConflictsWithDeclaration, NoLocation.Singleton, type, type.ContainingModule);
699diagnostics.Add(ErrorCode.ERR_ForwardedTypeConflictsWithDeclaration, NoLocation.Singleton, type);
715diagnostics.Add(ErrorCode.ERR_ExportedTypesConflict, NoLocation.Singleton, type, type.ContainingModule, contender, contender.ContainingModule);
720diagnostics.Add(ErrorCode.ERR_ForwardedTypeConflictsWithExportedType, NoLocation.Singleton, type, type.ContainingAssembly, contender, contender.ContainingModule);
725diagnostics.Add(ErrorCode.ERR_ForwardedTypesConflict, NoLocation.Singleton, type, type.ContainingAssembly, contender, contender.ContainingAssembly);
991diagnostics.Add(new CSDiagnostic(diagInfo ?? new CSDiagnosticInfo(ErrorCode.ERR_BogusType, string.Empty), syntaxNodeOpt == null ? NoLocation.Singleton : syntaxNodeOpt.Location));
1108new CSDiagnosticInfo(ErrorCode.ERR_PredefinedValueTupleTypeMustBeStruct, namedTypeSymbol.MetadataName),
Emitter\NoPia\EmbeddedTypesManager.cs (17)
207Error(diagnostics, ErrorCode.ERR_InteropTypesWithSameNameAndGuid, null,
216Error(diagnostics, ErrorCode.ERR_LocalTypeNameClash, null,
239Error(diagnostics, ErrorCode.WRN_ReferencedAssemblyReferencesLinkedPIA, null,
265ErrorCode error = ErrorCode.Unknown;
276error = ErrorCode.ERR_DefaultInterfaceImplementationInNoPIAType;
281error = ErrorCode.ERR_ReAbstractionInNoPIAType;
287if (error != ErrorCode.Unknown)
301error = ErrorCode.ERR_NoPIANestedType;
309error = ErrorCode.ERR_GenericsUsedInNoPIAType;
316error = ErrorCode.ERR_NewCoClassOnLink;
320if (error != ErrorCode.Unknown)
329private static void ReportNotEmbeddableSymbol(ErrorCode error, Symbol symbol, SyntaxNode syntaxNodeOpt, DiagnosticBag diagnostics, EmbeddedTypesManager optTypeManager)
338internal static void Error(DiagnosticBag diagnostics, ErrorCode code, SyntaxNode syntaxOpt, params object[] args)
461ReportNotEmbeddableSymbol(ErrorCode.ERR_InteropStructContainsMethods, field.AdaptedFieldSymbol.ContainingType, syntaxNodeOpt, diagnostics, this);
496ReportNotEmbeddableSymbol(ErrorCode.ERR_InteropStructContainsMethods, type.UnderlyingNamedType.AdaptedNamedTypeSymbol, syntaxNodeOpt, diagnostics, this);
503Error(diagnostics, ErrorCode.ERR_InteropMethodWithBody, syntaxNodeOpt, method.AdaptedMethodSymbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat));
Errors\MessageProvider.cs (102)
27return ErrorFacts.GetSeverity((ErrorCode)code);
32return ErrorFacts.GetMessage((ErrorCode)code, language);
37return ErrorFacts.GetMessageFormat((ErrorCode)code);
42return ErrorFacts.GetDescription((ErrorCode)code);
47return ErrorFacts.GetTitle((ErrorCode)code);
52return ErrorFacts.GetHelpLink((ErrorCode)code);
57return ErrorFacts.GetCategory((ErrorCode)code);
79return ErrorFacts.GetWarningLevel((ErrorCode)code);
84get { return typeof(ErrorCode); }
89var info = new CSDiagnosticInfo((ErrorCode)code, args, ImmutableArray<Symbol>.Empty, ImmutableArray<Location>.Empty);
110(ErrorCode)code is not (
111ErrorCode.WRN_UseDefViolationPropertySupportedVersion
112or ErrorCode.WRN_UseDefViolationFieldSupportedVersion
113or ErrorCode.WRN_UseDefViolationThisSupportedVersion
114or ErrorCode.WRN_UnassignedThisAutoPropertySupportedVersion
115or ErrorCode.WRN_UnassignedThisSupportedVersion
116or ErrorCode.WRN_CollectionExpressionRefStructMayAllocate
117or ErrorCode.WRN_CollectionExpressionRefStructSpreadMayAllocate
142return (ErrorCode)errorCode switch
145ErrorCode.Unknown => false,
146ErrorCode.Void => false,
147ErrorCode.ERR_IdentifierExpectedKW => false, // message uses {1} rather than {0}
148ErrorCode.WRN_XMLParseError => false, // XmlSyntaxDiagnosticInfo.GetMessage() uses distinct error code
154public override int ERR_FailedToCreateTempFile => (int)ErrorCode.ERR_CantMakeTempFile;
155public override int ERR_MultipleAnalyzerConfigsInSameDir => (int)ErrorCode.ERR_MultipleAnalyzerConfigsInSameDir;
158public override int ERR_ExpectedSingleScript => (int)ErrorCode.ERR_ExpectedSingleScript;
159public override int ERR_OpenResponseFile => (int)ErrorCode.ERR_OpenResponseFile;
160public override int ERR_InvalidPathMap => (int)ErrorCode.ERR_InvalidPathMap;
161public override int FTL_InvalidInputFileName => (int)ErrorCode.FTL_InvalidInputFileName;
162public override int ERR_FileNotFound => (int)ErrorCode.ERR_FileNotFound;
163public override int ERR_NoSourceFile => (int)ErrorCode.ERR_NoSourceFile;
164public override int ERR_CantOpenFileWrite => (int)ErrorCode.ERR_CantOpenFileWrite;
165public override int ERR_OutputWriteFailed => (int)ErrorCode.ERR_OutputWriteFailed;
166public override int WRN_NoConfigNotOnCommandLine => (int)ErrorCode.WRN_NoConfigNotOnCommandLine;
167public override int ERR_BinaryFile => (int)ErrorCode.ERR_BinaryFile;
168public override int WRN_AnalyzerCannotBeCreated => (int)ErrorCode.WRN_AnalyzerCannotBeCreated;
169public override int WRN_NoAnalyzerInAssembly => (int)ErrorCode.WRN_NoAnalyzerInAssembly;
170public override int WRN_UnableToLoadAnalyzer => (int)ErrorCode.WRN_UnableToLoadAnalyzer;
171public override int WRN_AnalyzerReferencesFramework => (int)ErrorCode.WRN_AnalyzerReferencesFramework;
172public override int WRN_AnalyzerReferencesNewerCompiler => (int)ErrorCode.WRN_AnalyzerReferencesNewerCompiler;
173public override int WRN_DuplicateAnalyzerReference => (int)ErrorCode.WRN_DuplicateAnalyzerReference;
174public override int INF_UnableToLoadSomeTypesInAnalyzer => (int)ErrorCode.INF_UnableToLoadSomeTypesInAnalyzer;
175public override int ERR_CantReadRulesetFile => (int)ErrorCode.ERR_CantReadRulesetFile;
176public override int ERR_CompileCancelled => (int)ErrorCode.ERR_CompileCancelled;
179public override int ERR_BadSourceCodeKind => (int)ErrorCode.ERR_BadSourceCodeKind;
180public override int ERR_BadDocumentationMode => (int)ErrorCode.ERR_BadDocumentationMode;
183public override int ERR_BadCompilationOptionValue => (int)ErrorCode.ERR_BadCompilationOptionValue;
184public override int ERR_MutuallyExclusiveOptions => (int)ErrorCode.ERR_MutuallyExclusiveOptions;
187public override int ERR_InvalidDebugInformationFormat => (int)ErrorCode.ERR_InvalidDebugInformationFormat;
188public override int ERR_InvalidOutputName => (int)ErrorCode.ERR_InvalidOutputName;
189public override int ERR_InvalidFileAlignment => (int)ErrorCode.ERR_InvalidFileAlignment;
190public override int ERR_InvalidSubsystemVersion => (int)ErrorCode.ERR_InvalidSubsystemVersion;
191public override int ERR_InvalidInstrumentationKind => (int)ErrorCode.ERR_InvalidInstrumentationKind;
192public override int ERR_InvalidHashAlgorithmName => (int)ErrorCode.ERR_InvalidHashAlgorithmName;
195public override int ERR_MetadataFileNotAssembly => (int)ErrorCode.ERR_ImportNonAssembly;
196public override int ERR_MetadataFileNotModule => (int)ErrorCode.ERR_AddModuleAssembly;
197public override int ERR_InvalidAssemblyMetadata => (int)ErrorCode.FTL_MetadataCantOpenFile;
198public override int ERR_InvalidModuleMetadata => (int)ErrorCode.FTL_MetadataCantOpenFile;
199public override int ERR_ErrorOpeningAssemblyFile => (int)ErrorCode.FTL_MetadataCantOpenFile;
200public override int ERR_ErrorOpeningModuleFile => (int)ErrorCode.FTL_MetadataCantOpenFile;
201public override int ERR_MetadataFileNotFound => (int)ErrorCode.ERR_NoMetadataFile;
202public override int ERR_MetadataReferencesNotSupported => (int)ErrorCode.ERR_MetadataReferencesNotSupported;
203public override int ERR_LinkedNetmoduleMetadataMustProvideFullPEImage => (int)ErrorCode.ERR_LinkedNetmoduleMetadataMustProvideFullPEImage;
207diagnostics.Add(ErrorCode.ERR_DuplicateImport, location,
214diagnostics.Add(ErrorCode.ERR_DuplicateImportSimple, location,
220public override int ERR_PublicKeyFileFailure => (int)ErrorCode.ERR_PublicKeyFileFailure;
221public override int ERR_PublicKeyContainerFailure => (int)ErrorCode.ERR_PublicKeyContainerFailure;
222public override int ERR_OptionMustBeAbsolutePath => (int)ErrorCode.ERR_OptionMustBeAbsolutePath;
225public override int ERR_CantReadResource => (int)ErrorCode.ERR_CantReadResource;
226public override int ERR_CantOpenWin32Resource => (int)ErrorCode.ERR_CantOpenWin32Res;
227public override int ERR_CantOpenWin32Manifest => (int)ErrorCode.ERR_CantOpenWin32Manifest;
228public override int ERR_CantOpenWin32Icon => (int)ErrorCode.ERR_CantOpenIcon;
229public override int ERR_ErrorBuildingWin32Resource => (int)ErrorCode.ERR_ErrorBuildingWin32Resources;
230public override int ERR_BadWin32Resource => (int)ErrorCode.ERR_BadWin32Res;
231public override int ERR_ResourceFileNameNotUnique => (int)ErrorCode.ERR_ResourceFileNameNotUnique;
232public override int ERR_ResourceNotUnique => (int)ErrorCode.ERR_ResourceNotUnique;
233public override int ERR_ResourceInModule => (int)ErrorCode.ERR_CantRefResource;
236public override int ERR_PermissionSetAttributeFileReadError => (int)ErrorCode.ERR_PermissionSetAttributeFileReadError;
239public override int ERR_EncodinglessSyntaxTree => (int)ErrorCode.ERR_EncodinglessSyntaxTree;
240public override int WRN_PdbUsingNameTooLong => (int)ErrorCode.WRN_DebugFullNameTooLong;
241public override int WRN_PdbLocalNameTooLong => (int)ErrorCode.WRN_PdbLocalNameTooLong;
242public override int ERR_PdbWritingFailed => (int)ErrorCode.FTL_DebugEmitFailure;
245public override int ERR_MetadataNameTooLong => (int)ErrorCode.ERR_MetadataNameTooLong;
246public override int ERR_EncReferenceToAddedMember => (int)ErrorCode.ERR_EncReferenceToAddedMember;
247public override int ERR_TooManyUserStrings => (int)ErrorCode.ERR_TooManyUserStrings;
248public override int ERR_PeWritingFailure => (int)ErrorCode.ERR_PeWritingFailure;
249public override int ERR_ModuleEmitFailure => (int)ErrorCode.ERR_ModuleEmitFailure;
250public override int ERR_EncUpdateFailedMissingSymbol => (int)ErrorCode.ERR_EncUpdateFailedMissingSymbol;
251public override int ERR_InvalidDebugInfo => (int)ErrorCode.ERR_InvalidDebugInfo;
252public override int ERR_FunctionPointerTypesInAttributeNotSupported => (int)ErrorCode.ERR_FunctionPointerTypesInAttributeNotSupported;
253public override int ERR_DataSectionStringLiteralHashCollision => (int)ErrorCode.ERR_DataSectionStringLiteralHashCollision;
256public override int WRN_GeneratorFailedDuringInitialization => (int)ErrorCode.WRN_GeneratorFailedDuringInitialization;
257public override int WRN_GeneratorFailedDuringGeneration => (int)ErrorCode.WRN_GeneratorFailedDuringGeneration;
262diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), node.GetErrorDisplayName());
268diagnostics.Add(ErrorCode.ERR_InvalidNamedArgument, node.ArgumentList.Arguments[namedArgumentIndex].Location, parameterName);
274diagnostics.Add(ErrorCode.ERR_ParameterNotValidForType, node.ArgumentList.Arguments[namedArgumentIndex].Location);
279diagnostics.Add(ErrorCode.ERR_MarshalUnmanagedTypeNotValidForFields, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), unmanagedTypeName);
284diagnostics.Add(ErrorCode.ERR_MarshalUnmanagedTypeOnlyValidForFields, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), unmanagedTypeName);
290diagnostics.Add(ErrorCode.ERR_AttributeParameterRequired1, node.Name.Location, parameterName);
296diagnostics.Add(ErrorCode.ERR_AttributeParameterRequired2, node.Name.Location, parameterName1, parameterName2);
299public override int ERR_BadAssemblyName => (int)ErrorCode.ERR_BadAssemblyName;
301public override int? WRN_ByValArraySizeConstRequired => (int)ErrorCode.WRN_ByValArraySizeConstRequired;
FlowAnalysis\DefiniteAssignment.cs (53)
435Diagnostics.Add(ErrorCode.WRN_AsyncLacksAwaits, diagnosticLocation);
513hasAssociatedProperty ? ErrorCode.WRN_UnassignedThisAutoPropertySupportedVersion : ErrorCode.WRN_UnassignedThisSupportedVersion,
520hasAssociatedProperty ? ErrorCode.ERR_UnassignedThisAutoPropertyUnsupportedVersion : ErrorCode.ERR_UnassignedThisUnsupportedVersion,
537Diagnostics.Add(ErrorCode.ERR_ParamUnassigned, location, parameter.Name);
556Diagnostics.Add(ErrorCode.ERR_ParamUnassigned, location, parameter.Name);
590if (compatDiagnostics.AsEnumerable().Any(d => (ErrorCode)d.Code == ErrorCode.ERR_InsufficientStack))
619ErrorCode oldCode = (ErrorCode)diagnostic.Code;
620ErrorCode newCode = oldCode switch
623ErrorCode.ERR_UnassignedThisAutoPropertyUnsupportedVersion => ErrorCode.WRN_UnassignedThisAutoPropertyUnsupportedVersion,
624ErrorCode.ERR_UnassignedThisUnsupportedVersion => ErrorCode.WRN_UnassignedThisUnsupportedVersion,
625ErrorCode.ERR_ParamUnassigned => ErrorCode.WRN_ParamUnassigned,
626ErrorCode.ERR_UseDefViolationProperty => ErrorCode.WRN_UseDefViolationProperty,
627ErrorCode.ERR_UseDefViolationField => ErrorCode.WRN_UseDefViolationField,
628ErrorCode.ERR_UseDefViolationThisUnsupportedVersion => ErrorCode.WRN_UseDefViolationThisUnsupportedVersion,
629ErrorCode.ERR_UseDefViolationPropertyUnsupportedVersion => ErrorCode.WRN_UseDefViolationPropertyUnsupportedVersion,
630ErrorCode.ERR_UseDefViolationFieldUnsupportedVersion => ErrorCode.WRN_UseDefViolationFieldUnsupportedVersion,
631ErrorCode.ERR_UseDefViolationOut => ErrorCode.WRN_UseDefViolationOut,
632ErrorCode.ERR_UseDefViolation => ErrorCode.WRN_UseDefViolation,
638Debug.Assert(newCode != oldCode || oldCode == ErrorCode.ERR_InsufficientStack, oldCode.ToString());
708diagnostics.Add(ErrorCode.ERR_LocalCantBeFixedAndHoisted, location, captured.Name);
1257Diagnostics.Add(ErrorCode.ERR_UseDefViolationOut, node.Location, symbolName);
1262Diagnostics.Add(ErrorCode.ERR_UseDefViolation, node.Location, symbolName);
1310Diagnostics.Add(ErrorCode.WRN_UseDefViolationThisSupportedVersion, node.Location);
1315ErrorCode.ERR_UseDefViolationThisUnsupportedVersion,
1328Diagnostics.Add(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName);
1338Diagnostics.Add(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName);
1355ErrorCode.WRN_UseDefViolationRefField,
1363hasAssociatedProperty ? ErrorCode.WRN_UseDefViolationPropertySupportedVersion : ErrorCode.WRN_UseDefViolationFieldSupportedVersion,
1370hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationPropertyUnsupportedVersion : ErrorCode.ERR_UseDefViolationFieldUnsupportedVersion,
1978ErrorCode.WRN_UnreadRecordParameter :
1979ErrorCode.WRN_UnreadPrimaryConstructorParameter,
2354Diagnostics.Add(assigned && _writtenVariables.Contains(symbol) ? ErrorCode.WRN_UnreferencedVarAssg : ErrorCode.WRN_UnreferencedVar, symbol.GetFirstLocationOrNone(), symbol.Name);
2373Diagnostics.Add(ErrorCode.WRN_UnreferencedLocalFunction, symbol.GetFirstLocationOrNone(), symbol.Name);
2402Diagnostics.Add(ErrorCode.ERR_FixedLocalInLambda, new SourceLocation(node.Syntax), localSymbol);
FlowAnalysis\NullableWalker.cs (36)
798var errorCode = usesFieldKeyword ? ErrorCode.WRN_UninitializedNonNullableBackingField : ErrorCode.WRN_UninitializedNonNullableField;
1064Diagnostics.Add(ErrorCode.WRN_MemberNotNull, syntax.GetLocation(), member.Name);
1133Diagnostics.Add(ErrorCode.WRN_MemberNotNullWhen, syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation(), member.Name, sense ? "true" : "false");
1294Diagnostics.Add(ErrorCode.WRN_ParameterDisallowsNull, location, parameter.Name);
1321Diagnostics.Add(ErrorCode.WRN_ParameterConditionallyDisallowsNull, syntax.Location, parameter.Name, sense ? "true" : "false");
1380Diagnostics.Add(ErrorCode.WRN_ParameterNotNullIfNotNull, location, outputParam.Name, inputParam.Name);
1385Diagnostics.Add(ErrorCode.WRN_ReturnNotNullIfNotNull, location, inputParam.Name);
1399ReportDiagnostic(ErrorCode.WRN_ShouldNotReturn, syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation());
2412ReportDiagnostic(assignmentKind == AssignmentKind.Return ? ErrorCode.WRN_NullReferenceReturn : ErrorCode.WRN_NullAsNonNullable, location);
2416ReportDiagnostic(ErrorCode.WRN_NullReferenceArgument, location,
2434ReportDiagnostic(assignmentKind == AssignmentKind.Return ? ErrorCode.WRN_NullReferenceReturn : ErrorCode.WRN_NullReferenceAssignment, location);
2590ReportDiagnostic(ErrorCode.WRN_NullabilityMismatchInAssignment, syntaxNode, sourceType, destinationType);
2595ReportDiagnostic(ErrorCode.WRN_NullabilityMismatchInAssignment, location, sourceType, destinationType);
2652ReportDiagnostic(ErrorCode.WRN_ConvertingNullableToNonNullable, location);
2655private void ReportDiagnostic(ErrorCode errorCode, SyntaxNode syntaxNode, params object[] arguments)
2660private void ReportDiagnostic(ErrorCode errorCode, Location location, params object[] arguments)
4378ReportDiagnostic(ErrorCode.WRN_NullReferenceInitializer, initializer.Syntax, symbol);
7603ReportDiagnostic(ErrorCode.WRN_DisallowNullAttributeForbidsMaybeNullAssignment, node.Location);
8816ReportDiagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, arg.location,
8823ReportDiagnostic(ErrorCode.WRN_NullabilityMismatchInParameterTypeOfTargetDelegate, arg.location,
8887ReportDiagnostic(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate, location,
8897ReportDiagnostic(ErrorCode.WRN_NullabilityMismatchInParameterTypeOfTargetDelegate, location,
8934/// If <see langword="true"/>, indicates that the "non-safety" diagnostic <see cref="ErrorCode.WRN_ConvertingNullableToNonNullable"/>
9089ReportDiagnostic(ErrorCode.WRN_UnboxPossibleNull, getDiagnosticLocation());
9183ReportDiagnostic(ErrorCode.WRN_NullableValueTypeMayBeNull, getDiagnosticLocation());
10792ReportDiagnostic(ErrorCode.WRN_NullabilityMismatchInArgument,
10809ReportDiagnostic(forOutput ? ErrorCode.WRN_NullabilityMismatchInArgumentForOutput : ErrorCode.WRN_NullabilityMismatchInArgument,
11198ReportDiagnostic(ErrorCode.WRN_NullReferenceReceiver, expr.Syntax.GetLocation());
12008ReportDiagnostic(isValueType ? ErrorCode.WRN_NullableValueTypeMayBeNull : ErrorCode.WRN_NullReferenceReceiver, syntax);
12162ReportDiagnostic(ErrorCode.WRN_ThrowPossibleNull, expr.Syntax);
Generated\BoundNodes.xml.Generated.cs (3)
1966public BoundUnconvertedConditionalOperator(SyntaxNode syntax, BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, ErrorCode noCommonTypeError, bool hasErrors = false)
1986public ErrorCode NoCommonTypeError { get; }
1991public BoundUnconvertedConditionalOperator Update(BoundExpression condition, BoundExpression consequence, BoundExpression alternative, ConstantValue? constantValueOpt, ErrorCode noCommonTypeError)
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (6)
356F.Diagnostics.Add(ErrorCode.ERR_WrongArityAsyncReturn, F.Syntax.Location, builderType);
367F.Diagnostics.Add(ErrorCode.ERR_BadAsyncReturn, F.Syntax.Location);
461new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, (customBuilder ? (object)builderType : descriptor.DeclaringTypeMetadataName), descriptor.Name),
494F.Diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, F.Syntax.Location, builderType, methodName);
519new CSDiagnosticInfo(ErrorCode.ERR_BadAsyncMethodBuilderTaskProperty, builderType, returnType, property.Type),
529new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, builderType, propertyName),
Lowering\DiagnosticsPass_ExpressionTrees.cs (83)
59private void Error(ErrorCode code, BoundNode node, params object[] args)
73Error(ErrorCode.ERR_ExpressionTreeContainsPointerOp, node);
83Error(ErrorCode.ERR_ExpressionTreeContainsMultiDimensionalArrayInitializer, node);
95Error(ErrorCode.ERR_ExpressionTreeContainsPatternImplicitIndexer, node);
105Error(ErrorCode.ERR_ExpressionTreeContainsPatternImplicitIndexer, node);
115Error(ErrorCode.ERR_ExpressionTreeContainsInlineArrayOperation, node);
125Error(ErrorCode.ERR_ExpressionTreeContainsFromEndIndexExpression, node);
135Error(ErrorCode.ERR_ExpressionTreeContainsRangeExpression, node);
145Error(ErrorCode.ERR_ExpressionTreeContainsPointerOp, node);
175Error(ErrorCode.ERR_ExpressionTreeContainsBaseAccess, node);
197var diagnostic = _staticLocalOrAnonymousFunction.MethodKind == MethodKind.LocalFunction
198? ErrorCode.ERR_StaticLocalFunctionCannotCaptureThis
199: ErrorCode.ERR_StaticAnonymousFunctionCannotCaptureThis;
212var diagnostic = _staticLocalOrAnonymousFunction.MethodKind == MethodKind.LocalFunction
213? ErrorCode.ERR_StaticLocalFunctionCannotCaptureVariable
214: ErrorCode.ERR_StaticAnonymousFunctionCannotCaptureVariable;
233Error(ErrorCode.ERR_ExpressionTreeContainsSwitchExpression, node);
255Error(ErrorCode.ERR_ExpressionTreeContainsAssignment, node);
265Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
288Error(ErrorCode.ERR_ExpressionTreeContainsAssignment, node);
326Error(ErrorCode.ERR_PartialMethodInExpressionTree, node);
330Error(ErrorCode.ERR_ExpressionTreeContainsIndexedProperty, node);
335Error(ErrorCode.ERR_ExpressionTreeContainsOptionalArgument, node);
340Error(ErrorCode.ERR_ExpressionTreeContainsNamedArgument, node);
346Error(ErrorCode.ERR_ExpressionTreeContainsNamedArgumentOutOfPosition, node);
350Error(ErrorCode.ERR_ComRefCallInExpressionTree, node);
354Error(ErrorCode.ERR_ExpressionTreeContainsLocalFunction, node);
358Error(ErrorCode.ERR_RefReturningCallInExpressionTree, node);
362Error(ErrorCode.ERR_ExpressionTreeContainsAbstractStaticMemberAccess, node);
405Error(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, node, type.Name);
414Error(ErrorCode.ERR_FeatureNotValidInExpressionTree, node, "__reftype");
424Error(ErrorCode.ERR_FeatureNotValidInExpressionTree, node, "__refvalue");
434Error(ErrorCode.ERR_FeatureNotValidInExpressionTree, node, "__makeref");
444Error(ErrorCode.ERR_VarArgsInExpressionTree, node);
454Error(ErrorCode.ERR_NullPropagatingOpInExpressionTree, node);
464Error(ErrorCode.ERR_DictionaryInitializerInExpressionTree, node);
471Error(ErrorCode.ERR_ExpressionTreeContainsExtensionPropertyAccess, node);
534Error(ErrorCode.ERR_ExpressionTreeContainsOutVariable, local);
542Error(ErrorCode.ERR_ExpressionTreeContainsDiscard, argument);
550Error(ErrorCode.ERR_ExtensionCollectionElementInitializerInExpressionTree, node);
579Error(ErrorCode.ERR_RefReturningCallInExpressionTree, node);
593Error(ErrorCode.ERR_ExpressionTreeContainsAbstractStaticMemberAccess, node);
597Error(ErrorCode.ERR_ExpressionTreeContainsExtensionPropertyAccess, node);
613Error(ErrorCode.ERR_LambdaWithAttributesToExpressionTree, node);
621_diagnostics.Add(ErrorCode.ERR_ByRefParameterInExpressionTree, location);
625_diagnostics.Add(ErrorCode.ERR_ExpressionTreeCantContainRefStruct, p.GetFirstLocation(), p.Type.Name);
630_diagnostics.Add(ErrorCode.ERR_LambdaWithAttributesToExpressionTree, p.GetFirstLocation());
642Error(ErrorCode.ERR_BadAsyncExpressionTree, node);
646Error(ErrorCode.ERR_StatementLambdaToExpressionTree, node);
650Error(ErrorCode.ERR_BadRefReturnExpressionTree, node);
660Error(ErrorCode.ERR_BadAsyncExpressionTree, node);
664Error(ErrorCode.ERR_StatementLambdaToExpressionTree, node);
668Error(ErrorCode.ERR_BadRefReturnExpressionTree, node);
674Error(ErrorCode.ERR_ExpressionTreeContainsAnonymousMethod, node);
756Error(ErrorCode.ERR_ExpressionTreeContainsAbstractStaticMemberAccess, node);
767Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
775Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
787Error(ErrorCode.ERR_ExpressionTreeContainsAbstractStaticMemberAccess, node);
808Error(ErrorCode.ERR_ExpressionTreeContainsAssignment, node);
852Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
862Error(ErrorCode.ERR_ExpressionTreeContainsTupleConversion, node);
869Error(ErrorCode.ERR_ExpressionTreeContainsInlineArrayOperation, node);
876Error(ErrorCode.ERR_ExpressionTreeContainsInterpolatedStringHandlerConversion, node);
884Error(ErrorCode.ERR_ExpressionTreeContainsAbstractStaticMemberAccess, node);
926Error(ErrorCode.ERR_ExpressionTreeContainsLocalFunction, node);
930Error(ErrorCode.ERR_AddressOfMethodGroupInExpressionTree, node);
934Error(ErrorCode.ERR_ExpressionTreeContainsAbstractStaticMemberAccess, node);
958Error(ErrorCode.ERR_ExpressionTreeContainsBadCoalesce, node.LeftOperand);
968Error(ErrorCode.ERR_ExpressionTreeCantContainNullCoalescingAssignment, node);
978Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
994Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
1005Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
1015Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
1025Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
1035Error(ErrorCode.ERR_ExpressionTreeContainsIsMatch, node);
1045Error(ErrorCode.ERR_ExpressionTreeContainsTupleLiteral, node);
1055Error(ErrorCode.ERR_ExpressionTreeContainsTupleLiteral, node);
1065Error(ErrorCode.ERR_ExpressionTreeContainsTupleBinOp, node);
1075Error(ErrorCode.ERR_ExpressionTreeContainsThrowExpression, node);
1085Error(ErrorCode.ERR_ExpressionTreeContainsWithExpression, node);
1095Error(ErrorCode.ERR_ExpressionTreeContainsPointerOp, node);
1107ErrorCode.ERR_ParamsCollectionExpressionTree :
1108ErrorCode.ERR_ExpressionTreeContainsCollectionExpression,
Lowering\DiagnosticsPass_Warnings.cs (27)
63Error(ErrorCode.WRN_VolatileByRef, fieldAccess, fieldSymbol);
68Error(ErrorCode.WRN_ByRefNonAgileField, fieldAccess, fieldSymbol);
91Error(ErrorCode.WRN_CallOnNonAgileField, fieldAccess, fieldSymbol);
258Error(ErrorCode.ERR_FeatureNotValidInExpressionTree, node, method);
262Error(ErrorCode.ERR_ExpressionTreeContainsAbstractStaticMemberAccess, node);
280Error(ErrorCode.ERR_FeatureNotValidInExpressionTree, node, ">>>");
300Error(ErrorCode.ERR_ExpressionTreeContainsAssignment, node);
333_diagnostics.Add(ErrorCode.WRN_BadRefCompareLeft, node.Syntax.Location, t);
338_diagnostics.Add(ErrorCode.WRN_BadRefCompareRight, node.Syntax.Location, t);
388Error(ErrorCode.WRN_ComparisonToSelf, node);
454Error(ErrorCode.WRN_VacuousIntegralComp, tree, conversion.Operand.Type);
569Error(ErrorCode.WRN_BitwiseOrSignExtend, node);
729Error(ErrorCode.WRN_AlwaysNull, node, node.Type);
745Error(ErrorCode.WRN_AlwaysNull, node, node.Type);
770Error(ErrorCode.WRN_NubExprIsConstBool, node, always, node.Left.Type.GetNullableUnderlyingType(), node.Left.Type);
774Error(ErrorCode.WRN_NubExprIsConstBool, node, always, node.Right.Type.GetNullableUnderlyingType(), node.Right.Type);
800Error(ErrorCode.WRN_CmpAlwaysFalse, node, GetTypeForLiftedComparisonWarning(node.Right));
804Error(ErrorCode.WRN_CmpAlwaysFalse, node, GetTypeForLiftedComparisonWarning(node.Left));
818Error(node.OperatorKind.IsUserDefined() ? ErrorCode.WRN_NubExprIsConstBool2 : ErrorCode.WRN_NubExprIsConstBool, node, always, node.Left.Type.GetNullableUnderlyingType(), GetTypeForLiftedComparisonWarning(node.Right));
822Error(node.OperatorKind.IsUserDefined() ? ErrorCode.WRN_NubExprIsConstBool2 : ErrorCode.WRN_NubExprIsConstBool, node, always, node.Right.Type.GetNullableUnderlyingType(), GetTypeForLiftedComparisonWarning(node.Left));
830Error(ErrorCode.WRN_AlwaysNull, node, node.Type);
836Error(ErrorCode.WRN_AlwaysNull, node, node.Type);
847Error(ErrorCode.WRN_AlwaysNull, node, node.Type);
881Error(ErrorCode.WRN_AssignmentToSelf, node);
925Error(ErrorCode.WRN_AssignmentToSelf, leftArgument);
Lowering\LocalRewriter\LocalRewriter_Call.cs (12)
163this._diagnostics.Add(ErrorCode.ERR_InterceptorCannotBeGeneric, attributeLocation, interceptor, method);
169this._diagnostics.Add(ErrorCode.ERR_InterceptorArityNotCompatible, attributeLocation, interceptor, netArity, method);
183this._diagnostics.Add(ErrorCode.ERR_InterceptableMethodMustBeOrdinary, attributeLocation, nameSyntax.Identifier.ValueText);
195this._diagnostics.Add(ErrorCode.ERR_InterceptorNotAccessible, attributeLocation, interceptor, containingMethod);
207this._diagnostics.Add(ErrorCode.ERR_InterceptorSignatureMismatch, attributeLocation, method, interceptor);
218diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnInterceptor, attributeLocation, method);
222diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnInterceptor, attributeLocation, new FormattedSymbol(implementingParameter, SymbolDisplayFormat.ShortFormat), method);
228this._diagnostics.Add(ErrorCode.WRN_InterceptorSignatureMismatch, attributeLocation, method, interceptor);
239this._diagnostics.Add(ErrorCode.ERR_InterceptorMustHaveMatchingThisParameter, attributeLocation, methodThisParameter, method);
242this._diagnostics.Add(ErrorCode.ERR_InterceptorMustNotHaveThisParameter, attributeLocation, method);
251this._diagnostics.Add(ErrorCode.ERR_InterceptorMustHaveMatchingThisParameter, attributeLocation, method.Parameters[0], method);
261diagnostics.Add(ErrorCode.ERR_InterceptorScopedMismatch, attributeLocation, method, symbolForCompare);
Parser\AbstractLexer.cs (8)
66protected void AddError(int position, int width, ErrorCode code)
71protected void AddError(int position, int width, ErrorCode code, params object[] args)
81protected void AddError(ErrorCode code)
86protected void AddError(ErrorCode code, params object[] args)
114protected SyntaxDiagnosticInfo MakeError(int position, int width, ErrorCode code)
120protected SyntaxDiagnosticInfo MakeError(int position, int width, ErrorCode code, params object[] args)
137protected static SyntaxDiagnosticInfo MakeError(ErrorCode code)
142protected static SyntaxDiagnosticInfo MakeError(ErrorCode code, params object[] args)
Parser\DirectiveParser.cs (53)
125id = this.AddError(id, ErrorCode.ERR_PPDirectiveExpected);
129hash = this.AddError(hash, ErrorCode.ERR_PPDirectiveExpected);
165return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndRegionDirectiveExpected);
169return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndifDirectiveExpected);
173return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_UnexpectedDirective);
188return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndRegionDirectiveExpected);
192return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndifDirectiveExpected);
196return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_UnexpectedDirective);
211return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndRegionDirectiveExpected);
215return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_UnexpectedDirective);
233return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_EndifDirectiveExpected);
237return this.AddError(SyntaxFactory.BadDirectiveTrivia(hash, keyword, eod, isActive), ErrorCode.ERR_UnexpectedDirective);
245keyword = this.AddError(keyword, ErrorCode.ERR_PPDefFollowsToken);
248var name = this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_IdentifierExpected);
323eod = this.AddError(eod, triviaOffset, triviaWidth, isError ? ErrorCode.ERR_ErrorDirective : ErrorCode.WRN_WarningDirective, errorText);
335eod = this.AddError(eod, triviaOffset, triviaWidth, ErrorCode.ERR_CompilerAndLanguageVersion, version,
345ErrorCode error = this.Options.LanguageVersion.GetErrorCode();
377line = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_InvalidLineNumber, reportError: isActive);
383line = this.AddError(line, ErrorCode.ERR_InvalidLineNumber);
387line = this.AddError(line, ErrorCode.WRN_TooManyLinesForDebugger);
413start = this.AddError(start, ErrorCode.ERR_LineSpanDirectiveRequiresSpace);
423end = this.AddError(end, ErrorCode.ERR_LineSpanDirectiveEndLessThanStart);
432characterOffset = this.AddError(characterOffset, ErrorCode.ERR_LineSpanDirectiveRequiresSpace);
435var file = EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_MissingPPFile, reportError: reportError);
440file = this.AddError(file, ErrorCode.ERR_LineSpanDirectiveRequiresSpace);
474var token = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_LineSpanDirectiveInvalidValue, reportError: reportError);
485token = this.AddError(token, ErrorCode.ERR_LineSpanDirectiveInvalidValue);
498keyword = this.AddError(keyword, ErrorCode.ERR_ReferenceDirectiveOnlyAllowedInScripts);
502keyword = this.AddError(keyword, ErrorCode.ERR_PPReferenceFollowsToken);
506SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive);
518keyword = this.AddError(keyword, ErrorCode.ERR_LoadDirectiveOnlyAllowedInScripts);
522keyword = this.AddError(keyword, ErrorCode.ERR_PPLoadFollowsToken);
526SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive);
544_ => EatToken(SyntaxKind.DisableKeyword, ErrorCode.ERR_NullableDirectiveQualifierExpected, reportError: isActive)
553_ => EatToken(SyntaxKind.WarningsKeyword, ErrorCode.ERR_NullableDirectiveTargetExpected, reportError: !setting.IsMissing && isActive)
608id = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.WRN_IdentifierOrNumericLiteralExpected, reportError: isActive);
628style = this.EatToken(SyntaxKind.DisableKeyword, ErrorCode.WRN_IllegalPPWarning, reportError: isActive);
636var file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive);
637var guid = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !file.IsMissing);
643guid = this.AddError(guid, ErrorCode.WRN_IllegalPPChecksum);
647var bytes = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !guid.IsMissing);
652bytes = this.AddError(bytes, ErrorCode.WRN_IllegalPPChecksum);
660bytes = this.AddError(bytes, ErrorCode.WRN_IllegalPPChecksum);
673var warning = this.EatToken(SyntaxKind.WarningKeyword, ErrorCode.WRN_IllegalPragma, reportError: isActive);
692colon = this.AddError(colon, ErrorCode.ERR_PPIgnoredNeedsFileBasedProgram);
697colon = this.AddError(colon, ErrorCode.ERR_PPIgnoredFollowsToken);
702colon = this.AddError(colon, ErrorCode.ERR_PPIgnoredFollowsIf);
724var errorCode = ErrorCode.ERR_EndOfPPLineExpected;
727errorCode = ErrorCode.WRN_EndOfPPLineExpected;
731errorCode = ErrorCode.ERR_MissingPPFile;
830return SyntaxFactory.IdentifierName(this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_InvalidPreprocExpr));
Parser\DocumentationCommentParser.cs (13)
796SyntaxDiagnosticInfo crefInfo = new SyntaxDiagnosticInfo(rawInfo.Offset, rawInfo.Width, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code);
928result = this.AddError(result, ErrorCode.WRN_BadXMLRefSyntax, result.ToFullString());
1007SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(offset, width, ErrorCode.ERR_OvlOperatorExpected);
1008SyntaxDiagnosticInfo crefInfo = new SyntaxDiagnosticInfo(offset, width, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code);
1054SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(offset, width, ErrorCode.ERR_OvlOperatorExpected);
1055SyntaxDiagnosticInfo crefInfo = new SyntaxDiagnosticInfo(offset, width, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code);
1097SyntaxDiagnosticInfo rawInfo = new SyntaxDiagnosticInfo(offset, width, ErrorCode.ERR_OvlOperatorExpected);
1098SyntaxDiagnosticInfo crefInfo = new SyntaxDiagnosticInfo(offset, width, ErrorCode.WRN_ErrorOverride, rawInfo, rawInfo.Code);
1127var misplacedToken = AddErrorAsWarning(EatToken(), ErrorCode.ERR_MisplacedUnchecked);
1266var misplacedToken = AddErrorAsWarning(EatToken(), ErrorCode.ERR_RefReadOnlyWrongOrdering);
1304typeSyntax = this.AddError(typeSyntax, ErrorCode.WRN_ErrorOverride,
1305new SyntaxDiagnosticInfo(ErrorCode.ERR_TypeParamMustBeIdentifier), $"{(int)ErrorCode.ERR_TypeParamMustBeIdentifier:d4}");
Parser\LanguageParser.cs (144)
233return AddError(node, position, 0, ErrorCode.ERR_InsufficientStack);
256namespaceToken = this.AddError(namespaceToken, ErrorCode.ERR_NamespaceNotAllowedInScript);
514AddError(typeDeclaration.CloseBraceToken, ErrorCode.ERR_InvalidMemberDecl, "}"));
528SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken), ErrorCode.ERR_RbraceExpected);
617IsScript ? ErrorCode.ERR_GlobalDefinitionOrStatementExpected : ErrorCode.ERR_EOFExpected);
647@extern = this.AddErrorToFirstToken(@extern, ErrorCode.ERR_ExternAfterElements);
702attribute = this.AddError(attribute, attribute.Target.Identifier, ErrorCode.ERR_GlobalAttributesNotFirst);
734IsScript ? ErrorCode.ERR_GlobalDefinitionOrStatementExpected : ErrorCode.ERR_EOFExpected);
783memberOrStatement = this.AddError(memberOrStatement, ErrorCode.ERR_TopLevelStatementAfterNamespaceOrType);
828@using = this.AddError(@using, ErrorCode.ERR_UsingAfterElements);
971unsafeToken = AddTrailingSkippedSyntax(unsafeToken, AddError(this.EatToken(), ErrorCode.ERR_BadStaticAfterUnsafe));
1243literalToken.GetDiagnostics().Contains(d => d.Code == (int)ErrorCode.ERR_NewlineInConst))
1745keyword = AddTrailingSkippedSyntax(keyword, this.AddError(this.EatToken(), ErrorCode.ERR_ExtensionDisallowsName));
1887this.AddError(ConvertToKeyword(this.EatToken()), ErrorCode.ERR_MisplacedRecord),
2027token = this.AddError(token, ErrorCode.ERR_InvalidMemberDecl, token.Text);
2178? this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_IdentifierExpected)
2188bounds.Add(_syntaxFactory.TypeConstraint(this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected)));
2213AddTrailingSkippedSyntax(bounds, this.AddError(separatorToken, ErrorCode.ERR_UnexpectedToken, SyntaxFacts.GetText(SyntaxKind.CommaToken)));
2220bounds.Add(_syntaxFactory.TypeConstraint(this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected)));
2285? this.AddError(this.EatToken(), ErrorCode.ERR_UnexpectedToken, SyntaxFacts.GetText(SyntaxKind.QuestionToken))
2299this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_NoEnumConstraint),
2308this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_NoDelegateConstraint),
2620this.AddError(SyntaxFactory.MissingToken(SyntaxKind.VoidKeyword), ErrorCode.ERR_MemberNeedsType));
2968ErrorCode.ERR_BadModifierLocation,
3000result = this.AddErrorToLastToken(incompleteMember, ErrorCode.ERR_NamespaceUnexpected);
3009ErrorCode.ERR_InvalidMemberDecl,
3392token = this.EatToken(SyntaxKind.ThisKeyword, ErrorCode.ERR_ThisOrBaseExpected);
3461semicolon = this.EatTokenWithPrejudice(ErrorCode.ERR_UnexpectedSemicolon);
3541initializer = this.AddErrorToFirstToken(initializer, ErrorCode.ERR_UnexpectedToken, colonToken.Text);
3702type = this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_IdentifierExpected);
3799separator = this.AddError(separator, ErrorCode.ERR_AliasQualAsExpression);
3832var misplacedToken = this.AddError(this.EatToken(), ErrorCode.ERR_MisplacedUnchecked);
3859AddError(type, ErrorCode.ERR_BadOperatorSyntax, firstToken.Text));
3901SyntaxDiagnosticInfo diagInfo = MakeError(opTokenErrorOffset, opTokenErrorWidth, ErrorCode.ERR_BadOperatorSyntax, SyntaxFacts.GetText(SyntaxKind.PlusToken));
3907type = this.AddError(type, ErrorCode.ERR_BadOperatorSyntax, SyntaxFacts.GetText(SyntaxKind.PlusToken));
3950SyntaxDiagnosticInfo diagInfo = MakeError(opTokenErrorOffset, opTokenErrorWidth, ErrorCode.ERR_OvlUnaryOperatorExpected);
3958SyntaxDiagnosticInfo diagInfo = MakeError(opTokenErrorOffset, opTokenErrorWidth, ErrorCode.ERR_OvlBinaryOperatorExpected);
3966SyntaxDiagnosticInfo diagInfo = MakeError(opTokenErrorOffset, opTokenErrorWidth, ErrorCode.ERR_OvlOperatorExpected);
3971opToken = this.AddError(opToken, ErrorCode.ERR_BadBinOpArgs, SyntaxFacts.GetText(opKind));
3975opToken = this.AddError(opToken, ErrorCode.ERR_BadUnOpArgs, SyntaxFacts.GetText(opKind));
3979opToken = this.AddError(opToken, ErrorCode.ERR_OvlOperatorExpected);
4024thisKeyword = this.AddError(thisKeyword, ErrorCode.ERR_UnexpectedGenericName);
4044semicolon = this.EatTokenWithPrejudice(ErrorCode.ERR_UnexpectedSemicolon);
4082identifier = this.AddError(identifier, ErrorCode.ERR_UnexpectedGenericName);
4124semicolon = this.EatTokenWithPrejudice(ErrorCode.ERR_UnexpectedSemicolon);
4186declaringKind == AccessorDeclaringKind.Event ? ErrorCode.ERR_AddOrRemoveExpected : ErrorCode.ERR_GetOrSetExpected) == PostSkipAction.Abort)
4219private PostSkipAction SkipBadAccessorListTokens(ref SyntaxToken openBrace, SyntaxListBuilder<AccessorDeclarationSyntax> list, ErrorCode error)
4319ErrorCode error)
4365ErrorCode error,
4415ErrorCode errorCode,
4453declaringKind == AccessorDeclaringKind.Event ? ErrorCode.ERR_AddOrRemoveExpected : ErrorCode.ERR_GetOrSetExpected);
4469declaringKind == AccessorDeclaringKind.Event ? ErrorCode.ERR_AddOrRemoveExpected : ErrorCode.ERR_GetOrSetExpected);
4540? ErrorCode.ERR_SemiOrLBraceOrArrowExpected
4541: ErrorCode.ERR_SemiOrLBraceExpected);
4768identifier = allowOptionalIdentifier ? null : this.AddError(CreateMissingIdentifierToken(), ErrorCode.ERR_IdentifierExpected);
4782this.AddError(this.EatToken(), ErrorCode.ERR_BadArraySyntax),
4938identifier = this.AddError(identifier, ErrorCode.ERR_IdentifierExpected);
4944identifier = this.AddError(identifier, ErrorCode.ERR_UnexpectedGenericName);
4980semi = this.AddError(semi, ErrorCode.ERR_UnexpectedSemicolon);
5033eventToken = this.AddError(eventToken, ErrorCode.ERR_ExplicitEventFieldImpl);
5349missingIdentifier = this.AddError(missingIdentifier, offset, width, ErrorCode.ERR_IdentifierExpected);
5382name = this.AddError(name, ErrorCode.ERR_MultiTypeInDeclaration);
5432argumentList = this.AddError(argumentList, ErrorCode.ERR_BadVarDecl);
5445close = this.AddError(close, ErrorCode.ERR_ValueExpected);
5457expression = this.AddError(expression, ErrorCode.ERR_ArraySizeInDeclaration);
5471argumentList = this.AddError(argumentList, ErrorCode.ERR_CStyleArray);
5484name = this.AddError(name, ErrorCode.ERR_ConstValueRequired); // Error here for missing constant initializers
5491name = this.AddError(name, ErrorCode.ERR_FixedDimsRequired);
5610name = this.AddError(name, ErrorCode.ERR_UnexpectedGenericName);
5697? this.ParseIdentifierName(ErrorCode.ERR_ConstantExpected)
5774private IdentifierNameSyntax ParseIdentifierName(ErrorCode code = ErrorCode.ERR_IdentifierExpected)
5788private SyntaxToken ParseIdentifierToken(ErrorCode code = ErrorCode.ERR_IdentifierExpected)
5802result = this.AddError(result, ErrorCode.ERR_InvalidExprTerm, this.CurrentToken.Text);
5810identifierToken = this.AddError(identifierToken, ErrorCode.ERR_BadAwaitAsIdentifier);
5907this.AddError(CreateMissingIdentifierToken(), ErrorCode.ERR_IdentifierExpected));
6445? this.AddError(this.EatToken(), ErrorCode.ERR_IllegalVarianceSyntax)
6486result = this.AddError(result, ErrorCode.ERR_TypeExpected);
6563separator = this.AddError(separator, ErrorCode.ERR_AliasQualAsExpression);
6617AddError(separator, ErrorCode.ERR_ExplicitEventFieldImpl));
6673separator = this.AddError(separator, ErrorCode.ERR_UnexpectedAliasedName);
6737separator = this.AddError(separator, ErrorCode.ERR_AliasQualAsExpression);
6815separator = this.AddError(separator, ErrorCode.ERR_UnexpectedAliasedName);
7662list[i] = this.AddError(this.CreateMissingIdentifierName(), offset, width, ErrorCode.ERR_ValueExpected);
7697var missing = this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TupleTooFewElements);
7730token = this.AddError(token, mode == ParseTypeMode.Parameter ? ErrorCode.ERR_NoVoidParameter : ErrorCode.ERR_NoVoidHere);
7753mode == ParseTypeMode.NewExpression ? ErrorCode.ERR_BadNewExpr : ErrorCode.ERR_TypeExpected);
7907unmanagedCallingConventions = AddError(unmanagedCallingConventions, ErrorCode.ERR_CannotSpecifyManagedWithUnmanagedSpecifiers);
8751? ErrorCode.ERR_SemiOrLBraceOrArrowExpected
8752: ErrorCode.ERR_SemiOrLBraceExpected)
8978!semicolonToken.GetDiagnostics().Contains(diagnosticInfo => (ErrorCode)diagnosticInfo.Code == ErrorCode.ERR_SemicolonExpected))
8980semicolonToken = this.AddError(semicolonToken, ErrorCode.ERR_SemicolonExpected);
9053tryBlock = this.AddErrorToLastToken(tryBlock, ErrorCode.ERR_ExpectedEndTry);
9403skippedForToken = this.AddError(skippedForToken, ErrorCode.ERR_SyntaxError, SyntaxFacts.GetText(SyntaxKind.ForEachKeyword));
9414var @in = this.EatToken(SyntaxKind.InKeyword, ErrorCode.ERR_InExpected);
9417@in = this.AddError(@in, ErrorCode.ERR_BadForeachDecl);
9708this.EatToken(SyntaxKind.IfKeyword, ErrorCode.ERR_ElseCannotStartStatement),
9767returnOrBreak = this.AddError(returnOrBreak, ErrorCode.ERR_EmptyYield);
9845expression = this.AddError(expression, ErrorCode.ERR_SwitchGoverningExpressionRequiresParens);
9879ParseIdentifierName(ErrorCode.ERR_ConstantExpected),
9891node = this.AddError(node, ErrorCode.ERR_DiscardPatternInSwitchStatement);
10187mods[i] = this.AddError(mod, ErrorCode.ERR_BadMemberFlag, mod.Text);
10404type = this.AddError(type, ErrorCode.ERR_NoVoidHere);
10445mod = this.AddError(mod, ErrorCode.ERR_NoModifiersOnUsing);
10449mod = this.AddError(mod, ErrorCode.ERR_BadMemberFlag, mod.Text);
10454mod = this.AddError(mod, ErrorCode.ERR_TypeExpected);
10591modifier = this.AddError(modifier, ErrorCode.ERR_BadMemberFlag, modifier.Text);
11081return this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_InvalidExprTerm, SyntaxFacts.GetText(tk));
11128this.AddError(this.EatToken(), ErrorCode.ERR_InvalidExprTerm, this.CurrentToken.Text));
11137: this.AddError(result, ErrorCode.ERR_InvalidExprTerm, SyntaxFacts.GetText(tk));
11221leftOperand.Kind == SyntaxKind.IsPatternExpression ? ErrorCode.ERR_UnexpectedToken : ErrorCode.WRN_PrecedenceInversion,
11312return this.AddError(conditionalExpression, ErrorCode.ERR_ConditionalInInterpolation);
11506ErrorCode.ERR_TripleDotNotAllowed);
11603return this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_InvalidExprTerm, this.CurrentToken.Text);
11632return this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_InvalidExprTerm, this.CurrentToken.Text);
11687return this.AddError(_syntaxFactory.RefExpression(refKeyword, this.ParseExpressionCore()), ErrorCode.ERR_InvalidExprTerm, SyntaxFacts.GetText(tk));
11701expr = this.AddError(expr, ErrorCode.ERR_InvalidExprTerm, SyntaxFacts.GetText(tk));
11712expr = this.AddError(expr, ErrorCode.ERR_ExpressionExpected);
11716expr = this.AddError(expr, ErrorCode.ERR_InvalidExprTerm, SyntaxFacts.GetText(tk));
11756this.ConvertToMissingWithTrailingTrivia(this.AddError(this.EatToken(), ErrorCode.ERR_UnexpectedAliasedName), SyntaxKind.DotToken),
11787this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_IdentifierExpected));
12198expression = this.ParseIdentifierName(ErrorCode.ERR_ValueExpected);
12202expression = this.ParseIdentifierName(ErrorCode.ERR_MissingArgument);
12494this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TupleTooFewElements)));
12972this.EatToken(SyntaxKind.OpenParenToken, ErrorCode.ERR_BadNewExpr, reportError: type?.ContainsDiagnostics == false),
13181var size = this.AddError(this.ParseExpressionCore(), ErrorCode.ERR_InvalidArray);
13255var size = this.AddError(this.ParseExpressionCore(), ErrorCode.ERR_InvalidStackAllocArray);
13261var comma = this.AddError(this.EatToken(), ErrorCode.ERR_InvalidStackAllocArray);
13716fc = this.AddError(fc, ErrorCode.WRN_PrecedenceInversion, SyntaxFacts.GetText(SyntaxKind.FromKeyword));
13760this.EatToken(SyntaxKind.SelectKeyword, ErrorCode.ERR_ExpectedSelectOrGroup),
13816onKeyword: this.EatContextualToken(SyntaxKind.OnKeyword, ErrorCode.ERR_ExpectedContextualKeywordOn),
13818equalsKeyword: this.EatContextualToken(SyntaxKind.EqualsKeyword, ErrorCode.ERR_ExpectedContextualKeywordEquals),
13920this.EatContextualToken(SyntaxKind.ByKeyword, ErrorCode.ERR_ExpectedContextualKeywordBy),
14226node = this.AddError(node, ErrorCode.ERR_UnexpectedToken, trailingTrash[0].ToString());
Parser\Lexer.cs (28)
641this.AddError(TextWindow.Position + 1, width: 1, ErrorCode.ERR_ExpectedVerbatimLiteral);
650this.AddError(ErrorCode.ERR_ExpectedVerbatimLiteral);
697this.AddError(ErrorCode.ERR_EndifDirectiveExpected);
702this.AddError(ErrorCode.ERR_EndRegionDirectiveExpected);
751this.AddError(ErrorCode.ERR_UnexpectedCharacter, messageText);
935this.AddError(MakeError(ErrorCode.ERR_LegacyObjectIdSyntax));
972this.AddError(MakeError(ErrorCode.ERR_InvalidReal));
1044this.AddError(MakeError(start, TextWindow.Position - start, ErrorCode.ERR_InvalidNumber));
1076this.AddError(MakeError(ErrorCode.ERR_InvalidNumber));
1204this.AddError(MakeError(ErrorCode.ERR_IntOverflow));
1218this.AddError(MakeError(ErrorCode.ERR_IntOverflow));
1224this.AddError(MakeError(ErrorCode.ERR_IntOverflow));
1236this.AddError(MakeError(ErrorCode.ERR_FloatOverflow, "double"));
1248this.AddError(MakeError(ErrorCode.ERR_FloatOverflow, "float"));
1283this.AddError(this.MakeError(start, end - start, ErrorCode.ERR_FloatOverflow, "decimal"));
1637this.AddError(start, atCount, ErrorCode.ERR_IllegalAtSequence);
1978this.AddError(TextWindow.Position, width: 1, ErrorCode.ERR_UnexpectedCharacter, '@');
2017var error = new SyntaxDiagnosticInfo(offset: 0, width: 1, code: ErrorCode.ERR_BadDirectivePlacement);
2075this.AddError(ErrorCode.ERR_OpenEndedComment);
2124ErrorCode.ERR_Merge_conflict_marker_encountered);
2844this.AddError(TextWindow.LexemeStartPosition, TextWindow.Width, ErrorCode.ERR_OpenEndedComment);
3747this.AddCrefError(ErrorCode.ERR_UnexpectedCharacter, ".");
3886this.AddError(ErrorCode.ERR_ExpectedVerbatimLiteral);
3893this.AddCrefError(ErrorCode.ERR_UnexpectedCharacter, info.Text);
3904this.AddCrefError(ErrorCode.ERR_UnexpectedCharacter, info.Text);
3997private void AddCrefError(ErrorCode code, params object[] args)
4010this.AddError(ErrorCode.WRN_ErrorOverride, info, info.Code);
4871ErrorCode.ERR_IllegalEscape);
Parser\Lexer_StringLiteral.cs (28)
30this.AddError(ErrorCode.ERR_RawStringNotInDirectives);
64this.AddError(ErrorCode.ERR_NewlineInConst);
80this.AddError((_builder.Length != 0) ? ErrorCode.ERR_TooManyCharsInConst : ErrorCode.ERR_EmptyCharConst);
185this.AddError(start, TextWindow.Position - start, ErrorCode.ERR_IllegalEscape);
205this.AddError(start, width: TextWindow.Position - start, ErrorCode.ERR_IllegalAtSequence);
233this.AddError(ErrorCode.ERR_UnterminatedStringLit);
464TrySetError(_lexer.MakeError(start, window.Position - start, ErrorCode.ERR_StringMustStartWithQuoteCharacter));
475TrySetError(_lexer.MakeError(start, window.Position - start, ErrorCode.ERR_IllegalAtSequence));
481TrySetError(_lexer.MakeError(window.Position - startingQuoteCount, startingQuoteCount, ErrorCode.ERR_NotEnoughQuotesForRawString));
539width: 1, ErrorCode.ERR_UnterminatedStringLit));
562width: 1, ErrorCode.ERR_UnterminatedRawString));
581ErrorCode.ERR_TooManyQuotesForRawString));
596_lexer.TextWindow.Position - 1, width: 1, ErrorCode.ERR_UnterminatedRawString));
609ErrorCode.ERR_RawStringDelimiterOnOwnLine));
628ErrorCode.ERR_TooManyQuotesForRawString));
682TrySetError(_lexer.MakeError(escapeStart, _lexer.TextWindow.Position - escapeStart, ErrorCode.ERR_EscapedCurly, ch));
713_lexer.TextWindow.Position - closeQuoteCount, closeQuoteCount, ErrorCode.ERR_RawStringMustContainContent));
813TrySetError(_lexer.MakeError(pos, 1, ErrorCode.ERR_UnescapedCurly, "}"));
831ErrorCode.ERR_TooManyCloseBracesForRawString));
867TrySetError(_lexer.MakeError(openBracePosition - 1, 2, ErrorCode.ERR_UnclosedExpressionHole));
902ErrorCode.ERR_TooManyOpenBracesForRawString));
917ErrorCode.ERR_UnclosedExpressionHole));
925ErrorCode.ERR_NotEnoughCloseBracesForRawString));
965TrySetError(_lexer.MakeError(pos, 1, ErrorCode.ERR_EscapedCurly, ch));
982_lexer.TextWindow.Position, 1, ErrorCode.ERR_UnexpectedCharacter, ch));
1022TrySetError(_lexer.MakeError(_lexer.TextWindow.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString()));
1054TrySetError(_lexer.MakeError(_lexer.TextWindow.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString()));
Parser\SyntaxParser.cs (33)
564private SyntaxToken CreateMissingToken(SyntaxKind expected, ErrorCode code, bool reportError)
595protected SyntaxToken EatToken(SyntaxKind kind, ErrorCode code, bool reportError = true)
621protected SyntaxToken EatTokenWithPrejudice(ErrorCode errorCode, params object[] args)
628protected SyntaxToken EatContextualToken(SyntaxKind kind, ErrorCode code, bool reportError = true)
659var code = GetExpectedTokenErrorCode(expected, actual);
660if (code == ErrorCode.ERR_SyntaxError)
664else if (code == ErrorCode.ERR_IdentifierExpectedKW)
682private static ErrorCode GetExpectedTokenErrorCode(SyntaxKind expected, SyntaxKind actual)
689return ErrorCode.ERR_IdentifierExpectedKW; // A keyword -- use special message.
693return ErrorCode.ERR_IdentifierExpected;
697return ErrorCode.ERR_SemicolonExpected;
702return ErrorCode.ERR_CloseParenExpected;
704return ErrorCode.ERR_LbraceExpected;
706return ErrorCode.ERR_RbraceExpected;
710return ErrorCode.ERR_SyntaxError;
758protected TNode AddError<TNode>(TNode node, ErrorCode code) where TNode : GreenNode
763protected TNode AddErrorAsWarning<TNode>(TNode node, ErrorCode code, params object[] args) where TNode : GreenNode
766return AddError(node, ErrorCode.WRN_ErrorOverride, MakeError(node, code, args), (int)code);
769protected TNode AddError<TNode>(TNode node, ErrorCode code, params object[] args) where TNode : GreenNode
819protected TNode AddError<TNode>(TNode node, int offset, int length, ErrorCode code, params object[] args) where TNode : CSharpSyntaxNode
824protected TNode AddError<TNode>(TNode node, CSharpSyntaxNode location, ErrorCode code, params object[] args) where TNode : CSharpSyntaxNode
832protected TNode AddErrorToFirstToken<TNode>(TNode node, ErrorCode code) where TNode : CSharpSyntaxNode
838protected TNode AddErrorToFirstToken<TNode>(TNode node, ErrorCode code, params object[] args) where TNode : CSharpSyntaxNode
844protected TNode AddErrorToLastToken<TNode>(TNode node, ErrorCode code) where TNode : CSharpSyntaxNode
852protected TNode AddErrorToLastToken<TNode>(TNode node, ErrorCode code, params object[] args) where TNode : CSharpSyntaxNode
873protected static SyntaxDiagnosticInfo MakeError(int offset, int width, ErrorCode code)
878protected static SyntaxDiagnosticInfo MakeError(int offset, int width, ErrorCode code, params object[] args)
883protected static SyntaxDiagnosticInfo MakeError(GreenNode node, ErrorCode code, params object[] args)
888protected static SyntaxDiagnosticInfo MakeError(ErrorCode code, params object[] args)
967tokenDiagnostics[i] = new SyntaxDiagnosticInfo(d.Offset - leadingWidth, d.Width, (ErrorCode)d.Code, d.Arguments);
1020targetDiagnostics[i] = new SyntaxDiagnosticInfo(d.Offset + triviaWidth, d.Width, (ErrorCode)d.Code, d.Arguments);
1034new SyntaxDiagnosticInfo(newOffset, diagnostic.Width, (ErrorCode)diagnostic.Code, diagnostic.Arguments)
1147return AddError(node, ErrorCode.WRN_ErrorOverride, info, (int)info.Code);
Symbols\AssemblySymbol.cs (3)
362DiagnosticInfo diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_CycleInTypeForwarder, emittedName.FullName, this.Name);
368var diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_TypeForwardedToMultipleAssemblies, forwardingModule, this, emittedName.FullName, destination1, destination2);
1001warnings.Add(ErrorCode.WRN_MultiplePredefTypes, NoLocation.Singleton, result, result.ContainingAssembly);
Symbols\Attributes\AttributeData.cs (11)
248((BindingDiagnosticBag)arguments.Diagnostics).Add(ErrorCode.ERR_IllegalUnsafe, arguments.AttributeSyntaxOpt.Location);
299((BindingDiagnosticBag)arguments.Diagnostics).Add(ErrorCode.WRN_MemberNotNullBadMember, arguments.AttributeSyntaxOpt.Location, memberName);
377diagnostics.Add(ErrorCode.ERR_SecurityAttributeMissingAction, nodeOpt != null ? nodeOpt.Name.Location : NoLocation.Singleton);
400diagnostics.Add(ErrorCode.ERR_PrincipalPermissionInvalidAction, syntaxLocation, displayString);
430diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidAction, syntaxLocation, nodeOpt != null ? nodeOpt.GetErrorDisplayName() : "", displayString);
446diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidActionTypeOrMethod, syntaxLocation, displayString);
460diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidActionAssembly, syntaxLocation, displayString);
536diagnostics.Add(ErrorCode.ERR_PermissionSetAttributeInvalidFile, argSyntaxLocation, fileName ?? "<null>", filePropName);
592diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, this.GetAttributeArgumentLocation(0), nodeOpt != null ? nodeOpt.GetErrorDisplayName() : "");
618diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, this.GetAttributeArgumentLocation(0), node.GetErrorDisplayName());
635diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attributeArgumentSyntaxLocation, nodeOpt != null ? nodeOpt.GetErrorDisplayName() : "");
Symbols\ConstraintsHelper.cs (30)
106diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportByRefLikeGenerics, location);
118diagnostics.Add(ErrorCode.ERR_ClassIsCombinedWithRefStruct, typeParameter.GetFirstLocation());
179diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(constraintTypeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_CircularConstraint, constraintTypeParameter, typeParameter))));
198ErrorCode errorCode;
201errorCode = ErrorCode.ERR_ConWithUnmanagedCon;
205errorCode = ErrorCode.ERR_ConWithValCon;
251diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(underlyingTypeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_CircularConstraint, underlyingTypeParameter, typeParameter))));
303diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_BaseConstraintConflict, typeParameter, constraintDeducedBase, deducedBaseType))));
705args.Diagnostics.Add(ErrorCode.ERR_BogusType, args.Location, type);
743args.Diagnostics.Add(ErrorCode.ERR_BogusType, args.Location, type);
938diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_BadTypeArgument, typeArgument.Type))));
955diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_RuntimeDoesNotSupportByRefLikeGenerics))));
961diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_NotRefStructConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type))));
969diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_GenericArgIsStaticClass, typeArgument.Type))));
978diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_RefConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type))));
994diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_UnmanagedConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type))));
1018diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_ValConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type))));
1069new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers, iface, member))));
1103diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_NewConstraintNotSatisfied, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type))));
1107diagnosticsBuilder.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_NewConstraintCannotHaveRequiredMembers, containingSymbol.ConstructedFrom(), typeParameter, typeArgument.Type))));
1126nullabilityDiagnosticsBuilderOpt.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.WRN_NullabilityMismatchInTypeParameterNotNullConstraint, containingSymbol.ConstructedFrom(), typeParameter, typeArgument))));
1133nullabilityDiagnosticsBuilderOpt.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.WRN_NullabilityMismatchInTypeParameterReferenceTypeConstraint, containingSymbol.ConstructedFrom(), typeParameter, typeArgument))));
1157nullabilityDiagnosticsBuilderOpt.Add(new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.WRN_NullabilityMismatchInTypeParameterConstraint, containingSymbol.ConstructedFrom(), constraintType, typeParameter, typeArgument))));
1163ErrorCode errorCode;
1166errorCode = ErrorCode.ERR_GenericConstraintNotSatisfiedRefType;
1170errorCode = constraintType.Type.IsInterfaceType() ? ErrorCode.ERR_GenericConstraintNotSatisfiedNullableInterface : ErrorCode.ERR_GenericConstraintNotSatisfiedNullableEnum;
1174errorCode = ErrorCode.ERR_GenericConstraintNotSatisfiedTyVar;
1178errorCode = ErrorCode.ERR_GenericConstraintNotSatisfiedValType;
1425return new TypeParameterDiagnosticInfo(typeParameter, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_BaseConstraintConflict, typeParameter, deducedBase, classConflict ? "class" : "struct")));
Symbols\Extensions\SynthesizedExtensionMarker.cs (7)
73diagnostics.Add(ErrorCode.ERR_ReceiverParameterOnlyOne, parameterList.Parameters[parameterIndex].GetLocation());
90diagnostics.Add(ErrorCode.ERR_BadTypeforThis, parameterTypeSyntax, parameterType);
94diagnostics.Add(ErrorCode.ERR_RefExtensionParameterMustBeValueTypeOrConstrainedToOne, parameterTypeSyntax);
98diagnostics.Add(ErrorCode.ERR_InExtensionParameterMustBeValueType, parameterTypeSyntax);
103diagnostics.Add(ErrorCode.ERR_ModifierOnUnnamedReceiverParameter, parameterTypeSyntax);
110diagnostics.Add(ErrorCode.ERR_ReceiverParameterSameNameAsTypeParameter, parameter.GetFirstLocation(), name);
126diagnostics.Add(ErrorCode.ERR_UnderspecifiedExtension, parameter.GetFirstLocation(), underlyingType, typeParameter);
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (11)
61diagnostics.Add(ErrorCode.ERR_DupReturnTypeMod, modifier.GetLocation(), modifier.Text);
66diagnostics.Add(ErrorCode.ERR_InvalidFuncPointerReturnTypeModifier, modifier.GetLocation(), modifier.Text);
75diagnostics.Add(ErrorCode.ERR_NoVoidHere, returnTypeParameter.Location);
83diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, returnTypeParameter.Location, returnType);
119diagnostics.Add(ErrorCode.ERR_CannotSpecifyManagedWithUnmanagedSpecifiers, callingConventionSyntax.UnmanagedCallingConventionList.GetLocation());
166diagnostics.Add(ErrorCode.ERR_InvalidFunctionPointerCallingConvention, unmanagedList.OpenBracketToken.GetLocation(), "");
217specifierType = new MissingMetadataTypeSymbol.TopLevel(compilation.Assembly.CorLibrary.Modules[0], ref metadataName, new CSDiagnosticInfo(ErrorCode.ERR_TypeNotFound, typeName));
221diagnostics.Add(ErrorCode.ERR_TypeMustBePublic, specifier.GetLocation(), specifierType);
233diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportUnmanagedDefaultCallConv, errorLocation);
781MergeUseSiteInfo(ref info, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_UnsupportedCallingConvention, this)));
792MergeUseSiteInfo(ref info, new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_BindToBogus, this)));
Symbols\MissingMetadataTypeSymbol.cs (6)
80return new CSDiagnosticInfo(ErrorCode.ERR_NoTypeDef, this, containingAssembly.Identity);
89return new CSDiagnosticInfo(ErrorCode.ERR_NoTypeDefFromModule, this, containingModule.Name);
112return new CSDiagnosticInfo(ErrorCode.ERR_MissingTypeInSource, this);
121return new CSDiagnosticInfo(ErrorCode.ERR_MissingTypeInAssembly, this, containingAssembly.Name);
131return new CSDiagnosticInfo(ErrorCode.ERR_BogusType, string.Empty);
324new CSDiagnosticInfo(ErrorCode.ERR_PredefinedTypeNotFound, MetadataHelpers.BuildQualifiedName(_namespaceName, MetadataName)) :
Symbols\ObsoleteAttributeHelpers.cs (20)
183return new CSDiagnosticInfo(ErrorCode.WRN_WindowsExperimental,
194return new CustomObsoleteDiagnosticInfo(MessageProvider.Instance, (int)ErrorCode.WRN_Experimental, data,
199return new CustomObsoleteDiagnosticInfo(MessageProvider.Instance, (int)ErrorCode.WRN_ExperimentalWithMessage, data,
207var errorCode = (message: data.Message, isError: data.IsError, isColInit) switch
210(message: null, isError: _, isColInit: true) => ErrorCode.WRN_DeprecatedCollectionInitAdd,
211(message: null, isError: _, isColInit: false) => ErrorCode.WRN_DeprecatedSymbol,
212(message: { }, isError: true, isColInit: true) => ErrorCode.ERR_DeprecatedCollectionInitAddStr,
213(message: { }, isError: true, isColInit: false) => ErrorCode.ERR_DeprecatedSymbolStr,
214(message: { }, isError: false, isColInit: true) => ErrorCode.WRN_DeprecatedCollectionInitAddStr,
215(message: { }, isError: false, isColInit: false) => ErrorCode.WRN_DeprecatedSymbolStr
228return (ErrorCode)diagnosticInfo.Code is
229(ErrorCode.WRN_Experimental or ErrorCode.WRN_ExperimentalWithMessage or ErrorCode.WRN_WindowsExperimental or ErrorCode.WRN_DeprecatedCollectionInitAdd or
230ErrorCode.WRN_DeprecatedSymbol or ErrorCode.ERR_DeprecatedCollectionInitAddStr or
231ErrorCode.ERR_DeprecatedSymbolStr or ErrorCode.WRN_DeprecatedCollectionInitAddStr or
232ErrorCode.WRN_DeprecatedSymbolStr);
Symbols\Source\ExplicitInterfaceHelpers.cs (15)
199diagnostics.Add(ErrorCode.ERR_ExplicitInterfaceImplementationInNonClassOrStruct, memberLocation, implementingMember);
209diagnostics.Add(ErrorCode.ERR_ExplicitInterfaceImplementationNotInterface, location, explicitInterfaceType);
227diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInExplicitlyImplementedInterface, location);
231diagnostics.Add(ErrorCode.ERR_ClassDoesntImplementInterface, location, implementingMember, explicitInterfaceNamedType);
275diagnostics.Add(ErrorCode.ERR_ExplicitMethodImplAccessor, memberLocation, implementingMember, interfaceMember);
281diagnostics.Add(ErrorCode.ERR_BogusExplicitImpl, memberLocation, implementingMember, interfaceMember);
287diagnostics.Add(ErrorCode.ERR_ExplicitImplParams, memberLocation, implementingMember, interfaceMember);
300diagnostics.Add(ErrorCode.ERR_InterfaceMemberNotFound, memberLocation, implementingMember);
310diagnostics.Add(ErrorCode.ERR_BadAccess, memberLocation, implementedMember);
334diagnostics.Add(ErrorCode.ERR_BadAccess, memberLocation, accessor);
359diagnostics.Add(ErrorCode.ERR_ImplBadTupleNames, memberLocation, implementingMember, implementedMember);
370diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, implementingMember.GetFirstLocation());
411diagnostics.Add(ErrorCode.ERR_ExplicitImplCollisionOnRefOut, explicitInterfaceType.GetFirstLocation(), explicitInterfaceType, implementedMember);
416diagnostics.Add(ErrorCode.WRN_ExplicitImplCollision, implementingMember.GetFirstLocation(), implementingMember);
428diagnostics.Add(ErrorCode.WRN_ExplicitImplCollision, implementingMember.GetFirstLocation(), implementingMember);
Symbols\Source\ModifierUtils.cs (12)
97diagnostics.Add(ErrorCode.ERR_StaticNotVirtual, errorLocation, ModifierUtils.ConvertSingleModifierToSyntaxText(oneError));
101diagnostics.Add(ErrorCode.ERR_BadMemberFlag, errorLocation, ConvertSingleModifierToSyntaxText(oneError));
138diagnostics.Add(ErrorCode.ERR_PartialMisplaced, partialToken.GetLocation());
143diagnostics.Add(ErrorCode.ERR_PartialMisplaced, errorLocation);
165diagnostics.Add(ErrorCode.ERR_BadMemberFlag, errorLocation, ConvertSingleModifierToSyntaxText(DeclarationModifiers.Sealed));
206diagnostics.Add(ErrorCode.ERR_InvalidModifierForLanguageVersion, errorLocation,
436ErrorCode.ERR_PartialMisplaced,
474ErrorCode.ERR_DuplicateModifier,
487diagnostics.Add(ErrorCode.ERR_BadMemberProtection, errorLocation);
503diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportProtectedAccessForInterfaceMember, errorLocation);
520diagnostics.Add(ErrorCode.ERR_RequiredMemberCannotBeLessVisibleThanContainingType, errorLocation, symbol, symbol.ContainingType);
526diagnostics.Add(ErrorCode.ERR_RequiredMemberMustBeSettable, errorLocation, symbol);
Symbols\Source\ParameterHelpers.cs (30)
152diagnostics.Add(ErrorCode.ERR_NoVoidParameter, syntax.Type.Location);
273diagnostics.Add(ErrorCode.ERR_ThisInBadContext, thisKeyword.GetLocation());
289diagnostics.Add(ErrorCode.ERR_IllegalVarArgs, arglistToken.GetLocation());
295diagnostics.Add(ErrorCode.ERR_VarargsLast, concreteParam.GetLocation());
315diagnostics.Add(ErrorCode.ERR_IllegalRefParam, refnessKeyword.GetLocation());
553diagnostics.Add(ErrorCode.ERR_ThisInBadContext, modifier.GetLocation());
565diagnostics.Add(ErrorCode.ERR_BadParamModThis, modifier.GetLocation());
635diagnostics.Add(ErrorCode.ERR_IllegalParams, modifier.GetLocation());
643diagnostics.Add(ErrorCode.ERR_BadParamModThis, modifier.GetLocation());
668diagnostics.Add(ErrorCode.ERR_ImplicitlyTypedParamsParameter, modifier, parameterIdentifier);
720diagnostics.Add(ErrorCode.ERR_RefReadOnlyWrongOrdering, modifier);
731diagnostics.Add(ErrorCode.ERR_BadFuncPointerParamModifier, modifier.GetLocation(), SyntaxFacts.GetText(modifier.Kind()));
743diagnostics.Add(ErrorCode.ERR_DupParamMod, modifier.GetLocation(), SyntaxFacts.GetText(modifier.Kind()));
748diagnostics.Add(ErrorCode.ERR_BadParameterModifiers, modifier.GetLocation(), SyntaxFacts.GetText(modifier.Kind()), SyntaxFacts.GetText(otherModifierKind));
753diagnostics.Add(ErrorCode.ERR_ParamsCantBeWithModifier, modifier.GetLocation(), SyntaxFacts.GetText(otherModifierKind));
782diagnostics.Add(ErrorCode.ERR_BadThisParam, thisKeyword.GetLocation(), owner?.Name ?? "");
787diagnostics.Add(ErrorCode.ERR_IllegalParams, paramsKeyword.GetLocation());
811diagnostics.Add(ErrorCode.ERR_DefaultValueBeforeRequiredValue, loc);
818diagnostics.Add(ErrorCode.ERR_MethodArgCantBeRefAny, syntax.Location, typeWithAnnotations.Type);
824diagnostics.Add(ErrorCode.ERR_ParamsLast, syntax.GetLocation());
861diagnostics.Add(ErrorCode.ERR_ExtensionParameterDisallowsDefaultValue, parameterSyntax.GetLocation());
879diagnostics.Add(ErrorCode.ERR_RefOutDefaultValue, refnessKeyword.GetLocation());
885diagnostics.Add(ErrorCode.ERR_DefaultValueForParamsParameter, paramsKeyword.GetLocation());
895diagnostics.Add(ErrorCode.ERR_DefaultValueForExtensionParameter, thisKeyword.GetLocation());
904diagnostics.Add(ErrorCode.ERR_DefaultValueMustBeConstant, parameterSyntax.Default.Value.Location, parameterSyntax.Identifier.ValueText);
917diagnostics.Add(ErrorCode.ERR_NoConversionForDefaultParam, parameterSyntax.Identifier.GetLocation(),
929diagnostics.Add(ErrorCode.ERR_NotNullRefDefaultParameter, parameterSyntax.Identifier.GetLocation(),
951diagnostics.Add(ErrorCode.ERR_NoConversionForNubDefaultParam, parameterSyntax.Identifier.GetLocation(),
980diagnostics.Add(ErrorCode.WRN_DefaultValueForUnconsumedLocation,
988diagnostics.Add(ErrorCode.WRN_RefReadonlyParameterDefaultValue, parameterSyntax.Default.Value, parameterSyntax.Identifier.ValueText);
Symbols\Source\SourceAssemblySymbol.cs (47)
598diagnostics.Add(ErrorCode.WRN_DelaySignButNoKey, NoLocation.Singleton);
605diagnostics.Add(ErrorCode.ERR_PublicSignNetModule, NoLocation.Singleton);
609diagnostics.Add(ErrorCode.ERR_PublicSignButNoKey, NoLocation.Singleton);
627diagnostics.Add(ErrorCode.ERR_SignButNoPrivateKey, NoLocation.Singleton, StrongNameKeys.KeyFilePath);
743diagnostics.Add(ErrorCode.ERR_FriendAssemblySNReq, oneKey.Value.Item1, oneKey.Value.Item2);
774diagnostics.Add(ErrorCode.WRN_CmdOptionConflictsSource, NoLocation.Singleton, "DelaySign", AttributeDescription.AssemblyDelaySignAttribute.FullName);
779diagnostics.Add(ErrorCode.WRN_CmdOptionConflictsSource, NoLocation.Singleton,
815diagnostics.Add(ErrorCode.ERR_CmdOptionConflictsSource, NoLocation.Singleton, AttributeDescription.AssemblyKeyNameAttribute.FullName, "CryptoKeyContainer");
819diagnostics.Add(ErrorCode.WRN_CmdOptionConflictsSource, NoLocation.Singleton, "CryptoKeyContainer", AttributeDescription.AssemblyKeyNameAttribute.FullName);
828diagnostics.Add(ErrorCode.WRN_AttributeIgnoredWhenPublicSigning, NoLocation.Singleton, AttributeDescription.AssemblyKeyNameAttribute.FullName);
852diagnostics.Add(ErrorCode.ERR_CmdOptionConflictsSource, NoLocation.Singleton, AttributeDescription.AssemblyKeyFileAttribute.FullName, "CryptoKeyFile");
856diagnostics.Add(ErrorCode.WRN_CmdOptionConflictsSource, NoLocation.Singleton, "CryptoKeyFile", AttributeDescription.AssemblyKeyFileAttribute.FullName);
865diagnostics.Add(ErrorCode.WRN_AttributeIgnoredWhenPublicSigning, NoLocation.Singleton, AttributeDescription.AssemblyKeyFileAttribute.FullName);
982diagnostics.Add(ErrorCode.ERR_NetModuleNameMismatch, NoLocation.Singleton, moduleName, fileName);
999diagnostics.Add(ErrorCode.ERR_NetModuleNameMustBeUnique, NoLocation.Singleton, m.Name);
1013diagnostics.Add(ErrorCode.ERR_AgnosticToMachineModule, NoLocation.Singleton, m);
1019diagnostics.Add(ErrorCode.ERR_ConflictingMachineModule, NoLocation.Singleton, m);
1037diagnostics.Add(ErrorCode.ERR_MissingNetModuleReference, NoLocation.Singleton, referencedModuleName);
1043diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_BindToBogus, m), NoLocation.Singleton);
1094diagnostics.Add(ErrorCode.ERR_DuplicateNameInNS, y.GetFirstLocationOrNone(),
1258diagnostics.Add(ErrorCode.WRN_AssemblyAttributeFromModuleIsOverridden, NoLocation.Singleton, attribute.AttributeClass, netModuleName);
1264diagnostics.Add(ErrorCode.ERR_DuplicateAttributeInNetModule, NoLocation.Singleton, attribute.AttributeClass.Name, netModuleName);
2110bag.Add(ErrorCode.ERR_FriendRefNotEqualToThis, NoLocation.Singleton,
2113bag.Add(ErrorCode.ERR_FriendRefSigningMismatch, NoLocation.Singleton,
2212diagnostics.Add(ErrorCode.ERR_InvalidFwdType, GetAssemblyAttributeLocationForDiagnostic(arguments.AttributeSyntaxOpt));
2217if (useSiteInfo.DiagnosticInfo?.Code != (int)ErrorCode.ERR_UnexpectedUnboundGenericName &&
2227diagnostics.Add(ErrorCode.ERR_ForwardedTypeInThisAssembly, GetAssemblyAttributeLocationForDiagnostic(arguments.AttributeSyntaxOpt), forwardedType);
2233diagnostics.Add(ErrorCode.ERR_ForwardedTypeIsNested, GetAssemblyAttributeLocationForDiagnostic(arguments.AttributeSyntaxOpt), forwardedType, forwardedType.ContainingType);
2243diagnostics.Add(ErrorCode.ERR_InvalidFwdType, GetAssemblyAttributeLocationForDiagnostic(arguments.AttributeSyntaxOpt));
2263diagnostics.Add(ErrorCode.ERR_DuplicateTypeForwarder, GetAssemblyAttributeLocationForDiagnostic(arguments.AttributeSyntaxOpt), forwardedType);
2281diagnostics.Add(ErrorCode.ERR_CannotPassNullForFriendAssembly, GetAssemblyAttributeLocationForDiagnostic(nodeOpt));
2289diagnostics.Add(ErrorCode.WRN_InvalidAssemblyName, GetAssemblyAttributeLocationForDiagnostic(nodeOpt), displayName);
2299diagnostics.Add(ErrorCode.ERR_FriendAssemblyBadArgs, GetAssemblyAttributeLocationForDiagnostic(nodeOpt), displayName);
2381diagnostics.Add(ErrorCode.ERR_InvalidSignaturePublicKey, attribute.GetAttributeArgumentLocation(0));
2404diagnostics.Add(foundBadWildcard ? ErrorCode.ERR_InvalidVersionFormatDeterministic : ErrorCode.ERR_InvalidVersionFormat, attributeArgumentSyntaxLocation, verString ?? "<null>");
2416diagnostics.Add(ErrorCode.WRN_InvalidVersionFormat, attributeArgumentSyntaxLocation, verString ?? "<null>");
2436diagnostics.Add(ErrorCode.ERR_InvalidAssemblyCultureForExe, attribute.GetAttributeArgumentLocation(0));
2440diagnostics.Add(ErrorCode.ERR_InvalidAssemblyCulture, attribute.GetAttributeArgumentLocation(0));
2467diagnostics.Add(ErrorCode.ERR_InvalidVersionFormat2, attribute.GetAttributeArgumentLocation(0), verString ?? "<null>");
2566diagnostics.Add(ErrorCode.ERR_ExplicitExtension, arguments.AttributeSyntaxOpt.Location);
2604diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attribute.GetAttributeArgumentLocation(i), (object)nodeOpt != null ? nodeOpt.GetErrorDisplayName() : "");
2736diagnostics.Add(ErrorCode.WRN_UnreferencedEvent, associatedPropertyOrEvent.GetFirstLocationOrNone(), associatedPropertyOrEvent);
2741diagnostics.Add(ErrorCode.WRN_UnreferencedField, field.GetFirstLocationOrNone(), field);
2745diagnostics.Add(ErrorCode.WRN_UnassignedInternalRefField, field.GetFirstLocationOrNone(), field);
2749diagnostics.Add(ErrorCode.WRN_UnassignedInternalField, field.GetFirstLocationOrNone(), field, DefaultValue(field.Type));
2769diagnostics.Add(ErrorCode.WRN_UnreferencedFieldAssg, field.GetFirstLocationOrNone(), field);
Symbols\Source\SourceComplexParameterSymbol.cs (49)
760diagnostics.Add(ErrorCode.ERR_DefaultValueUsedWithAttributes, arguments.AttributeSyntaxOpt.Name.Location);
766diagnostics.Add(ErrorCode.ERR_ExplicitParamArrayOrCollection, arguments.AttributeSyntaxOpt.Name.Location);
861diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.AttributeSyntaxOpt.Location);
866diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedTarget, arguments.AttributeSyntaxOpt.Location);
870diagnostics.Add(ErrorCode.ERR_UnscopedScoped, arguments.AttributeSyntaxOpt.Location);
905diagnostics.Add(ErrorCode.WRN_RefReadonlyParameterDefaultValue, syntax, this.Name);
925diagnostics.Add(ErrorCode.ERR_ParamDefaultValueDiffersFromAttribute, syntax.Location);
958diagnosticsOpt.Add(ErrorCode.ERR_DefaultValueUsedWithAttributes, node.Name.Location);
996diagnosticsOpt.Add(ErrorCode.ERR_DefaultValueTypeMustMatch, node.Name.Location);
1006diagnosticsOpt.Add(ErrorCode.ERR_DefaultValueBadValueType, node.Name.Location, arg.TypeInternal);
1016diagnosticsOpt.Add(ErrorCode.ERR_DefaultValueTypeMustMatch, node.Name.Location);
1064diagnostics.Add(ErrorCode.WRN_CallerLineNumberParamForUnconsumedLocation, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1070diagnostics.Add(ErrorCode.ERR_NoConversionForCallerLineNumberParam, node.Name.Location, intType, TypeWithAnnotations.Type);
1077diagnostics.Add(ErrorCode.ERR_BadCallerLineNumberParamWithoutDefaultValue, node.Name.Location);
1092diagnostics.Add(ErrorCode.WRN_CallerFilePathParamForUnconsumedLocation, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1098diagnostics.Add(ErrorCode.ERR_NoConversionForCallerFilePathParam, node.Name.Location, stringType, TypeWithAnnotations.Type);
1105diagnostics.Add(ErrorCode.ERR_BadCallerFilePathParamWithoutDefaultValue, node.Name.Location);
1110diagnostics.Add(ErrorCode.WRN_CallerLineNumberPreferredOverCallerFilePath, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1125diagnostics.Add(ErrorCode.WRN_CallerMemberNameParamForUnconsumedLocation, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1131diagnostics.Add(ErrorCode.ERR_NoConversionForCallerMemberNameParam, node.Name.Location, stringType, TypeWithAnnotations.Type);
1138diagnostics.Add(ErrorCode.ERR_BadCallerMemberNameParamWithoutDefaultValue, node.Name.Location);
1143diagnostics.Add(ErrorCode.WRN_CallerLineNumberPreferredOverCallerMemberName, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1148diagnostics.Add(ErrorCode.WRN_CallerFilePathPreferredOverCallerMemberName, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1166diagnostics.Add(ErrorCode.WRN_CallerArgumentExpressionParamForUnconsumedLocation, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1172diagnostics.Add(ErrorCode.ERR_NoConversionForCallerArgumentExpressionParam, node.Name.Location, stringType, TypeWithAnnotations.Type);
1179diagnostics.Add(ErrorCode.ERR_BadCallerArgumentExpressionParamWithoutDefaultValue, node.Name.Location);
1184diagnostics.Add(ErrorCode.WRN_CallerLineNumberPreferredOverCallerArgumentExpression, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1189diagnostics.Add(ErrorCode.WRN_CallerFilePathPreferredOverCallerArgumentExpression, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1194diagnostics.Add(ErrorCode.WRN_CallerMemberNamePreferredOverCallerArgumentExpression, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1200diagnostics.Add(ErrorCode.WRN_CallerArgumentExpressionAttributeHasInvalidParameterName, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1205diagnostics.Add(ErrorCode.WRN_CallerArgumentExpressionAttributeSelfReferential, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1215diagnostics.Add(ErrorCode.WRN_UnconsumedEnumeratorCancellationAttributeUsage, node.Name.Location, ParameterSyntax.Identifier.ValueText);
1246diagnostics.Add(ErrorCode.ERR_TypeIsNotAnInterpolatedStringHandlerType, arguments.AttributeSyntaxOpt.Location, Type);
1254diagnostics.Add(ErrorCode.WRN_InterpolatedStringHandlerArgumentAttributeIgnoredOnLambdaParameters, arguments.AttributeSyntaxOpt.Location);
1282diagnostics.Add(ErrorCode.ERR_NullInvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt!.Location);
1326diagnostics.Add(ErrorCode.ERR_NullInvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt.Location);
1344diagnostics.Add(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt.Location, ContainingSymbol);
1355diagnostics.Add(ErrorCode.ERR_InvalidInterpolatedStringHandlerArgumentName, arguments.AttributeSyntaxOpt.Location, name, ContainingSymbol);
1362diagnostics.Add(ErrorCode.ERR_CannotUseSelfAsInterpolatedStringHandlerArgument, arguments.AttributeSyntaxOpt.Location);
1371diagnostics.Add(ErrorCode.WRN_ParameterOccursAfterInterpolatedStringHandlerParameter, arguments.AttributeSyntaxOpt.Location, parameter.Name, this.Name);
1402diagnostics.Add(ErrorCode.ERR_OutAttrOnRefParam, this.GetFirstLocation());
1409diagnostics.Add(ErrorCode.ERR_InAttrOnOutParam, this.GetFirstLocation());
1416diagnostics.Add(ErrorCode.ERR_OutAttrOnInParam, this.GetFirstLocation());
1423diagnostics.Add(ErrorCode.ERR_OutAttrOnRefReadonlyParam, this.GetFirstLocation());
1538diagnostics.Add(ErrorCode.ERR_ScopedRefAndRefStructOnly, ParameterSyntax);
1593diagnostics.Add(ErrorCode.ERR_ParamsCollectionExtensionAddMethod, syntax, Type);
1614diagnostics.Add(ErrorCode.ERR_ParamsMemberCannotBeLessVisibleThanDeclaringMember, syntax, reportAsLessVisible, ContainingSymbol);
1669diagnostics.Add(ErrorCode.ERR_ParamsMemberCannotBeLessVisibleThanDeclaringMember, syntax, method, ContainingSymbol);
1675diagnostics.Add(ErrorCode.ERR_ParamsMustBeCollection, ParameterSyntax.Modifiers.First(static m => m.IsKind(SyntaxKind.ParamsKeyword)).GetLocation());
Symbols\Source\SourceConstructorSymbol.cs (14)
44diagnostics.Add(ErrorCode.ERR_StaticConstructorWithAccessModifiers, location, this);
50diagnostics.Add(ErrorCode.ERR_MemberNeedsType, location);
59diagnostics.Add(ErrorCode.ERR_ExternHasConstructorInitializer, location, this);
64diagnostics.Add(ErrorCode.ERR_ExternHasBody, location, this);
70diagnostics.Add(ErrorCode.ERR_PartialConstructorInitializer, initializer, this);
184diagnostics.Add(ErrorCode.ERR_ConcreteMissingBody, location, this);
192diagnostics.Add(ErrorCode.ERR_ConstructorInStaticClass, location);
196diagnostics.Add(ErrorCode.ERR_PartialMemberOnlyInPartialClass, location);
287diagnostics.Add(ErrorCode.ERR_PartialMemberInconsistentTupleNames, implementation.GetFirstLocation(), this, implementation);
292diagnostics.Add(ErrorCode.WRN_PartialMemberSignatureDifference, implementation.GetFirstLocation(),
299diagnostics.Add(ErrorCode.ERR_PartialMemberUnsafeDifference, implementation.GetFirstLocation());
304diagnostics.Add(ErrorCode.ERR_PartialMemberParamsDifference, implementation.GetFirstLocation());
310diagnostics.Add(ErrorCode.ERR_PartialMemberAccessibilityDifference, implementation.GetFirstLocation());
322diagnostics.Add(ErrorCode.ERR_ScopedMismatchInParameterOfPartial, implementation.GetFirstLocation(), new FormattedSymbol(implementation.Parameters[i], SymbolDisplayFormat.ShortFormat));
Symbols\Source\SourceCustomEventSymbol.cs (8)
95diagnostics.Add(ErrorCode.ERR_DuplicateAccessor, accessor.Keyword.GetLocation());
106diagnostics.Add(ErrorCode.ERR_DuplicateAccessor, accessor.Keyword.GetLocation());
112diagnostics.Add(ErrorCode.ERR_AddOrRemoveExpected, accessor.Keyword.GetLocation());
126diagnostics.Add(ErrorCode.ERR_AddRemoveMustHaveBody, accessor.SemicolonToken.GetLocation());
134diagnostics.Add(ErrorCode.ERR_AbstractEventHasAccessors, syntax.AccessorList.OpenBraceToken.GetLocation(), this);
139diagnostics.Add(ErrorCode.ERR_EventNeedsBothAccessors, this.GetFirstLocation(), this);
144diagnostics.Add(ErrorCode.ERR_ExplicitEventFieldImpl, this.GetFirstLocation());
155diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation, this.GetFirstLocation());
Symbols\Source\SourceDelegateMethodSymbol.cs (6)
67diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, returnTypeSyntax.Location, returnType.Type);
104diagnostics.Add(ErrorCode.ERR_BadVisDelegateReturn, delegateType.GetFirstLocation(), delegateType, invoke.ReturnType);
110diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, delegateType.GetFirstLocation(), invoke.ReturnType, delegateType);
119diagnostics.Add(ErrorCode.ERR_BadVisDelegateParam, delegateType.GetFirstLocation(), delegateType, parameterSymbol.Type);
123diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, delegateType.GetFirstLocation(), parameterSymbol.Type, delegateType);
277diagnostics.Add(ErrorCode.ERR_IllegalVarArgs, new SourceLocation(arglistToken));
Symbols\Source\SourceEventSymbol.cs (27)
365diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedMemberTarget, arguments.AttributeSyntaxOpt!.Location);
589diagnostics.Add(ErrorCode.ERR_VirtualPrivate, location, this);
594diagnostics.Add(ErrorCode.ERR_StaticMemberCantBeReadOnly, location, this);
599diagnostics.Add(ErrorCode.ERR_FieldLikeEventCantBeReadOnly, location, this);
604diagnostics.Add(ErrorCode.ERR_OverrideNotNew, location, this);
609diagnostics.Add(ErrorCode.ERR_SealedNonOverride, location, this);
613diagnostics.Add(ErrorCode.ERR_PartialMemberOnlyInPartialClass, location);
617diagnostics.Add(ErrorCode.ERR_PartialMemberNotExplicit, location);
621diagnostics.Add(ErrorCode.ERR_PartialMemberCannotBeAbstract, location);
626diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword));
631diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword));
635diagnostics.Add(ErrorCode.ERR_AbstractAndExtern, location, this);
639diagnostics.Add(ErrorCode.ERR_AbstractAndSealed, location, this);
643diagnostics.Add(ErrorCode.ERR_AbstractNotVirtual, location, this.Kind.Localize(), this);
651diagnostics.Add(ErrorCode.ERR_InstanceMemberInStaticClass, location, Name);
662diagnostics.Add(ErrorCode.ERR_BadVisEventType, location, this, this.Type);
667diagnostics.Add(ErrorCode.ERR_EventNotDelegate, location, this);
672diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType);
677diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType);
856diagnostics.Add(ErrorCode.ERR_ExplicitPropertyAddingAccessor, thisAccessor.GetFirstLocation(), thisAccessor, explicitlyImplementedEvent);
868diagnostics.Add(ErrorCode.ERR_PartialMemberTypeDifference, implementation.GetFirstLocation());
872diagnostics.Add(ErrorCode.ERR_PartialMemberInconsistentTupleNames, implementation.GetFirstLocation(), this, implementation);
876diagnostics.Add(ErrorCode.WRN_PartialMemberSignatureDifference, implementation.GetFirstLocation(),
883diagnostics.Add(ErrorCode.ERR_PartialMemberStaticDifference, implementation.GetFirstLocation());
888diagnostics.Add(ErrorCode.ERR_PartialMemberUnsafeDifference, implementation.GetFirstLocation());
894diagnostics.Add(ErrorCode.ERR_PartialMemberAccessibilityDifference, implementation.GetFirstLocation());
902diagnostics.Add(ErrorCode.ERR_PartialMemberExtendedModDifference, implementation.GetFirstLocation());
Symbols\Source\SourceFieldLikeEventSymbol.cs (8)
72diagnostics.Add(ErrorCode.ERR_InterfaceEventInitializer, this.GetFirstLocation(), this);
76diagnostics.Add(ErrorCode.ERR_AbstractEventInitializer, this.GetFirstLocation(), this);
80diagnostics.Add(ErrorCode.ERR_ExternEventInitializer, this.GetFirstLocation(), this);
84diagnostics.Add(ErrorCode.ERR_PartialEventInitializer, this.GetFirstLocation(), this);
98diagnostics.Add(ErrorCode.ERR_FieldlikeEventsInRoStruct, this.GetFirstLocation());
107diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, this.GetFirstLocation());
114diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation, this.GetFirstLocation());
119diagnostics.Add(ErrorCode.ERR_EventNeedsBothAccessors, this.GetFirstLocation(), this);
Symbols\Source\SourceMemberContainerSymbol.cs (33)
248diagnostics.Add(ErrorCode.ERR_PartialModifierConflict, GetFirstLocation(), this);
367diagnostics.Add(ErrorCode.ERR_AbstractSealedStatic, GetFirstLocation(), this);
373diagnostics.Add(ErrorCode.ERR_SealedStaticClass, GetFirstLocation(), this);
445diagnostics.Add(ErrorCode.ERR_FileTypeNoExplicitAccessibility, GetFirstLocation(), this);
460? ErrorCode.ERR_FileLocalDuplicateNameInNS
461: ErrorCode.ERR_DuplicateNameInNS, declaration.Declarations[i].NameLocation, this.Name, this.ContainingSymbol);
470diagnostics.Add(ErrorCode.ERR_DuplicateNameInClass, declaration.Declarations[i].NameLocation, this.ContainingSymbol, this.Name);
484diagnostics.Add(ErrorCode.ERR_MissingPartial, singleDeclaration.NameLocation, this.Name);
506if (reportIfContextual(SyntaxKind.RecordKeyword, MessageID.IDS_FeatureRecords, ErrorCode.WRN_RecordNamedDisallowed)
507|| reportIfContextual(SyntaxKind.RequiredKeyword, MessageID.IDS_FeatureRequiredMembers, ErrorCode.ERR_RequiredNameDisallowed)
508|| reportIfContextual(SyntaxKind.FileKeyword, MessageID.IDS_FeatureFileTypes, ErrorCode.ERR_FileTypeNameDisallowed)
509|| reportIfContextual(SyntaxKind.ScopedKeyword, MessageID.IDS_FeatureRefFields, ErrorCode.ERR_ScopedTypeNameDisallowed)
510|| reportIfContextual(SyntaxKind.ExtensionKeyword, MessageID.IDS_FeatureExtensions, ErrorCode.ERR_ExtensionTypeNameDisallowed))
516diagnostics.Add(ErrorCode.WRN_LowerCaseTypeName, location, name);
519bool reportIfContextual(SyntaxKind contextualKind, MessageID featureId, ErrorCode error)
1353diagnostics.Add(ErrorCode.ERR_PartialTypeKindConflict, t.GetFirstLocation(), t);
1357diagnostics.Add(ErrorCode.ERR_DuplicateNameInClass, t.GetFirstLocation(), this, t.Name);
1397diagnostics.Add(ErrorCode.ERR_MemberNameSameAsType, member.GetFirstLocation(), this.Name);
1904diagnostics.Add(ErrorCode.ERR_FilePathCannotBeConvertedToUtf8, location, this, errorMessage);
1909diagnostics.Add(ErrorCode.ERR_FileTypeNested, location, this);
1963diagnostics.Add(ErrorCode.ERR_CloneDisallowedInRecord, member.GetFirstLocation());
2077diagnostics.Add(ErrorCode.ERR_DuplicateNameInClass, symbol.GetFirstLocation(), containerForDiagnostics, symbol.Name);
2104diagnostics.Add(ErrorCode.ERR_DuplicateConversionInClass, conversion.GetFirstLocation(), containerForDiagnostics);
2186(d.Code is (int)ErrorCode.ERR_OverloadRefKind or (int)ErrorCode.ERR_MemberAlreadyExists or
2187(int)ErrorCode.ERR_DuplicateNameInClass or (int)ErrorCode.ERR_MemberReserved) &&
2206diagnostics.Add(ErrorCode.ERR_OverloadRefKind, method1.GetFirstLocation(), containerForDiagnostics, methodKind.Localize(), refKind1.ToParameterDisplayString(), refKind2.ToParameterDisplayString());
2223diagnostics.Add(ErrorCode.ERR_MemberAlreadyExists, method1.GetFirstLocation(), methodName, containerForDiagnostics);
2282diagnostics.Add(ErrorCode.ERR_DuplicateNameInClass, indexer.GetFirstLocation(), containerForDiagnostics, indexerName);
2315diagnostics.Add(ErrorCode.ERR_InconsistentIndexerNames, indexer.GetFirstLocation());
2328diagnostics.Add(ErrorCode.ERR_DuplicateNameInClass, indexer.GetFirstLocation(), containerForDiagnostics, indexerName);
2337diagnostics.Add(ErrorCode.ERR_MemberAlreadyExists, indexer.GetFirstLocation(), SyntaxFacts.GetText(SyntaxKind.ThisKeyword), containerForDiagnostics);
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (59)
105diagnostics.Add(ErrorCode.ERR_UnimplementedAbstractMethod, this.GetFirstLocation(), this, abstractMember);
168Diagnostic diag = new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_DuplicateExplicitImpl, interfaceMember), this.GetFirstLocation());
188ErrorCode.ERR_InterfaceImplementedImplicitlyByVariadic,
229var info = new CSDiagnosticInfo(ErrorCode.ERR_MixingWinRTEventWithRegular, args, ImmutableArray<Symbol>.Empty, ImmutableArray.Create<Location>(this.GetFirstLocation()));
294diagnostics.Add(ErrorCode.ERR_UnimplementedInterfaceMember, GetImplementsLocationOrFallback(@interface), this, interfaceMember);
304diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInInterfaceImplementedByBase, GetImplementsLocationOrFallback(@interface), this, interfaceMember);
566diagnostics.Add(ErrorCode.ERR_CantOverrideSealed, method.GetFirstLocation(), method, overridden);
717diagnostics.Add(ErrorCode.WRN_NewRequired, symbolLocation, symbol, hiddenMember);
725diagnostics.Add(ErrorCode.ERR_RequiredMemberCannotBeHidden, symbolLocation, hiddenMember, symbol);
737diagnostics.Add(ErrorCode.WRN_NewNotRequired, symbolLocation, symbol);
770ErrorCode errorCode =
771overridingMemberIsMethod ? ErrorCode.ERR_CantOverrideNonFunction :
772overridingMemberIsProperty ? ErrorCode.ERR_CantOverrideNonProperty :
773ErrorCode.ERR_CantOverrideNonEvent;
806diagnostics.Add(ErrorCode.ERR_OverrideNotExpected, overridingMemberLocation, overridingMember);
820diagnostics.Add(ErrorCode.ERR_NoGetToOverride, overridingMemberLocation, overridingMember, overriddenProperty);
824diagnostics.Add(ErrorCode.ERR_NoSetToOverride, overridingMemberLocation, overridingMember, overriddenProperty);
828diagnostics.Add(ErrorCode.ERR_OverrideNotExpected, overridingMemberLocation, overridingMember);
838diagnostics.Add(ErrorCode.ERR_AmbigOverride, overridingMemberLocation,
861diagnostics.Add(ErrorCode.WRN_MultipleRuntimeOverrideMatches, ambiguousMethod.GetFirstLocation(), ambiguousMethod, overridingMember);
888diagnostics.Add(ErrorCode.ERR_CantOverrideBogusMethod, overridingMemberLocation, overridingMember, overriddenMember);
895diagnostics.Add(ErrorCode.ERR_CantOverrideNonVirtual, overridingMemberLocation, overridingMember, overriddenMember);
901diagnostics.Add(ErrorCode.ERR_CantOverrideSealed, overridingMemberLocation, overridingMember, overriddenMember);
907diagnostics.Add(ErrorCode.ERR_CantChangeAccessOnOverride, overridingMemberLocation, overridingMember, accessibility, overriddenMember);
914diagnostics.Add(ErrorCode.ERR_CantChangeTupleNamesOnOverride, overridingMemberLocation, overridingMember, overriddenMember);
919diagnostics.Add(ErrorCode.ERR_OverrideMustHaveRequired, overridingMemberLocation, overridingMember, overriddenMember);
938ErrorCode code = overridingMemberIsObsolete
939? ErrorCode.WRN_ObsoleteOverridingNonObsolete
940: ErrorCode.WRN_NonObsoleteOverridingObsolete;
963diagnostics.Add(ErrorCode.ERR_CantChangeTypeOnOverride, overridingMemberLocation, overridingMember, overriddenMember, overriddenMemberType.Type);
971(diagnostics, overriddenEvent, overridingEvent, location) => diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInTypeOnOverride, location),
990diagnostics.Add(ErrorCode.ERR_CantChangeRefReturnOnOverride, overridingMemberLocation, overridingMember, overriddenMember);
1003diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportCovariantReturnsOfClasses, overridingMemberLocation, overridingMember, overriddenMember, overriddenMethod.ReturnType);
1017diagnostics.Add(ErrorCode.ERR_CantChangeReturnTypeOnOverride, overridingMemberLocation, overridingMember, overriddenMember, overriddenMethod.ReturnType);
1023diagnostics.Add(ErrorCode.ERR_OverrideFinalizeDeprecated, overridingMemberLocation);
1056diagnostics.Add(ErrorCode.ERR_CantChangeRefReturnOnOverride, overridingMemberLocation, overridingProperty, overriddenProperty);
1073diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportCovariantPropertiesOfClasses, overridingMemberLocation, overridingMember, overriddenMember, overriddenMemberType.Type);
1085diagnostics.Add(ErrorCode.ERR_CantChangeTypeOnOverride, overridingMemberLocation, overridingMember, overriddenMember, overriddenMemberType.Type);
1118diagnostics.Add(ErrorCode.ERR_CantChangeInitOnlyOnOverride, overridingMemberLocation, overridingProperty, overriddenProperty);
1133diagnostics.Add(ErrorCode.ERR_NoGetToOverride, overridingMemberLocation, overridingProperty, overriddenProperty);
1139diagnostics.Add(ErrorCode.ERR_NoSetToOverride, overridingMemberLocation, overridingProperty, overriddenProperty);
1163ErrorCode.ERR_ScopedMismatchInParameterOfOverrideOrImplementation :
1164ErrorCode.WRN_ScopedMismatchInParameterOfOverrideOrImplementation,
1184diagnostics.Add(ErrorCode.WRN_OverridingDifferentRefness, location, overridingParameter, overriddenParameter);
1220ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnOverride :
1221ErrorCode.WRN_NullabilityMismatchInReturnTypeOnOverride,
1227topLevel ? ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnOverride : ErrorCode.WRN_NullabilityMismatchInParameterTypeOnOverride,
1254diagnostics.Add(ErrorCode.WRN_DoesNotReturnMismatch, overrideMethod.GetFirstLocation(), new FormattedSymbol(overrideMethod, SymbolDisplayFormat.MinimallyQualifiedFormat));
1583diagnostics.Add(ErrorCode.WRN_NewNotRequired, hidingMemberLocation, hidingMember);
1604diagnostics.Add(ErrorCode.WRN_NewOrOverrideExpected, hidingMemberLocation, hidingMember, hiddenMember);
1611diagnostics.Add(ErrorCode.ERR_RequiredMemberCannotBeHidden, hidingMemberLocation, hiddenMember, hidingMember);
1624diagnostics.Add(ErrorCode.WRN_NewRequired, hidingMemberLocation, hidingMember, hiddenMembers[0]);
1635diagnostics.Add(ErrorCode.WRN_HidingDifferentRefness, location, hidingParameter, hiddenParameter);
1691diagnostics.Add(ErrorCode.ERR_HidingAbstractMethod, associatedPropertyOrEvent.GetFirstLocation(), associatedPropertyOrEvent, hiddenMember);
1706diagnostics.Add(ErrorCode.ERR_HidingAbstractMethod, hidingMemberLocation, hidingMember, hiddenMember);
1785diagnostics.Add(ErrorCode.ERR_UnifyingInterfaceInstantiations, this.GetFirstLocation(), this, interface1, interface2);
1810if (diagnostic.Severity == DiagnosticSeverity.Error && diagnostic.Code is not ((int)ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember or (int)ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember))
Symbols\Source\SourceMemberFieldSymbol.cs (26)
51diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, this.ErrorLocation, type, ContainingType);
56diagnostics.Add(ErrorCode.ERR_VarDeclIsStaticClass, this.ErrorLocation, type);
60diagnostics.Add(ErrorCode.ERR_FieldCantHaveVoidType, getTypeErrorLocation());
64diagnostics.Add(ErrorCode.ERR_FieldCantBeRefAny, getTypeErrorLocation(), type);
68diagnostics.Add(ErrorCode.ERR_FieldAutoPropCantBeByRefLike, getTypeErrorLocation(), type);
73diagnostics.Add(ErrorCode.ERR_BadFieldTypeInRecord, getTypeErrorLocation(), type);
88diagnostics.Add(ErrorCode.ERR_BadConstType, constToken.GetLocation(), type);
93diagnostics.Add(ErrorCode.ERR_VolatileStruct, this.ErrorLocation, this, type);
100diagnostics.Add(ErrorCode.ERR_BadVisFieldType, this.ErrorLocation, this, type);
200diagnostics.Add(ErrorCode.ERR_AbstractField, errorLocation);
227diagnostics.Add(ErrorCode.ERR_StaticConstant, errorLocation, firstIdentifier.ValueText);
246diagnostics.Add(ErrorCode.ERR_BadMemberFlag, errorLocation, SyntaxFacts.GetText(SyntaxKind.RequiredKeyword));
272diagnostics.Add(ErrorCode.ERR_BadMemberFlag, errorLocation, ModifierUtils.ConvertSingleModifierToSyntaxText(modifier));
377diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation, ErrorLocation);
382diagnostics.Add(ErrorCode.ERR_InterfacesCantContainFields, ErrorLocation);
466diagnostics.Add(ErrorCode.ERR_BadMemberFlag, ErrorLocation, SyntaxFacts.GetText(SyntaxKind.ScopedKeyword));
505diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportRefFields, ErrorLocation);
508diagnostics.Add(ErrorCode.ERR_RefFieldInNonRefStruct, ErrorLocation);
511diagnostics.Add(ErrorCode.ERR_RefFieldCannotReferToRefStruct, typeSyntax.SkipScoped(out _).Location);
525diagnosticsForFirstDeclarator.Add(ErrorCode.ERR_ImplicitlyTypedVariableCannotBeConst, typeSyntax.Location);
530diagnostics.Add(ErrorCode.ERR_RecursivelyTypedVariable, this.ErrorLocation, this);
535diagnosticsForFirstDeclarator.Add(ErrorCode.ERR_ImplicitlyTypedVariableMultipleDeclarator, typeSyntax.Location);
575diagnostics.Add(ErrorCode.ERR_FixedNotInStruct, ErrorLocation);
580diagnostics.Add(ErrorCode.ERR_FixedFieldMustNotBeRef, ErrorLocation);
588diagnostics.Add(ErrorCode.ERR_IllegalFixedType, loc);
593diagnosticsForFirstDeclarator.Add(ErrorCode.ERR_UnsafeNeeded, declarator.Location);
Symbols\Source\SourceMemberMethodSymbol.cs (11)
357ErrorCode code = (this.MethodKind == MethodKind.Conversion || this.MethodKind == MethodKind.UserDefinedOperator) ?
358ErrorCode.ERR_BadVisOpReturn :
359ErrorCode.ERR_BadVisReturnType;
369ErrorCode.ERR_BadVisOpParam :
370ErrorCode.ERR_BadVisParamType;
409diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, GetFirstLocation(), returnType.Type, containingType);
416diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, GetFirstLocation(), param.Type, containingType);
1044diagnostics.Add(ErrorCode.ERR_ExternHasBody, location, this);
1048diagnostics.Add(ErrorCode.ERR_AbstractHasBody, location, this);
1066diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation, location);
1071diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, location);
Symbols\Source\SourceMethodSymbol.cs (4)
39diagnostics.Add(ErrorCode.ERR_UnexpectedToken, refKeyword.GetLocation(), refKeyword.ToString());
73diagnostics.Add(ErrorCode.ERR_BadAsyncArgType, getLocation(parameter, location, isExtensionParameter));
78diagnostics.Add(ErrorCode.ERR_UnsafeAsyncArgType, getLocation(parameter, location, isExtensionParameter));
82diagnostics.Add(ErrorCode.ERR_BadSpecialByRefParameter, getLocation(parameter, location, isExtensionParameter), parameter.Type);
Symbols\Source\SourceMethodSymbolWithAttributes.cs (65)
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);
648? ErrorCode.ERR_CannotApplyOverloadResolutionPriorityToOverride
650: ErrorCode.ERR_CannotApplyOverloadResolutionPriorityToMember,
700diagnostics.Add(ErrorCode.ERR_AttributeNotOnEventAccessor, arguments.AttributeSyntaxOpt.Name.Location, description.FullName, attributeUsage.GetValidTargetsErrorArgument());
722diagnostics.Add(ErrorCode.ERR_AttributeNotOnAccessor, node.Name.Location, node.GetErrorDisplayName(), attributeUsage.GetValidTargetsErrorArgument());
727diagnostics.Add(ErrorCode.ERR_ConditionalOnInterfaceMethod, node.Location);
732diagnostics.Add(ErrorCode.ERR_ConditionalOnOverride, node.Location, this);
737diagnostics.Add(ErrorCode.ERR_ConditionalOnSpecialMethod, node.Location, this);
742diagnostics.Add(ErrorCode.ERR_ConditionalMustReturnVoid, node.Location, this);
747diagnostics.Add(ErrorCode.ERR_ConditionalWithOutParam, node.Location, this);
751diagnostics.Add(ErrorCode.ERR_ConditionalOnLocalFunction, node.Location, this);
760diagnostics.Add(ErrorCode.ERR_BadArgumentToAttribute, attribute.GetAttributeArgumentLocation(0), node.GetErrorDisplayName());
829diagnostics.Add(ErrorCode.ERR_DllImportOnInvalidMethod, arguments.AttributeSyntaxOpt.Name.Location);
845diagnostics.Add(ErrorCode.ERR_DllImportOnGenericMethod, arguments.AttributeSyntaxOpt.Name.Location);
853diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attribute.GetAttributeArgumentLocation(0), arguments.AttributeSyntaxOpt.GetErrorDisplayName());
882diagnostics.Add(ErrorCode.ERR_InvalidNamedArgument, arguments.AttributeSyntaxOpt.ArgumentList.Arguments[position].Location, namedArg.Key);
949diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeOrdinary, arguments.AttributeSyntaxOpt.Location);
959diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeAccessibleOutsideTopLevelType, arguments.AttributeSyntaxOpt.Location, Name);
967diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeStaticParameterlessVoid, arguments.AttributeSyntaxOpt.Location, Name);
973diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodAndContainingTypesMustNotBeGeneric, arguments.AttributeSyntaxOpt.Location, Name);
981diagnostics.Add(ErrorCode.ERR_ModuleInitializerCannotBeUnmanagedCallersOnly, arguments.AttributeSyntaxOpt.Location);
1018diagnostics.Add(ErrorCode.ERR_InterceptsLocationUnsupportedVersion, attributeLocation, version);
1024diagnostics.Add(ErrorCode.ERR_InterceptsLocationDataInvalidFormat, attributeLocation);
1041diagnostics.Add(ErrorCode.ERR_InterceptorContainingTypeCannotBeGeneric, attributeLocation, this);
1047diagnostics.Add(ErrorCode.ERR_InterceptorMethodMustBeOrdinary, attributeLocation);
1055diagnostics.Add(ErrorCode.ERR_InterceptorCannotUseUnmanagedCallersOnly, attributeLocation);
1062diagnostics.Add(ErrorCode.ERR_InterceptsLocationDuplicateFile, attributeLocation, displayFileName);
1068diagnostics.Add(ErrorCode.ERR_InterceptsLocationFileNotFound, attributeLocation, displayFileName);
1078diagnostics.Add(ErrorCode.ERR_InterceptsLocationDataInvalidPosition, attributeLocation, displayFileName);
1098diagnostics.Add(ErrorCode.ERR_InterceptorNameNotInvoked, attributeLocation, referencedToken.Text);
1101diagnostics.Add(ErrorCode.ERR_InterceptorPositionBadToken, attributeLocation, referencedToken.Text);
1107diagnostics.Add(ErrorCode.ERR_InterceptsLocationDataInvalidPosition, attributeLocation, displayFileName);
1153diagnostics.Add(ErrorCode.ERR_InterceptorGlobalNamespace, attributeLocation);
1158diagnostics.Add(ErrorCode.ERR_InterceptorsFeatureNotEnabled, attributeLocation, recommendedProperty);
1173diagnostics.Add(ErrorCode.WRN_InterceptsLocationAttributeUnsupportedSignature, attributeLocation);
1193diagnostics.Add(ErrorCode.ERR_InterceptorFilePathCannotBeNull, attributeData.GetAttributeArgumentLocation(filePathParameterIndex));
1199diagnostics.Add(ErrorCode.ERR_InterceptorContainingTypeCannotBeGeneric, attributeLocation, this);
1205diagnostics.Add(ErrorCode.ERR_InterceptorMethodMustBeOrdinary, attributeLocation);
1213diagnostics.Add(ErrorCode.ERR_InterceptorCannotUseUnmanagedCallersOnly, attributeLocation);
1221diagnostics.Add(ErrorCode.ERR_InterceptorNonUniquePath, attributeData.GetAttributeArgumentLocation(filePathParameterIndex), normalizedPath);
1232diagnostics.Add(ErrorCode.ERR_InterceptorNonUniquePath, attributeData.GetAttributeArgumentLocation(filePathParameterIndex), attributeFilePath);
1254ErrorCode.ERR_InterceptorPathNotInCompilationWithCandidate,
1261diagnostics.Add(ErrorCode.ERR_InterceptorPathNotInCompilation, attributeData.GetAttributeArgumentLocation(filePathParameterIndex), normalizedPath);
1275diagnostics.Add(ErrorCode.ERR_InterceptorLineCharacterMustBePositive, location);
1284diagnostics.Add(ErrorCode.ERR_InterceptorLineOutOfRange, attributeData.GetAttributeArgumentLocation(lineNumberParameterIndex), referencedLineCount, lineNumberOneBased);
1292diagnostics.Add(ErrorCode.ERR_InterceptorCharacterOutOfRange, attributeData.GetAttributeArgumentLocation(characterNumberParameterIndex), lineLength, characterNumberOneBased);
1309diagnostics.Add(ErrorCode.ERR_InterceptorNameNotInvoked, attributeLocation, referencedToken.Text);
1312diagnostics.Add(ErrorCode.ERR_InterceptorPositionBadToken, attributeLocation, referencedToken.Text);
1321diagnostics.Add(ErrorCode.ERR_InterceptorMustReferToStartOfTokenPosition, attributeLocation, referencedToken.Text, linePositionZeroBased.Line + 1, linePositionZeroBased.Character + 1);
1367diagnostics.Add(ErrorCode.ERR_InterceptorGlobalNamespace, attributeSyntax);
1372diagnostics.Add(ErrorCode.ERR_InterceptorsFeatureNotEnabled, attributeSyntax, recommendedProperty);
1409diagnostics.Add(ErrorCode.ERR_CannotUseRefInUnmanagedCallersOnly, syntax.Location);
1425diagnostics.Add(ErrorCode.ERR_CannotUseManagedTypeInUnmanagedCallersOnly, syntax.Location, type, (isParam ? MessageID.IDS_Parameter : MessageID.IDS_Return).Localize());
1484diagnostics.Add(ErrorCode.ERR_ComImportWithUserCtor, this.GetFirstLocation());
1493diagnostics.Add(ErrorCode.ERR_ComImportWithImpl, this.GetFirstLocation(), this, ContainingType);
1507var errorCode = (this.MethodKind == MethodKind.Constructor || this.MethodKind == MethodKind.StaticConstructor) ?
1508ErrorCode.WRN_ExternCtorNoImplementation :
1509ErrorCode.WRN_ExternMethodNoImplementation;
1545diagnostics.Add(ErrorCode.ERR_BadAsyncReturn, errorLocation);
1565diagnostics.Add(ErrorCode.ERR_SecurityCriticalOrSecuritySafeCriticalOnAsyncInClassOrStruct, errorLocation);
1574diagnostics.Add(ErrorCode.ERR_SynchronizedAsyncMethod, errorLocation);
1594diagnostics.Add(ErrorCode.WRN_UndecoratedCancellationTokenParameter, errorLocation, this);
1600diagnostics.Add(ErrorCode.ERR_MultipleEnumeratorCancellationAttributes, errorLocation);
Symbols\Source\SourceNamedTypeSymbol.cs (34)
192diagnostics.Add(ErrorCode.ERR_IllegalVarianceSyntax, tp.VarianceKeyword.GetLocation());
215diagnostics.Add(ErrorCode.ERR_DuplicateTypeParameter, location, name);
226diagnostics.Add(ErrorCode.WRN_TypeParameterSameAsOuterTypeParameter, location, name, tpEnclosing.ContainingType);
242ErrorCode.ERR_PartialWrongTypeParamsVariance,
250ErrorCode.ERR_PartialWrongTypeParams,
529diagnostics.Add(ErrorCode.ERR_PartialWrongConstraints, GetFirstLocation(), this, typeParameters[i]);
1159diagnostics.Add(ErrorCode.ERR_CantUseRequiredAttribute, arguments.AttributeSyntaxOpt.Name.Location);
1189diagnostics.Add(ErrorCode.ERR_CollectionBuilderAttributeInvalidType, arguments.AttributeSyntaxOpt.Name.Location);
1199diagnostics.Add(ErrorCode.ERR_CollectionBuilderAttributeInvalidMethodName, arguments.AttributeSyntaxOpt.Name.Location);
1212diagnostics.Add(ErrorCode.ERR_InvalidInlineArrayLength, attribute.GetAttributeArgumentLocation(0));
1217diagnostics.Add(ErrorCode.ERR_AttributeOnBadSymbolType, arguments.AttributeSyntaxOpt.Name.Location, arguments.AttributeSyntaxOpt.GetErrorDisplayName(), "struct");
1221diagnostics.Add(ErrorCode.ERR_InlineArrayAttributeOnRecord, arguments.AttributeSyntaxOpt.Name.Location);
1311diagnosticsOpt.Add(ErrorCode.ERR_AttributeUsageOnNonAttributeClass, node.Name.Location, node.GetErrorDisplayName());
1326diagnosticsOpt.Add(ErrorCode.ERR_InvalidAttributeArgument, attribute.GetAttributeArgumentLocation(0), node.GetErrorDisplayName());
1397diagnostics.Add(ErrorCode.ERR_ConditionalOnNonAttributeClass, node.Location, node.GetErrorDisplayName());
1406diagnostics.Add(ErrorCode.ERR_BadArgumentToAttribute, attribute.GetAttributeArgumentLocation(0), node.GetErrorDisplayName());
1601diagnostics.Add(ErrorCode.ERR_ComImportWithoutUuidAttribute, allAttributeSyntaxNodes[index].Name.Location);
1610diagnostics.Add(ErrorCode.ERR_ComImportWithBase, this.GetFirstLocation(), this.Name);
1623diagnostics.Add(ErrorCode.ERR_ComImportWithInitializers, singleInitializer.Syntax.GetLocation(), this.Name);
1637diagnostics.Add(ErrorCode.ERR_ComImportWithInitializers, singleInitializer.Syntax.GetLocation(), this.Name);
1649diagnostics.Add(ErrorCode.WRN_CoClassWithoutComImport, allAttributeSyntaxNodes[index].Location, this.Name);
1658diagnostics.Add(ErrorCode.ERR_DefaultMemberOnIndexedType, allAttributeSyntaxNodes[index].Name.Location);
1857diagnostics.Add(ErrorCode.WRN_ObsoleteMembersShouldNotBeRequired, member.GetFirstLocation(), member);
1871diagnostics.Add(ErrorCode.ERR_InvalidInlineArrayLayout, GetFirstLocation());
1880diagnostics.Add(ErrorCode.ERR_InlineArrayUnsupportedElementFieldModifier, elementField.TryGetFirstLocation() ?? GetFirstLocation());
1894diagnostics.Add(ErrorCode.WRN_InlineArrayIndexerNotUsed, indexer.TryGetFirstLocation() ?? GetFirstLocation());
1902diagnostics.Add(ErrorCode.WRN_InlineArraySliceNotUsed, slice.TryGetFirstLocation() ?? GetFirstLocation());
1925diagnostics.Add(ErrorCode.WRN_InlineArrayConversionOperatorNotUsed, conversion.TryGetFirstLocation() ?? GetFirstLocation());
1934diagnostics.Add(ErrorCode.WRN_InlineArrayNotSupportedByLanguage, elementField.TryGetFirstLocation() ?? GetFirstLocation());
1938diagnostics.Add(ErrorCode.WRN_InlineArrayNotSupportedByLanguage, GetFirstLocation());
1944diagnostics.Add(ErrorCode.ERR_InvalidInlineArrayFields, GetFirstLocation());
1949diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportInlineArrayTypes, GetFirstLocation());
1976diagnostics.Add(ErrorCode.ERR_EmbeddedAttributeMustFollowPattern, GetFirstLocation());
1987diagnostics.Add(ErrorCode.ERR_BadExtensionContainingType, syntax.Keyword);
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (28)
132diagnostics.Add(ErrorCode.ERR_BadRecordBase, baseLocation);
137diagnostics.Add(ErrorCode.ERR_BadInheritanceFromRecord, baseLocation);
193diagnostics.Add(ErrorCode.WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList, location, @interface, this);
198diagnostics.Add(ErrorCode.ERR_DuplicateInterfaceWithTupleNamesInBaseList, location, @interface, other, this);
202diagnostics.Add(ErrorCode.ERR_DuplicateInterfaceWithDifferencesInBaseList, location, @interface, other, this);
341var info = diagnostics.Add(ErrorCode.ERR_PartialMultipleBases, GetFirstLocation(), this);
386diagnostics.Add(ErrorCode.ERR_StaticBaseClass, baseTypeLocation, baseType, this);
392diagnostics.Add(ErrorCode.ERR_BadVisBaseClass, baseTypeLocation, this, baseType);
397diagnostics.Add(ErrorCode.ERR_FileTypeBase, baseTypeLocation, baseType, this);
409diagnostics.Add(ErrorCode.ERR_BadVisBaseInterface, interfaceLocations[i], this, i);
414diagnostics.Add(ErrorCode.ERR_FileTypeBase, interfaceLocations[i], i, this);
462diagnostics.Add(ErrorCode.ERR_BadBaseType, typeSyntax.GetLocation());
490diagnostics.Add(ErrorCode.ERR_DeriveFromEnumOrValueType, location, this, baseType);
497diagnostics.Add(ErrorCode.ERR_CantDeriveFromSealedType, location, this, baseType);
531var info = diagnostics.Add(ErrorCode.ERR_StaticDerivedFromNonObject, location, this, localBase);
555diagnostics.Add(ErrorCode.ERR_DuplicateInterfaceInBaseList, location, baseType);
560diagnostics.Add(ErrorCode.WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList, location, baseType, this);
567diagnostics.Add(ErrorCode.ERR_StaticClassInterfaceImpl, location, this);
577diagnostics.Add(ErrorCode.ERR_DeriveFromConstructedDynamic, location, this, baseType);
589diagnostics.Add(ErrorCode.ERR_BaseClassMustBeFirst, location, baseType);
594diagnostics.Add(ErrorCode.ERR_NoMultipleInheritance, location, this, localBase, baseType);
601diagnostics.Add(ErrorCode.ERR_DerivingFromATyVar, location, baseType);
610diagnostics.Add(ErrorCode.ERR_DeriveFromDynamic, location, this);
617diagnostics.Add(ErrorCode.ERR_NonInterfaceInInterfaceList, location, baseType);
625diagnostics.Add(ErrorCode.ERR_ObjectCantHaveBases, new SourceLocation(name));
635diagnostics.Add(ErrorCode.ERR_UnexpectedArgumentList, primaryConstructorBaseType.ArgumentList.Location);
679diagnostics.Add(ErrorCode.ERR_CycleInInterfaceInheritance, GetFirstLocation(), this, t)));
761diagnostics.Add(ErrorCode.ERR_CircularBase, GetFirstLocation(), declaredBase, this));
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (20)
301diagnostics.Add(ErrorCode.ERR_DuplicateAlias, pair.Value.Alias.GetFirstLocation(), pair.Key);
334diagnostics.Add(ErrorCode.HDN_DuplicateWithGlobalUsing, namespaceOrType.UsingDirective!.NamespaceOrType.Location, namespaceOrType.NamespaceOrType);
370diagnostics.Add(ErrorCode.ERR_DuplicateAlias, externAlias.Alias.GetFirstLocation(), externAlias.Alias.Name);
482diagnostics.Add(ErrorCode.ERR_ExternAliasNotAllowed, aliasSyntax.Location);
492diagnostics.Add(ErrorCode.ERR_DuplicateAlias, existingAlias.Alias.GetFirstLocation(), existingAlias.Alias.Name);
499diagnostics.Add(ErrorCode.ERR_GlobalExternAlias, aliasSyntax.Identifier.GetLocation());
667diagnostics.Add(ErrorCode.WRN_GlobalAliasDefn, location);
672diagnostics.Add(ErrorCode.ERR_NoAliasHere, location);
688diagnostics.Add(ErrorCode.ERR_DuplicateAlias, location, identifierValueText);
699diagnostics.Add(ErrorCode.ERR_DuplicateAlias, usingDirective.Location, identifierValueText);
741diagnostics.Add(ErrorCode.ERR_BadUnsafeInUsingDirective, unsafeKeywordLocation);
775diagnostics.Add(ErrorCode.ERR_BadUsingType, usingDirective.NamespaceOrType.Location, imported);
780ErrorCode.HDN_DuplicateWithGlobalUsing :
781ErrorCode.WRN_DuplicateUsing,
793diagnostics.Add(ErrorCode.ERR_BadUsingNamespace, usingDirective.NamespaceOrType.Location, imported);
800diagnostics.Add(ErrorCode.ERR_GlobalUsingStaticFileType, usingDirective.NamespaceOrType.Location, imported);
806ErrorCode.HDN_DuplicateWithGlobalUsing :
807ErrorCode.WRN_DuplicateUsing,
820diagnostics.Add(ErrorCode.ERR_BadUsingStaticType, usingDirective.NamespaceOrType.Location, imported.GetKindText());
832diagnostics.Add(ErrorCode.ERR_BadSKknown, usingDirective.NamespaceOrType.Location,
Symbols\Source\SourceOrdinaryMethodSymbol.cs (54)
149diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, syntax.ReturnType.Location, returnType.Type);
217diagnostics.Add(ErrorCode.ERR_BadTypeforThis, loc, parameter0Type.Type);
221diagnostics.Add(ErrorCode.ERR_RefExtensionMustBeValueTypeOrConstrainedToOne, _location, Name);
225diagnostics.Add(ErrorCode.ERR_InExtensionMustBeValueType, _location, Name);
229diagnostics.Add(ErrorCode.ERR_ExtensionMethodsDecl, _location, ContainingType.Name);
238diagnostics.Add(ErrorCode.ERR_BadExtensionAgg, loc);
242diagnostics.Add(ErrorCode.ERR_BadExtensionMeth, _location);
261ErrorCode.ERR_ExtensionAttrNotFound,
487diagnostics.Add(ErrorCode.ERR_PartialMethodReturnTypeDifference, implementation.GetFirstLocation());
492diagnostics.Add(ErrorCode.ERR_PartialMemberInconsistentTupleNames, implementation.GetFirstLocation(), definition, implementation);
497diagnostics.Add(ErrorCode.ERR_PartialMemberRefReturnDifference, implementation.GetFirstLocation());
502diagnostics.Add(ErrorCode.ERR_PartialMemberStaticDifference, implementation.GetFirstLocation());
507diagnostics.Add(ErrorCode.ERR_PartialMemberReadOnlyDifference, implementation.GetFirstLocation());
512diagnostics.Add(ErrorCode.ERR_PartialMethodExtensionDifference, implementation.GetFirstLocation());
517diagnostics.Add(ErrorCode.ERR_PartialMemberUnsafeDifference, implementation.GetFirstLocation());
522diagnostics.Add(ErrorCode.ERR_PartialMemberParamsDifference, implementation.GetFirstLocation());
528diagnostics.Add(ErrorCode.ERR_PartialMemberAccessibilityDifference, implementation.GetFirstLocation());
536diagnostics.Add(ErrorCode.ERR_PartialMemberExtendedModDifference, implementation.GetFirstLocation());
547diagnostics.Add(ErrorCode.ERR_ScopedMismatchInParameterOfPartial, implementingMethod.GetFirstLocation(), new FormattedSymbol(implementingParameter, SymbolDisplayFormat.ShortFormat));
564diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnPartial, implementingMethod.GetFirstLocation());
568diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial, implementingMethod.GetFirstLocation(), new FormattedSymbol(implementingParameter, SymbolDisplayFormat.ShortFormat));
578diagnostics.Add(ErrorCode.WRN_PartialMethodTypeDifference, implementation.GetFirstLocation(),
616diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentConstraints, implementation.GetFirstLocation(), implementation, typeParameter2.Name);
620diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation, implementation.GetFirstLocation(), implementation, typeParameter2.Name);
651ErrorCode report;
658report = ErrorCode.ERR_OverrideRefConstraintNotSatisfied;
665report = ErrorCode.ERR_OverrideValConstraintNotSatisfied;
672report = ErrorCode.ERR_OverrideDefaultConstraintNotSatisfied;
834diagnostics.Add(ErrorCode.ERR_PartialMemberCannotBeAbstract, location);
838diagnostics.Add(ErrorCode.ERR_PartialMethodWithNonVoidReturnMustHaveAccessMods, location, this);
842diagnostics.Add(ErrorCode.ERR_PartialMethodWithExtendedModMustHaveAccessMods, location, this);
846diagnostics.Add(ErrorCode.ERR_PartialMethodWithOutParamMustHaveAccessMods, location, this);
850diagnostics.Add(ErrorCode.ERR_VirtualPrivate, location, this);
855diagnostics.Add(ErrorCode.ERR_OverrideNotNew, location, this);
860diagnostics.Add(ErrorCode.ERR_SealedNonOverride, location, this);
865diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.SealedKeyword));
874diagnostics.Add(ErrorCode.ERR_AbstractAndExtern, location, this);
878diagnostics.Add(ErrorCode.ERR_AbstractAndSealed, location, this);
882diagnostics.Add(ErrorCode.ERR_AbstractNotVirtual, location, this.Kind.Localize(), this);
887diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword));
892diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword));
897diagnostics.Add(ErrorCode.ERR_StaticMemberCantBeReadOnly, location, this);
902diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType);
907diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType);
911diagnostics.Add(ErrorCode.ERR_BadAsyncLacksBody, location);
915diagnostics.Add(ErrorCode.ERR_ConcreteMissingBody, location, this);
923diagnostics.Add(ErrorCode.ERR_InstanceMemberWithUnnamedExtensionsParameter, location, Name);
927diagnostics.Add(ErrorCode.ERR_InstanceMemberInStaticClass, location, Name);
931diagnostics.Add(ErrorCode.ERR_BadVarargs, location);
935diagnostics.Add(ErrorCode.ERR_VarargsAsync, location);
1149diagnostics.Add(ErrorCode.ERR_IllegalVarianceSyntax, parameter.VarianceKeyword.GetLocation());
1165diagnostics.Add(ErrorCode.ERR_TypeParameterSameNameAsExtensionTypeParameter, location, name);
1171diagnostics.Add(ErrorCode.WRN_TypeParameterSameAsOuterTypeParameter, location, name, tpEnclosing.ContainingType);
1181diagnostics.Add(ErrorCode.ERR_DuplicateTypeParameter, location, name);
Symbols\Source\SourcePropertyAccessorSymbol.cs (12)
532diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType);
537diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType);
541diagnostics.Add(ErrorCode.ERR_ConcreteMissingBody, location, this);
550diagnostics.Add(ErrorCode.ERR_InvalidPropertyReadOnlyMods, location, _property);
555diagnostics.Add(ErrorCode.ERR_StaticMemberCantBeReadOnly, location, this);
559diagnostics.Add(ErrorCode.ERR_InitInExtension, location, _property);
564diagnostics.Add(ErrorCode.ERR_InitCannotBeReadonly, location, _property);
569diagnostics.Add(ErrorCode.ERR_AutoSetterCantBeReadOnly, location, this);
574diagnostics.Add(ErrorCode.ERR_BadInitAccessor, location);
833diagnostics.Add(ErrorCode.ERR_PartialMemberAccessibilityDifference, implementationAccessor.GetFirstLocation());
838diagnostics.Add(ErrorCode.ERR_PartialMemberReadOnlyDifference, implementationAccessor.GetFirstLocation());
844diagnostics.Add(ErrorCode.ERR_PartialPropertyInitMismatch, implementationAccessor.GetFirstLocation(), implementationAccessor, accessorName);
Symbols\Source\SourcePropertySymbol.cs (30)
263diagnostics.Add(ErrorCode.ERR_DuplicateAccessor, accessor.Keyword.GetLocation());
276diagnostics.Add(ErrorCode.ERR_DuplicateAccessor, accessor.Keyword.GetLocation());
281diagnostics.Add(ErrorCode.ERR_GetOrSetExpected, accessor.Keyword.GetLocation());
496diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.RequiredKeyword));
587diagnostics.Add((this.IsIndexer ? ErrorCode.ERR_BadVisIndexerReturn : ErrorCode.ERR_BadVisPropertyType), Location, this, type.Type);
600diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, Location, type.Type, containingType);
610diagnostics.Add(ErrorCode.ERR_IndexerCantHaveVoidType, Location);
614diagnostics.Add(ErrorCode.ERR_PropertyCantHaveVoidType, Location, this);
631diagnostics.Add(ErrorCode.ERR_IndexerNeedsParam, parameterSyntaxOpt.GetLastToken().GetLocation());
644diagnostics.Add(ErrorCode.ERR_IllegalVarArgs, arglistToken.GetLocation());
655diagnostics.Add(ErrorCode.WRN_DefaultValueForUnconsumedLocation, paramNameToken.GetLocation(), paramNameToken.ValueText);
685diagnostics.Add(ErrorCode.ERR_BadVisIndexerParam, Location, this, param.Type);
689diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, Location, param.Type, containingTypeForFileTypeCheck);
693diagnostics.Add(ErrorCode.ERR_DuplicateGeneratedName, param.TryGetFirstLocation() ?? Location, param.Name);
701diagnostics.Add(ErrorCode.ERR_ValueParameterSameNameAsExtensionTypeParameter, setter.GetFirstLocationOrNone());
706diagnostics.Add(ErrorCode.ERR_ValueParameterSameNameAsExtensionParameter, setter.GetFirstLocationOrNone());
713diagnostics.Add(ErrorCode.ERR_BadVisIndexerParam, Location, this, extensionParameter.Type);
740diagnostics.Add(ErrorCode.ERR_PartialMemberTypeDifference, implementation.GetFirstLocation());
745diagnostics.Add(ErrorCode.ERR_PartialMemberInconsistentTupleNames, implementation.GetFirstLocation(), this, implementation);
751diagnostics.Add(ErrorCode.ERR_PartialMemberRefReturnDifference, implementation.GetFirstLocation());
757diagnostics.Add(ErrorCode.WRN_PartialMemberSignatureDifference, implementation.GetFirstLocation(),
764diagnostics.Add(ErrorCode.ERR_PartialPropertyRequiredDifference, implementation.GetFirstLocation());
769diagnostics.Add(ErrorCode.ERR_PartialMemberStaticDifference, implementation.GetFirstLocation());
774diagnostics.Add(ErrorCode.ERR_PartialMemberReadOnlyDifference, implementation.GetFirstLocation());
779diagnostics.Add(ErrorCode.ERR_PartialMemberUnsafeDifference, implementation.GetFirstLocation());
784diagnostics.Add(ErrorCode.ERR_PartialMemberParamsDifference, implementation.GetFirstLocation());
790diagnostics.Add(ErrorCode.ERR_PartialMemberAccessibilityDifference, implementation.GetFirstLocation());
798diagnostics.Add(ErrorCode.ERR_PartialMemberExtendedModDifference, implementation.GetFirstLocation());
810diagnostics.Add(ErrorCode.ERR_ScopedMismatchInParameterOfPartial, implementation.GetFirstLocation(), new FormattedSymbol(implementation.Parameters[i], SymbolDisplayFormat.ShortFormat));
Symbols\Source\SourcePropertySymbolBase.cs (49)
308diagnostics.Add(ErrorCode.ERR_InstancePropertyInitializerInInterface, Location);
312diagnostics.Add(ErrorCode.ERR_InitializerOnNonAutoProperty, Location);
353diagnostics.Add(ErrorCode.WRN_AccessorDoesNotUseBackingField, accessorToBlame.GetFirstLocation(), accessorName, property);
883diagnostics.Add(ErrorCode.ERR_RefReturningPropertiesCannotBeRequired, Location);
892diagnostics.Add(ErrorCode.ERR_AutoPropsInRoStruct, Location);
896diagnostics.Add(ErrorCode.ERR_AutoPropertyWithSetterCantBeReadOnly, Location, this);
906diagnostics.Add(ErrorCode.ERR_AutoPropertyCannotBeRefReturning, Location);
916diagnostics.Add(ErrorCode.ERR_AutoPropertyMustOverrideSet, Location);
928diagnostics.Add(ErrorCode.ERR_InterfacesCantContainFields, Location);
943diagnostics.Add(ErrorCode.ERR_RefPropertyCannotHaveSetAccessor, _setMethod.GetFirstLocation());
949diagnostics.Add(ErrorCode.ERR_DuplicatePropertyAccessMods, Location, this);
953diagnostics.Add(ErrorCode.ERR_DuplicatePropertyReadOnlyMods, Location, this);
966diagnostics.Add(ErrorCode.ERR_PropertyWithNoAccessors, Location, this);
972diagnostics.Add(ErrorCode.ERR_RefPropertyMustHaveGetAccessor, Location);
980diagnostics.Add(ErrorCode.ERR_AutoPropertyMustHaveGetAccessor, _setMethod!.GetFirstLocation());
991diagnostics.Add(ErrorCode.ERR_AccessModMissingAccessor, Location, this);
997diagnostics.Add(ErrorCode.ERR_ReadOnlyModMissingAccessor, Location, this);
1080diagnostics.Add(ErrorCode.ERR_VirtualPrivate, location, this);
1085diagnostics.Add(ErrorCode.ERR_StaticMemberCantBeReadOnly, location, this);
1090diagnostics.Add(ErrorCode.ERR_OverrideNotNew, location, this);
1095diagnostics.Add(ErrorCode.ERR_SealedNonOverride, location, this);
1099diagnostics.Add(ErrorCode.ERR_PartialMemberOnlyInPartialClass, location);
1103diagnostics.Add(ErrorCode.ERR_PartialMemberNotExplicit, location);
1107diagnostics.Add(ErrorCode.ERR_PartialMemberCannotBeAbstract, location);
1112diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword));
1117diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword));
1121diagnostics.Add(ErrorCode.ERR_AbstractAndExtern, location, this);
1125diagnostics.Add(ErrorCode.ERR_AbstractAndSealed, location, this);
1129diagnostics.Add(ErrorCode.ERR_AbstractNotVirtual, location, this.Kind.Localize(), this);
1137diagnostics.Add(ErrorCode.ERR_InstanceMemberWithUnnamedExtensionsParameter, location, Name);
1141ErrorCode errorCode = isIndexer ? ErrorCode.ERR_IndexerInStaticClass : ErrorCode.ERR_InstanceMemberInStaticClass;
1151diagnostics.Add(ErrorCode.ERR_InvalidPropertyAccessMod, accessor.GetFirstLocation(), accessor, this);
1173diagnostics.Add(ErrorCode.ERR_PrivateAbstractAccessor, accessor.GetFirstLocation(), accessor);
1192diagnostics.Add(ErrorCode.ERR_ExplicitPropertyMissingAccessor, this.Location, this, otherAccessor);
1196diagnostics.Add(ErrorCode.ERR_ExplicitPropertyAddingAccessor, thisAccessor.GetFirstLocation(), thisAccessor, explicitlyImplementedProperty);
1201diagnostics.Add(ErrorCode.ERR_ExplicitPropertyMismatchInitOnly, thisAccessor.GetFirstLocation(), thisAccessor, otherAccessor);
1548diagnostics.Add(ErrorCode.ERR_ExplicitDynamicAttr, arguments.AttributeSyntaxOpt.Location);
1592diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.AttributeSyntaxOpt.Location);
1606diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedMemberTarget, arguments.AttributeSyntaxOpt.Location);
1617? ErrorCode.ERR_CannotApplyOverloadResolutionPriorityToOverride
1619: ErrorCode.ERR_CannotApplyOverloadResolutionPriorityToMember,
1716diagnostics.Add(ErrorCode.ERR_BadIndexerNameAttr, node.Name.Location, node.GetErrorDisplayName());
1723diagnostics.Add(ErrorCode.ERR_BadArgumentToAttribute, node.ArgumentList.Arguments[0].Location, node.GetErrorDisplayName());
1729diagnostics.Add(ErrorCode.ERR_InsufficientStack, node.ArgumentList.Arguments[0].Location);
1865diagnostics.Add(ErrorCode.ERR_FieldCantBeRefAny, TypeLocation, type);
1872diagnostics.Add(ErrorCode.ERR_BadFieldTypeInRecord, TypeLocation, type);
1876diagnostics.Add(ErrorCode.ERR_FieldAutoPropCantBeByRefLike, TypeLocation, type);
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (36)
59diagnostics.Add(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, this.GetFirstLocation());
69diagnostics.Add(ErrorCode.ERR_OperatorInStaticClass, location, this);
79diagnostics.Add(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, this.GetFirstLocation(), this);
85diagnostics.Add(ErrorCode.ERR_OperatorsMustBeStatic, this.GetFirstLocation(), this);
94diagnostics.Add(ErrorCode.ERR_AbstractAndExtern, location, this);
98diagnostics.Add(ErrorCode.ERR_AbstractNotVirtual, location, this.Kind.Localize(), this);
105diagnostics.Add(ErrorCode.ERR_ExternHasBody, location, this);
109diagnostics.Add(ErrorCode.ERR_AbstractHasBody, location, this);
117diagnostics.Add(ErrorCode.ERR_ConcreteMissingBody, location, this);
165diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, ModifierUtils.ConvertSingleModifierToSyntaxText(DeclarationModifiers.Sealed));
211diagnostics.Add(ErrorCode.ERR_InvalidModifierForLanguageVersion, location,
246diagnostics.Add(ErrorCode.ERR_IllegalVarArgs, new SourceLocation(arglistToken));
259diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, returnTypeSyntax.Location, returnType.Type);
336diagnostics.Add(ErrorCode.ERR_IllegalRefParam, this.GetFirstLocation());
456diagnostics.Add(ErrorCode.ERR_ConversionWithInterface, this.GetFirstLocation(), this);
470diagnostics.Add(IsAbstract || IsVirtual ? ErrorCode.ERR_AbstractConversionNotInvolvingContainedType : ErrorCode.ERR_ConversionNotInvolvingContainedType, this.GetFirstLocation());
481diagnostics.Add(ErrorCode.ERR_IdentityConversion, this.GetFirstLocation());
549diagnostics.Add(ErrorCode.ERR_BadDynamicConversion, this.GetFirstLocation(), this);
577diagnostics.Add(ErrorCode.ERR_ConversionWithBase, this.GetFirstLocation(), this);
582diagnostics.Add(ErrorCode.ERR_ConversionWithDerived, this.GetFirstLocation(), this);
594diagnostics.Add(ErrorCode.ERR_OperatorCantReturnVoid, this.GetFirstLocation());
606diagnostics.Add((IsAbstract || IsVirtual) ? ErrorCode.ERR_BadAbstractUnaryOperatorSignature : ErrorCode.ERR_BadUnaryOperatorSignature, this.GetFirstLocation());
620diagnostics.Add(ErrorCode.ERR_OpTFRetType, this.GetFirstLocation());
626diagnostics.Add((IsAbstract || IsVirtual) ? ErrorCode.ERR_BadAbstractUnaryOperatorSignature : ErrorCode.ERR_BadUnaryOperatorSignature, this.GetFirstLocation());
676diagnostics.Add((IsAbstract || IsVirtual) ? ErrorCode.ERR_BadAbstractIncDecSignature : ErrorCode.ERR_BadIncDecSignature, this.GetFirstLocation());
685diagnostics.Add((IsAbstract || IsVirtual) ? ErrorCode.ERR_BadAbstractIncDecRetType : ErrorCode.ERR_BadIncDecRetType, this.GetFirstLocation());
725diagnostics.Add((IsAbstract || IsVirtual) ? ErrorCode.ERR_BadAbstractShiftOperatorSignature : ErrorCode.ERR_BadShiftOperatorSignature, this.GetFirstLocation());
744diagnostics.Add((IsAbstract || IsVirtual) ? ErrorCode.ERR_BadAbstractBinaryOperatorSignature : ErrorCode.ERR_BadBinaryOperatorSignature, this.GetFirstLocation());
755diagnostics.Add(ErrorCode.ERR_BadAbstractEqualityOperatorSignature, this.GetFirstLocation(), this.ContainingType);
Symbols\Symbol.cs (15)
1179if (info.Code == (int)ErrorCode.WRN_UnifyReferenceBldRev ||
1180info.Code == (int)ErrorCode.WRN_UnifyReferenceMajMin ||
1181info.Code == (int)ErrorCode.ERR_AssemblyMatchBadVersion)
1201if (info.DiagnosticInfo?.Code == (int)ErrorCode.ERR_BogusType)
1217info = info.AdjustDiagnosticInfo(new CSDiagnosticInfo(ErrorCode.ERR_BindToBogus, this));
1224var useSiteInfo = new UseSiteInfo<AssemblySymbol>(new CSDiagnosticInfo(ErrorCode.ERR_BogusType, string.Empty));
1489ErrorCode.ERR_ConstraintOnlyAllowedOnGenericDecl,
1502diagnostics.Add(ErrorCode.ERR_BlockBodyAndExpressionBody, syntax.GetLocation());
1536diagnostics.Add(ErrorCode.ERR_ExplicitDynamicAttr, arguments.AttributeSyntaxOpt.Location);
1557diagnostics.Add(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, arguments.AttributeSyntaxOpt.Location);
1563diagnostics.Add(ErrorCode.ERR_ExplicitNullableAttribute, arguments.AttributeSyntaxOpt.Location);
1581diagnostics.Add(ErrorCode.ERR_ExplicitExtension, arguments.AttributeSyntaxOpt.Location);
1587diagnostics.Add(ErrorCode.ERR_ExplicitRequiredMember, arguments.AttributeSyntaxOpt.Location);
1593diagnostics.Add(ErrorCode.ERR_ExplicitScopedRef, arguments.AttributeSyntaxOpt.Location);
1610diagnostics.Add(ErrorCode.ERR_ExplicitReservedAttr, arguments.AttributeSyntaxOpt.Location, attributeDescription.FullName);
Symbols\Symbol_Attributes.cs (9)
223arguments.Diagnostics.DiagnosticBag.Add(ErrorCode.ERR_ExplicitReservedAttr, arguments.AttributeSyntaxOpt.Location, AttributeDescription.CompilerFeatureRequiredAttribute.FullName);
230arguments.Diagnostics.DiagnosticBag.Add(ErrorCode.ERR_InvalidExperimentalDiagID, attrArgumentLocation);
698diagnostics.Add(ErrorCode.WRN_NonECMAFeature, targetOpt.GetLocation(), MessageID.IDS_FeatureModuleAttrLoc);
710diagnostics.Add(ErrorCode.WRN_InvalidAttributeLocation,
729diagnostics.Add(ErrorCode.ERR_GlobalAttributesNotAllowed, targetOpt.Identifier.GetLocation());
739diagnostics.Add(ErrorCode.WRN_AttributeLocationOnBadDeclaration,
902diagnostics.Add(ErrorCode.ERR_DuplicateAttribute, node.Name.Location, node.GetErrorDisplayName());
922diagnostics.Add(ErrorCode.ERR_AttributeOnBadSymbolType, node.Name.Location, node.GetErrorDisplayName(), attributeUsageInfo.GetValidTargetsErrorArgument());
937diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidTarget, node.Name.Location, node.GetErrorDisplayName());
Symbols\TypeSymbol.cs (45)
520=> code is (int)ErrorCode.ERR_UnsupportedCompilerFeature or (int)ErrorCode.ERR_BogusType;
527return (object)info != null && info.Code is (int)ErrorCode.ERR_UnsupportedCompilerFeature or (int)ErrorCode.ERR_BogusType;
866diagnostics.Add(ErrorCode.ERR_DuplicateExplicitImpl, implementingType.GetFirstLocation(), interfaceMember);
1020diagnostics.Add(ErrorCode.ERR_ImplicitImplementationOfInaccessibleInterfaceMember, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), implementingType, interfaceMember, implicitImpl);
1029diagnostics.Add(ErrorCode.ERR_ImplicitImplementationOfNonPublicInterfaceMember, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl),
1081diagnostics.Add(ErrorCode.ERR_MostSpecificImplementationIsNotFound, GetInterfaceLocation(interfaceMember, implementingType),
1107return !symbolAndDiagnostics.Diagnostics.Diagnostics.Any(static d => d.Code == (int)ErrorCode.ERR_MostSpecificImplementationIsNotFound);
1639diagnostics.Add(ErrorCode.ERR_RefStructDoesNotSupportDefaultInterfaceImplementationForMember,
1653diagnostics.Add(ErrorCode.ERR_LanguageVersionDoesNotSupportInterfaceImplementationForMember,
1666ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfacesForMember :
1667ErrorCode.ERR_RuntimeDoesNotSupportDefaultInterfaceImplementationForMember,
1691diagnostics.Add(ErrorCode.ERR_MethodImplementingAccessor, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), implicitImpl, interfaceMethod, implementingType);
1695diagnostics.Add(ErrorCode.ERR_AccessorImplementingMethod, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), implicitImpl, interfaceMethod, implementingType);
1704diagnostics.Add(ErrorCode.ERR_InterfaceImplementedByConditional, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), implicitImpl, interfaceMethod, implementingType);
1708diagnostics.Add(ErrorCode.ERR_InterfaceImplementedByUnmanagedCallersOnlyMethod, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), implicitImpl, interfaceMethod, implementingType);
1720diagnostics.Add(ErrorCode.ERR_ImplBadTupleNames, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, implicitImpl), implicitImpl, interfaceMember);
1743diagnostics.Add(ErrorCode.WRN_MultipleRuntimeImplementationMatches, GetImplicitImplementationDiagnosticLocation(interfaceMember, implementingType, member), member, interfaceMember, implementingType);
1754diagnostics.Add(ErrorCode.ERR_LanguageVersionDoesNotSupportInterfaceImplementationForMember,
1764diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfacesForMember,
1789diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInTypeOnExplicitImplementation,
1794diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInTypeOnImplicitImplementation,
1819ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnExplicitImplementation :
1820ErrorCode.WRN_NullabilityMismatchInReturnTypeOnExplicitImplementation,
1826ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnImplicitImplementation :
1827ErrorCode.WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation,
1840ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnExplicitImplementation :
1841ErrorCode.WRN_NullabilityMismatchInParameterTypeOnExplicitImplementation,
1849ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnImplicitImplementation :
1850ErrorCode.WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation,
1878ErrorCode.ERR_ScopedMismatchInParameterOfOverrideOrImplementation :
1879ErrorCode.WRN_ScopedMismatchInParameterOfOverrideOrImplementation,
1894diagnostics.Add(ErrorCode.WRN_OverridingDifferentRefness, location, implementingParameter, implementedParameter);
1912ErrorCode.ERR_UnscopedRefAttributeInterfaceImplementation,
1998diagnostics.Add(closestMismatch.IsStatic ? ErrorCode.ERR_CloseUnimplementedInterfaceMemberStatic : ErrorCode.ERR_CloseUnimplementedInterfaceMemberNotStatic,
2003ErrorCode errorCode = interfaceMember.IsAccessor() ? ErrorCode.ERR_UnimplementedInterfaceAccessor : ErrorCode.ERR_CloseUnimplementedInterfaceMemberNotPublic;
2008diagnostics.Add(ErrorCode.ERR_CloseUnimplementedInterfaceMemberWrongInitOnly, interfaceLocation, implementingType, interfaceMember, closestMismatch);
2054diagnostics.Add(ErrorCode.ERR_CloseUnimplementedInterfaceMemberWrongRefReturn, interfaceLocation, implementingType, interfaceMember, closestMismatch);
2058diagnostics.Add(ErrorCode.ERR_CloseUnimplementedInterfaceMemberWrongReturnType, interfaceLocation, implementingType, interfaceMember, closestMismatch, interfaceMemberReturnType);
2127diagnostics.Add(ErrorCode.ERR_ImplBadConstraints, GetImplicitImplementationDiagnosticLocation(interfaceMethod, implementingType, implicitImpl), typeParameter2.Name, implicitImpl, typeParameter1.Name, interfaceMethod);
2131diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInConstraintsOnImplicitImplementation, GetImplicitImplementationDiagnosticLocation(interfaceMethod, implementingType, implicitImpl),
Symbols\VarianceSafety.cs (3)
92diagnostics.Add(ErrorCode.ERR_VarianceInterfaceNesting, member.GetFirstLocation());
474diagnostics.Add(ErrorCode.ERR_UnexpectedVarianceStaticMember, location, context, unsafeTypeParameter, actualVariance.Localize(), expectedVariance.Localize(),
479diagnostics.Add(ErrorCode.ERR_UnexpectedVariance, location, context, unsafeTypeParameter, actualVariance.Localize(), expectedVariance.Localize());