Binder\Binder.ValueChecks.cs (15)
713Error(diagnostics, ErrorCode.ERR_BadSKknown, node, ns.NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
718Error(diagnostics, ErrorCode.ERR_BadSKknown, node, type.Type, MessageID.IDS_SK_TYPE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
729Error(diagnostics, GetMethodGroupOrFunctionPointerLvalueError(valueKind), node, unconvertedAddressOf.Operand.Name, MessageID.IDS_AddressOfMethodGroup.Localize());
740Error(diagnostics, GetMethodGroupOrFunctionPointerLvalueError(valueKind), node, methodGroup.Name, MessageID.IDS_MethodGroup.Localize());
994Error(diagnostics, ErrorCode.ERR_BadSKknown, expr.Syntax, ((BoundNamespaceExpression)expr).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
997Error(diagnostics, ErrorCode.ERR_BadSKunknown, expr.Syntax, expr.Type, MessageID.IDS_SK_TYPE.Localize());
1012else if (this.IsDirectlyInIterator && Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync))
1749CheckFeatureAvailability(node, MessageID.IDS_FeatureInitOnlySetters, diagnostics);
3069MessageID cause;
3072cause = MessageID.IDS_FOREACHLOCAL;
3076cause = MessageID.IDS_USINGLOCAL;
3080cause = MessageID.IDS_FIXEDLOCAL;
Binder\Binder_Expressions.cs (47)
420if (CheckFeatureAvailability(syntax, MessageID.IDS_FeatureInferredDelegateType, diagnostics))
714MessageID.IDS_FeatureDefaultLiteral.CheckFeatureAvailability(diagnostics, node);
874MessageID.IDS_FeatureThrowExpression.CheckFeatureAvailability(diagnostics, node.ThrowKeyword);
997MessageID.IDS_FeatureTuples.CheckFeatureAvailability(diagnostics, node);
1515case ManagedKind.UnmanagedWithGenerics when MessageID.IDS_FeatureUnmanagedConstructedTypes.GetFeatureAvailabilityDiagnosticInfo(compilation) is CSDiagnosticInfo diagnosticInfo:
1533MessageID.IDS_FeatureDefault.CheckFeatureAvailability(diagnostics, node.Keyword);
1825CheckFeatureAvailability(node, MessageID.IDS_FeatureDiscards, diagnostics);
2265if (!IsInsideNameof || (EnclosingNameofArgument != node && !node.IsFeatureEnabled(MessageID.IDS_FeatureInstanceMemberInNameof)))
2299CheckFeatureAvailability(node, MessageID.IDS_FeatureInstanceMemberInNameof, diagnostics);
2559CheckFeatureAvailability(node, MessageID.IDS_FeatureIndexOperator, diagnostics);
2600CheckFeatureAvailability(node, MessageID.IDS_FeatureRangeOperator, diagnostics);
2781diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, MessageID.IDS_SK_METHOD.Localize(), targetType);
2955nameString = MessageID.IDS_Lambda.Localize().ToString();
3090MessageID.IDS_FeatureReadOnlyReferences.CheckFeatureAvailability(diagnostics, argumentSyntax.RefKindKeyword);
3095MessageID.IDS_FeatureOutVar.CheckFeatureAvailability(diagnostics, argumentSyntax.RefKindKeyword);
3173CheckFeatureAvailability(declarationExpression, MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers, diagnostics);
3251CheckFeatureAvailability(syntax, MessageID.IDS_FeatureRefUnsafeInIteratorAsync, diagnostics);
3291CheckFeatureAvailability(nameColonSyntax, MessageID.IDS_FeatureNamedArgument, diagnostics);
3338new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureNonTrailingNamedArguments.RequiredVersion()));
3410if (!Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters))
3417var available = CheckFeatureAvailability(argument.Syntax, MessageID.IDS_FeatureRefReadonlyParameters, diagnostics);
4063MessageID.IDS_FeatureImplicitArray.CheckFeatureAvailability(diagnostics, node.NewKeyword);
4528LanguageVersion requiredVersion = MessageID.IDS_FeatureNestedStackalloc.RequiredVersion();
4534MessageID.IDS_FeatureNestedStackalloc.CheckFeatureAvailability(diagnostics, node.GetFirstToken());
4553CheckFeatureAvailability(node, MessageID.IDS_FeatureRefStructs, diagnostics);
4616MessageID.IDS_FeatureStackAllocInitializer.CheckFeatureAvailability(diagnostics, stackAllocKeyword);
5116MessageID.IDS_FeatureImplicitObjectCreation.CheckFeatureAvailability(diagnostics, node.NewKeyword);
5203MessageID.IDS_FeatureCollectionExpressions.CheckFeatureAvailability(diagnostics, syntax, syntax.OpenBracketToken.GetLocation());
5628MessageID.IDS_FeatureObjectInitializer.CheckFeatureAvailability(diagnostics, initializerSyntax.OpenBraceToken);
5832MessageID.IDS_FeatureDictionaryInitializer.CheckFeatureAvailability(diagnostics, implicitIndexing.ArgumentList.OpenBracketToken);
5930MessageID.IDS_FeatureImplicitIndexerInitializer.CheckFeatureAvailability(diagnostics, implicitIndexer.Syntax);
6203MessageID.IDS_FeatureCollectionInitializer.CheckFeatureAvailability(diagnostics, initializerSyntax.OpenBraceToken);
6264CheckFeatureAvailability(node, MessageID.IDS_FeatureRefStructInterfaces, diagnostics);
7334MessageID.IDS_FeatureRawStringLiterals.CheckFeatureAvailability(diagnostics, node);
7347CheckFeatureAvailability(node, MessageID.IDS_FeatureRawStringLiterals, diagnostics);
7350CheckFeatureAvailability(node, MessageID.IDS_FeatureUtf8StringLiterals, diagnostics);
7647var msgId = ((UnboundLambda)boundLeft).MessageID;
7846CheckFeatureAvailability(boundLeft.Syntax, MessageID.IDS_FeatureStaticAbstractMembersInInterfaces, diagnostics);
7878Compilation.LanguageVersion < MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())
7907Error(diagnostics, ErrorCode.ERR_BadSKunknown, methodGroup.NameSyntax, method, MessageID.IDS_SK_METHOD.Localize());
8564CheckFeatureAvailability(node, MessageID.IDS_FeatureIndexingMovableFixedBuffers, diagnostics);
8610CheckFeatureAvailability(node, MessageID.IDS_FeatureRefFields, diagnostics);
8819else if (CheckFeatureAvailability(node, MessageID.IDS_FeatureInstanceMemberInNameof, diagnostics))
9189CheckFeatureAvailability(node, MessageID.IDS_FeatureInlineArrays, diagnostics);
9947_ = MessageID.IDS_FeatureIndexOperator.CheckFeatureAvailability(diagnostics, syntax);
10944MessageID.IDS_FeatureNullPropagatingOperator.CheckFeatureAvailability(diagnostics, node.OperatorToken);
11121var msgId = ((UnboundLambda)receiver).MessageID;
Binder\Binder_InterpolatedString.cs (10)
21if (CheckFeatureAvailability(node, MessageID.IDS_FeatureInterpolatedStrings, diagnostics))
27CheckFeatureAvailability(node, MessageID.IDS_FeatureRawStringLiterals, diagnostics);
32if (startText.StartsWith("@$\"") && !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureAltInterpolatedVerbatimStrings))
37new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureAltInterpolatedVerbatimStrings.RequiredVersion()));
53var newLinesInInterpolationsAllowed = this.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNewLinesInInterpolations);
86new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureNewLinesInInterpolations.RequiredVersion()));
662CheckFeatureAvailability(syntax, MessageID.IDS_FeatureImprovedInterpolatedStrings, diagnostics);
664else if (!Compilation.IsFeatureEnabled(MessageID.IDS_FeatureImprovedInterpolatedStrings) && diagnostics.AccumulatesDiagnostics)
689CheckFeatureAvailability(value.Syntax, MessageID.IDS_FeatureImprovedInterpolatedStrings, diagnostics);
699CheckFeatureAvailability(value.Syntax, MessageID.IDS_FeatureImprovedInterpolatedStrings, diagnostics);
Binder\Binder_Lookup.cs (4)
1780diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_HasNoTypeVars, namedType, MessageID.IDS_SK_TYPE.Localize()) : null;
1785diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_BadArity, namedType, MessageID.IDS_SK_TYPE.Localize(), namedType.Arity) : null;
1801diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_HasNoTypeVars, method, MessageID.IDS_SK_METHOD.Localize()) : null;
1806diagInfo = diagnose ? new CSDiagnosticInfo(ErrorCode.ERR_BadArity, method, MessageID.IDS_SK_METHOD.Localize(), method.Arity) : null;
Binder\Binder_Operators.cs (15)
548CheckFeatureAvailability(node, MessageID.IDS_FeatureTupleEquality, diagnostics);
1381Binder.CheckFeatureAvailability(node, MessageID.IDS_DefaultInterfaceImplementation, diagnostics);
2396result = CheckFeatureAvailability(node, MessageID.IDS_FeatureStaticAbstractMembersInInterfaces, diagnostics);
2407result = CheckFeatureAvailability(node, MessageID.IDS_FeatureStaticAbstractMembersInInterfaces, diagnostics);
2415result &= CheckFeatureAvailability(node, MessageID.IDS_FeatureUnsignedRightShift, diagnostics);
2426result &= CheckFeatureAvailability(node, MessageID.IDS_FeatureCheckedUserDefinedOperators, diagnostics);
2430result &= CheckFeatureAvailability(node, MessageID.IDS_FeatureUnsignedRightShift, diagnostics);
2441MessageID.IDS_FeatureNullableReferenceTypes.CheckFeatureAvailability(diagnostics, node.OperatorToken);
3227((CSharpParseOptions)node.SyntaxTree.Options).IsFeatureEnabled(MessageID.IDS_FeaturePatternMatching))
3274if (wasUnderscore && ((CSharpParseOptions)node.SyntaxTree.Options).IsFeatureEnabled(MessageID.IDS_FeatureRecursivePatterns))
4031CheckFeatureAvailability(node, MessageID.IDS_FeatureUnconstrainedTypeParameterInNullCoalescingOperator, diagnostics);
4169MessageID.IDS_FeatureCoalesceAssignmentExpression.CheckFeatureAvailability(diagnostics, node.OperatorToken);
4290CheckFeatureAvailability(node, MessageID.IDS_FeatureRefConditional, diagnostics);
4445CheckFeatureAvailability(syntax, MessageID.IDS_FeatureNativeInt, diagnostics);
4461CheckFeatureAvailability(syntax, MessageID.IDS_FeatureNativeInt, diagnostics);
Binder\Binder_Patterns.cs (22)
20MessageID.IDS_FeaturePatternMatching.CheckFeatureAvailability(diagnostics, node.IsKeyword);
147MessageID.IDS_FeatureRecursivePatterns.CheckFeatureAvailability(diagnostics, node.SwitchKeyword);
197MessageID.IDS_FeatureParenthesizedPattern.CheckFeatureAvailability(diagnostics, node.OpenParenToken);
295CheckFeatureAvailability(node, MessageID.IDS_FeatureListPattern, diagnostics);
403MessageID.IDS_FeatureRecursivePatterns.CheckFeatureAvailability(diagnostics, node);
445CheckFeatureAvailability(innerExpression, MessageID.IDS_FeatureTypePattern, diagnostics);
574CheckFeatureAvailability(patternExpression, MessageID.IDS_FeatureNullPointerConstantPattern, diagnostics);
630var requiredVersion = MessageID.IDS_FeatureRecursivePatterns.RequiredVersion();
654if (MessageID.IDS_FeatureSpanCharConstantPattern.CheckFeatureAvailability(diagnostics, Compilation, node.Location))
773LanguageVersion requiredVersion = MessageID.IDS_FeatureGenericPatternMatching.RequiredVersion();
888CheckFeatureAvailability(designation, MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers, diagnostics);
963MessageID.IDS_FeatureRecursivePatterns.CheckFeatureAvailability(diagnostics, node);
1091MessageID.IDS_FeatureExtendedPropertyPatterns.CheckFeatureAvailability(diagnostics, subPattern.ExpressionColon.ColonToken);
1246if (Compilation.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion())
1324|| (inputType.IsPointerType() && Compilation.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion()))
1372MessageID.IDS_FeatureRecursivePatterns.CheckFeatureAvailability(diagnostics, node);
1469MessageID.IDS_FeatureExtendedPropertyPatterns.CheckFeatureAvailability(diagnostics, p.ExpressionColon.ColonToken);
1616MessageID.IDS_FeatureTypePattern.CheckFeatureAvailability(diagnostics, node);
1629MessageID.IDS_FeatureRelationalPattern.CheckFeatureAvailability(diagnostics, node.OperatorToken);
1723MessageID.IDS_FeatureNotPattern.CheckFeatureAvailability(diagnostics, node.OperatorToken);
1787MessageID.IDS_FeatureOrPattern.CheckFeatureAvailability(diagnostics, node.OperatorToken);
1854MessageID.IDS_FeatureAndPattern.CheckFeatureAvailability(diagnostics, node.OperatorToken);
Binder\Binder_Query.cs (6)
26MessageID.IDS_FeatureQueryExpression.CheckFeatureAvailability(diagnostics, node.FromClause.FromKeyword);
773CheckFeatureAvailability(expression, MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers, diagnostics, locals[0].GetFirstLocation());
949diagnostics.Add(ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax.Location, ((BoundNamespaceExpression)ultimateReceiver).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize());
954diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, MessageID.IDS_AnonMethod.Localize(), methodName);
970diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, MessageID.IDS_SK_METHOD.Localize(), methodName);
982Error(diagnostics, ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax, ultimateReceiver.Type, MessageID.IDS_SK_TYVAR.Localize());
Binder\Binder_Statements.cs (24)
49CheckFeatureAvailability(attributeList, MessageID.IDS_FeatureLocalFunctionAttributes, diagnostics);
180CheckFeatureAvailability(node.UnsafeKeyword, MessageID.IDS_FeatureRefUnsafeInIteratorAsync, diagnostics);
217MessageID.IDS_FeatureIterators.CheckFeatureAvailability(diagnostics, statement.YieldKeyword);
222MessageID.IDS_FeatureAsyncStreams.CheckFeatureAvailability(
270else if (InUnsafeRegion && Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync))
396if (Compilation.LanguageVersion < MessageID.IDS_FeatureSwitchExpression.RequiredVersion())
556MessageID.IDS_FeatureLocalFunctions.CheckFeatureAvailability(diagnostics, node.Identifier);
601MessageID.IDS_FeatureStaticLocalFunctions.CheckFeatureAvailability(diagnostics, modifier);
603MessageID.IDS_FeatureExternLocalFunctions.CheckFeatureAvailability(diagnostics, modifier);
1166return !CheckFeatureAvailability(identifierToken, MessageID.IDS_FeatureRefUnsafeInIteratorAsync, diagnostics);
1289bool extensibleFixedEnabled = ((CSharpParseOptions)initializerOpt.SyntaxTree.Options)?.IsFeatureEnabled(MessageID.IDS_FeatureExtensibleFixedStatement) != false;
1300CheckFeatureAvailability(initializerOpt.Syntax, MessageID.IDS_FeatureExtensibleFixedStatement, diagnostics);
1420MessageID.IDS_FeatureRefReassignment.CheckFeatureAvailability(diagnostics, node.Right.GetFirstToken());
1610return MessageID.IDS_ArrayAccess.Localize();
1614return MessageID.IDS_PointerElementAccess.Localize();
2488syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType))
3351MessageID.IDS_FeatureExceptionFilter.CheckFeatureAvailability(diagnostics, filter.WhenKeyword);
3549ConstructorDeclarationSyntax or DestructorDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedDeOrConstructor,
3550AccessorDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedAccessor,
3551BaseMethodDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedMethod,
3552IndexerDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedIndexer,
3553PropertyDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedProperty,
3557LocalFunctionStatementSyntax => (MessageID?)null,
3664MessageID.IDS_TopLevelStatements.CheckFeatureAvailability(diagnostics, topLevelStatement);
Binder\Binder_Symbols.cs (24)
115CheckFeatureAvailability(syntax, MessageID.IDS_FeatureImplicitLocal, diagnostics);
159CheckFeatureAvailability(syntax, MessageID.IDS_FeatureUnmanagedGenericTypeConstraint, diagnostics);
162CheckFeatureAvailability(identifierSyntax, MessageID.IDS_FeatureNotNullGenericTypeConstraint, diagnostics);
340var diagnosticInfo = diagnostics.Add(ErrorCode.ERR_BadSKknown, syntax.Location, syntax, symbol.Symbol.GetKindText(), MessageID.IDS_SK_TYPE.Localize());
449MessageID.IDS_FeatureFunctionPointers.CheckFeatureAvailability(diagnostics, functionPointerTypeSyntax.DelegateKeyword);
540MessageID.IDS_FeatureNullable.CheckFeatureAvailability(diagnostics, nullableSyntax.QuestionToken);
577MessageID.IDS_FeatureGlobalNamespace.CheckFeatureAvailability(diagnostics, node.Alias);
617var requiredVersion = MessageID.IDS_FeatureDefaultTypeParameterConstraint.RequiredVersion();
678MessageID.IDS_FeatureTuples.CheckFeatureAvailability(diagnostics, syntax);
733bool includeNullability = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes);
931if (Compilation.LanguageVersion < MessageID.IDS_FeatureDynamic.RequiredVersion())
1022CheckFeatureAvailability(node, MessageID.IDS_FeatureNativeInt, diagnostics);
1358var binder = !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureUsingTypeAlias)
1379CheckFeatureAvailability(typeSyntax, MessageID.IDS_FeatureUnboundGenericTypesInNameof, diagnostics);
1399Error(diagnostics, ErrorCode.ERR_BadArity, typeSyntax, type, MessageID.IDS_SK_TYPE.Localize(), typeArgumentsSyntax.Count);
1431Error(diagnostics, ErrorCode.ERR_BadArity, syntax, plainName, MessageID.IDS_MethodGroup.Localize(), typeArgumentsSyntax.Count);
1581bool includeNullability = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes);
2736internal static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, BindingDiagnosticBag diagnostics, Location? location = null)
2739internal static bool CheckFeatureAvailability(SyntaxToken syntax, MessageID feature, BindingDiagnosticBag diagnostics, bool forceWarning = false)
2742internal static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, BindingDiagnosticBag diagnostics, Location location)
2745private static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, DiagnosticBag? diagnostics, Location? location = null)
2748private static bool CheckFeatureAvailability(SyntaxToken syntax, MessageID feature, DiagnosticBag? diagnostics, bool forceWarning = false)
2751private static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, Location location)
2757private static bool CheckFeatureAvailability<TData>(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, TData data, Func<TData, Location> getLocation, bool forceWarning = false)
Binder\ForEachLoopBinder.cs (16)
220CheckFeatureAvailability(_syntax.AwaitKeyword, MessageID.IDS_FeatureAsyncStreams, diagnostics);
241var messageId = IsAsync ? MessageID.IDS_FeatureExtensionGetAsyncEnumerator : MessageID.IDS_FeatureExtensionGetEnumerator;
293MessageID.IDS_FeatureRefForEach.CheckFeatureAvailability(diagnostics, typeSyntax);
530CheckFeatureAvailability(foreachKeyword, MessageID.IDS_FeatureRefUnsafeInIteratorAsync, diagnostics);
875CheckFeatureAvailability(collectionExpr.Syntax, MessageID.IDS_FeatureInlineArrays, diagnostics);
1228CheckFeatureAvailability(expr.Syntax, MessageID.IDS_FeatureDisposalPattern, diagnostics);
1271CheckFeatureAvailability(syntax, MessageID.IDS_FeatureRefStructInterfaces, diagnostics);
1449MessageID patternName = isAsync ? MessageID.IDS_FeatureAsyncStreams : MessageID.IDS_Collection;
1485diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, patternType, MessageID.IDS_Collection.Localize(),
1556diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, collectionExpr.Type, MessageID.IDS_Collection.Localize(),
1715diagnostics.Add(ErrorCode.WRN_PatternBadSignature, collectionSyntax.Location, enumeratorType, MessageID.IDS_Collection.Localize(), patternMemberCandidate);
1778CheckFeatureAvailability(collectionSyntax, MessageID.IDS_FeatureRefStructInterfaces, diagnostics);
CommandLine\CSharpCommandLineParser.cs (23)
208AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "/langversion:");
280ParseAndResolveReferencePaths(name, valueMemory, baseDirectory, libPaths, MessageID.IDS_LIB_OPTION, diagnostics);
328ParseAndResolveReferencePaths(name, valueMemory, baseDirectory, sourcePaths, MessageID.IDS_REFERENCEPATH_OPTION, diagnostics);
417AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), name);
618AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "modulename");
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:");
791AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), name);
1048AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "keycontainer");
1110AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "subsystemversion");
1131AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), "touchedfiles");
1421ParseAndResolveReferencePaths(null, additionalReferenceDirectories.AsMemory(), baseDirectory, libPaths, MessageID.IDS_LIB_ENV, diagnostics);
1536if (nullableContextOptions != NullableContextOptions.Disable && parseOptions.LanguageVersion < MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())
1540new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())), Location.None));
1599private static void ParseAndResolveReferencePaths(string? switchName, ReadOnlyMemory<char>? switchValue, string? baseDirectory, List<string> builder, MessageID origin, List<Diagnostic> diagnostics)
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());
1856AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Namespace1.Localize(), arg);
1870AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), arg);
1897AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), arg);
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (12)
283_diagnostics.Add(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, new LocalizableErrorArgument(MessageID.IDS_OperationCausedStackOverflow));
286commentMessage = ErrorFacts.GetMessage(MessageID.IDS_XMLNOINCLUDE, CultureInfo.CurrentUICulture);
303var subMessage = hasFileAttribute ? MessageID.IDS_XMLMISSINGINCLUDEPATH.Localize() : MessageID.IDS_XMLMISSINGINCLUDEFILE.Localize();
305commentMessage = MakeCommentMessage(location, MessageID.IDS_XMLBADINCLUDE);
316commentMessage = MakeCommentMessage(location, MessageID.IDS_XMLFAILEDINCLUDE);
326commentMessage = MakeCommentMessage(location, MessageID.IDS_XMLFAILEDINCLUDE);
347commentMessage = MakeCommentMessage(location, MessageID.IDS_XMLFAILEDINCLUDE);
360commentMessage = MakeCommentMessage(location, MessageID.IDS_XMLFAILEDINCLUDE);
396commentMessage = MakeCommentMessage(location, MessageID.IDS_XMLNOINCLUDE);
409commentMessage = string.Format(ErrorFacts.GetMessage(MessageID.IDS_XMLIGNORED2, CultureInfo.CurrentUICulture), resolvedFilePath);
434private static string MakeCommentMessage(Location location, MessageID messageId)
Declarations\DeclarationTreeBuilder.cs (11)
480MessageID.IDS_FeatureUsingStatic.CheckFeatureAvailability(diagnostics, usingDirective, usingDirective.StaticKeyword.GetLocation());
483MessageID.IDS_FeatureGlobalUsing.CheckFeatureAvailability(diagnostics, usingDirective, usingDirective.GlobalKeyword.GetLocation());
490MessageID.IDS_FeatureExternAlias.CheckFeatureAvailability(diagnostics, externAlias, externAlias.ExternKeyword.GetLocation());
528MessageID.IDS_FeatureFileScopedNamespace.CheckFeatureAvailability(diagnostics, node, node.NamespaceKeyword.GetLocation());
728MessageID.IDS_FeatureRecordStructs.CheckFeatureAvailability(diagnostics, record, record.ClassOrStructKeyword.GetLocation());
741MessageID.IDS_FeaturePrimaryConstructors.CheckFeatureAvailability(diagnostics, node.ParameterList);
746MessageID.IDS_FeaturePrimaryConstructors.CheckFeatureAvailability(diagnostics, node, node.SemicolonToken.GetLocation());
757MessageID.IDS_FeatureStaticClasses.CheckFeatureAvailability(diagnostics, node, modifier.GetLocation());
761MessageID.IDS_FeatureReadOnlyStructs.CheckFeatureAvailability(diagnostics, node, modifier.GetLocation());
765MessageID.IDS_FeatureRefStructs.CheckFeatureAvailability(diagnostics, node, modifier.GetLocation());
852MessageID.IDS_FeaturePrimaryConstructors.CheckFeatureAvailability(diagnostics, node, node.SemicolonToken.GetLocation());
Errors\MessageID.cs (192)
304private readonly MessageID _id;
306internal LocalizableErrorArgument(MessageID id)
326public static LocalizableErrorArgument Localize(this MessageID id)
337internal static string? RequiredFeature(this MessageID feature)
348this MessageID feature,
362this MessageID feature,
376this MessageID feature,
390this MessageID feature,
404this MessageID feature,
419this MessageID feature,
434this MessageID feature,
447internal static CSDiagnosticInfo? GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpParseOptions options)
450internal static CSDiagnosticInfo? GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpCompilation compilation)
453private static CSDiagnosticInfo GetDisabledFeatureDiagnosticInfo(MessageID feature, LanguageVersion availableVersion)
467internal static LanguageVersion RequiredVersion(this MessageID feature)
478case MessageID.IDS_FeatureFieldKeyword:
479case MessageID.IDS_FeatureFirstClassSpan:
480case MessageID.IDS_FeatureUnboundGenericTypesInNameof:
484case MessageID.IDS_FeatureStringEscapeCharacter: // lexer check
485case MessageID.IDS_FeatureImplicitIndexerInitializer:
486case MessageID.IDS_FeatureLockObject:
487case MessageID.IDS_FeatureParamsCollections:
488case MessageID.IDS_FeatureRefUnsafeInIteratorAsync:
489case MessageID.IDS_FeatureRefStructInterfaces:
490case MessageID.IDS_FeatureAllowsRefStructConstraint:
491case MessageID.IDS_FeaturePartialProperties:
492case MessageID.IDS_OverloadResolutionPriority:
496case MessageID.IDS_FeatureLambdaOptionalParameters: // semantic check
497case MessageID.IDS_FeatureLambdaParamsArray: // semantic check
498case MessageID.IDS_FeaturePrimaryConstructors: // declaration table check
499case MessageID.IDS_FeatureUsingTypeAlias: // semantic check
500case MessageID.IDS_FeatureInstanceMemberInNameof: // semantic check
501case MessageID.IDS_FeatureInlineArrays: // semantic check
502case MessageID.IDS_FeatureCollectionExpressions: // semantic check
503case MessageID.IDS_FeatureRefReadonlyParameters: // semantic check
507case MessageID.IDS_FeatureRawStringLiterals:
508case MessageID.IDS_FeatureStaticAbstractMembersInInterfaces: // semantic check
509case MessageID.IDS_FeatureNewLinesInInterpolations: // semantic check
510case MessageID.IDS_FeatureListPattern: // semantic check
511case MessageID.IDS_FeatureRequiredMembers: // semantic check
512case MessageID.IDS_FeatureCacheStaticMethodGroupConversion: // lowering check
513case MessageID.IDS_FeatureSpanCharConstantPattern:
514case MessageID.IDS_FeatureAutoDefaultStructs: // semantic check
515case MessageID.IDS_FeatureCheckedUserDefinedOperators: // semantic check for declarations, parsing check for doc comments
516case MessageID.IDS_FeatureUtf8StringLiterals: // semantic check
517case MessageID.IDS_FeatureUnsignedRightShift: // semantic check for declarations and consumption, parsing check for doc comments
518case MessageID.IDS_FeatureRelaxedShiftOperator: // semantic check
519case MessageID.IDS_FeatureRefFields: // semantic check
520case MessageID.IDS_FeatureFileTypes: // semantic check
521case MessageID.IDS_FeatureGenericAttributes: // semantic check
525case MessageID.IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction: // semantic check
526case MessageID.IDS_FeatureSealedToStringInRecord: // semantic check
527case MessageID.IDS_FeatureImprovedInterpolatedStrings: // semantic check
528case MessageID.IDS_FeatureRecordStructs:
529case MessageID.IDS_FeatureWithOnStructs: // semantic check
530case MessageID.IDS_FeatureWithOnAnonymousTypes: // semantic check
531case MessageID.IDS_FeaturePositionalFieldsInRecords: // semantic check
532case MessageID.IDS_FeatureGlobalUsing:
533case MessageID.IDS_FeatureInferredDelegateType: // semantic check
534case MessageID.IDS_FeatureLambdaAttributes: // semantic check
535case MessageID.IDS_FeatureExtendedPropertyPatterns: // semantic check
536case MessageID.IDS_FeatureLambdaReturnType: // semantic check
537case MessageID.IDS_AsyncMethodBuilderOverride: // semantic check
538case MessageID.IDS_FeatureConstantInterpolatedStrings: // semantic check
539case MessageID.IDS_FeatureImplicitImplementationOfNonPublicMembers: // semantic check
540case MessageID.IDS_FeatureFileScopedNamespace: // semantic check
541case MessageID.IDS_FeatureParameterlessStructConstructors: // semantic check
542case MessageID.IDS_FeatureStructFieldInitializers: // semantic check
546case MessageID.IDS_FeatureLambdaDiscardParameters: // semantic check
547case MessageID.IDS_FeatureFunctionPointers: // semantic check
548case MessageID.IDS_FeatureLocalFunctionAttributes: // syntax check
549case MessageID.IDS_FeatureExternLocalFunctions: // semantic check
550case MessageID.IDS_FeatureImplicitObjectCreation: // semantic check
551case MessageID.IDS_FeatureMemberNotNull:
552case MessageID.IDS_FeatureAndPattern: // semantic check
553case MessageID.IDS_FeatureNotPattern: // semantic check
554case MessageID.IDS_FeatureOrPattern: // semantic check
555case MessageID.IDS_FeatureParenthesizedPattern: // semantic check
556case MessageID.IDS_FeatureTypePattern: // semantic check
557case MessageID.IDS_FeatureRelationalPattern: // semantic check
558case MessageID.IDS_FeatureExtensionGetEnumerator: // semantic check
559case MessageID.IDS_FeatureExtensionGetAsyncEnumerator: // semantic check
560case MessageID.IDS_FeatureNativeInt:
561case MessageID.IDS_FeatureExtendedPartialMethods: // semantic check
562case MessageID.IDS_TopLevelStatements:
563case MessageID.IDS_FeatureInitOnlySetters: // semantic check
564case MessageID.IDS_FeatureRecords: // semantic check
565case MessageID.IDS_FeatureTargetTypedConditional: // semantic check
566case MessageID.IDS_FeatureCovariantReturnsForOverrides: // semantic check
567case MessageID.IDS_FeatureStaticAnonymousFunction: // semantic check
568case MessageID.IDS_FeatureModuleInitializers: // semantic check on method attribute
569case MessageID.IDS_FeatureDefaultTypeParameterConstraint: // semantic check
570case MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers: // semantic check
574case MessageID.IDS_FeatureAltInterpolatedVerbatimStrings: // semantic check
575case MessageID.IDS_FeatureCoalesceAssignmentExpression: // semantic check
576case MessageID.IDS_FeatureUnconstrainedTypeParameterInNullCoalescingOperator:
577case MessageID.IDS_FeatureNullableReferenceTypes: // syntax and semantic check
578case MessageID.IDS_FeatureIndexOperator: // semantic check
579case MessageID.IDS_FeatureRangeOperator: // semantic check
580case MessageID.IDS_FeatureAsyncStreams: // semantic check
581case MessageID.IDS_FeatureRecursivePatterns: // semantic check
582case MessageID.IDS_FeatureUsingDeclarations: // semantic check
583case MessageID.IDS_FeatureDisposalPattern: //semantic check
584case MessageID.IDS_FeatureStaticLocalFunctions: // semantic check
585case MessageID.IDS_FeatureNameShadowingInNestedFunctions:
586case MessageID.IDS_FeatureUnmanagedConstructedTypes: // semantic check
587case MessageID.IDS_FeatureObsoleteOnPropertyAccessor:
588case MessageID.IDS_FeatureReadOnlyMembers:
589case MessageID.IDS_DefaultInterfaceImplementation: // semantic check
590case MessageID.IDS_OverrideWithConstraints: // semantic check
591case MessageID.IDS_FeatureNestedStackalloc: // semantic check
592case MessageID.IDS_FeatureNotNullGenericTypeConstraint:// semantic check
593case MessageID.IDS_FeatureSwitchExpression:
594case MessageID.IDS_FeatureAsyncUsing:
595case MessageID.IDS_FeatureNullPointerConstantPattern: //semantic check
599case MessageID.IDS_FeatureAttributesOnBackingFields: // semantic check
600case MessageID.IDS_FeatureImprovedOverloadCandidates: // semantic check
601case MessageID.IDS_FeatureTupleEquality: // semantic check
602case MessageID.IDS_FeatureRefReassignment: // semantic check
603case MessageID.IDS_FeatureRefFor:
604case MessageID.IDS_FeatureRefForEach: // semantic check
605case MessageID.IDS_FeatureEnumGenericTypeConstraint: // semantic check
606case MessageID.IDS_FeatureDelegateGenericTypeConstraint: // semantic check
607case MessageID.IDS_FeatureUnmanagedGenericTypeConstraint: // semantic check
608case MessageID.IDS_FeatureStackAllocInitializer: // semantic check
609case MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers: // semantic check
610case MessageID.IDS_FeatureExtensibleFixedStatement: // semantic check
611case MessageID.IDS_FeatureIndexingMovableFixedBuffers: //semantic check
615case MessageID.IDS_FeatureNonTrailingNamedArguments: // semantic check
616case MessageID.IDS_FeatureLeadingDigitSeparator:
617case MessageID.IDS_FeaturePrivateProtected:
618case MessageID.IDS_FeatureReadOnlyReferences: // semantic check
619case MessageID.IDS_FeatureRefStructs: // semantic check
620case MessageID.IDS_FeatureReadOnlyStructs: // semantic check
621case MessageID.IDS_FeatureRefExtensionMethods:
622case MessageID.IDS_FeatureRefConditional:
626case MessageID.IDS_FeatureAsyncMain:
627case MessageID.IDS_FeatureDefaultLiteral: // semantic check
628case MessageID.IDS_FeatureInferredTupleNames:
629case MessageID.IDS_FeatureGenericPatternMatching:
633case MessageID.IDS_FeatureBinaryLiteral:
634case MessageID.IDS_FeatureDigitSeparator:
635case MessageID.IDS_FeatureLocalFunctions: // semantic check
636case MessageID.IDS_FeatureRefLocalsReturns:
637case MessageID.IDS_FeaturePatternMatching: // semantic check
638case MessageID.IDS_FeatureThrowExpression: // semantic check
639case MessageID.IDS_FeatureTuples:
640case MessageID.IDS_FeatureOutVar: // semantic check
641case MessageID.IDS_FeatureExpressionBodiedAccessor:
642case MessageID.IDS_FeatureExpressionBodiedDeOrConstructor:
643case MessageID.IDS_FeatureDiscards:
647case MessageID.IDS_FeatureExceptionFilter: // semantic check
648case MessageID.IDS_FeatureAutoPropertyInitializer: // semantic check
649case MessageID.IDS_FeatureNullPropagatingOperator: // semantic check
650case MessageID.IDS_FeatureExpressionBodiedMethod:
651case MessageID.IDS_FeatureExpressionBodiedProperty: // semantic check
652case MessageID.IDS_FeatureExpressionBodiedIndexer: // semantic check
653case MessageID.IDS_FeatureNameof:
654case MessageID.IDS_FeatureDictionaryInitializer: // semantic check
655case MessageID.IDS_FeatureUsingStatic: // semantic check
656case MessageID.IDS_FeatureInterpolatedStrings: // semantic check
657case MessageID.IDS_AwaitInCatchAndFinally:
658case MessageID.IDS_FeatureReadonlyAutoImplementedProperties:
662case MessageID.IDS_FeatureAsync: // semantic check
666case MessageID.IDS_FeatureDynamic: // Checked in the binder.
667case MessageID.IDS_FeatureTypeVariance: // semantic check
668case MessageID.IDS_FeatureNamedArgument: // semantic check
669case MessageID.IDS_FeatureOptionalParameter: // semantic check
673case MessageID.IDS_FeatureImplicitArray: // semantic check
674case MessageID.IDS_FeatureAnonymousTypes: // semantic check
675case MessageID.IDS_FeatureObjectInitializer:
676case MessageID.IDS_FeatureCollectionInitializer:
677case MessageID.IDS_FeatureLambda: // semantic check
678case MessageID.IDS_FeatureQueryExpression: // semantic check
679case MessageID.IDS_FeatureExtensionMethod:
680case MessageID.IDS_FeaturePartialMethod: // semantic check
681case MessageID.IDS_FeatureImplicitLocal: // Checked in the binder.
682case MessageID.IDS_FeatureAutoImplementedProperties:
686case MessageID.IDS_FeatureGenerics: // Also affects crefs.
687case MessageID.IDS_FeatureAnonDelegates: // semantic check
688case MessageID.IDS_FeatureGlobalNamespace: // Also affects crefs.
689case MessageID.IDS_FeatureFixedBuffer: // semantic check
690case MessageID.IDS_FeatureStaticClasses: // semantic check
691case MessageID.IDS_FeaturePartialTypes: // semantic check
692case MessageID.IDS_FeaturePropertyAccessorMods:
693case MessageID.IDS_FeatureExternAlias: // semantic check
694case MessageID.IDS_FeatureIterators: // semantic check
695case MessageID.IDS_FeatureDefault: // semantic check
696case MessageID.IDS_FeatureNullable:
697case MessageID.IDS_FeaturePragma: // Checked in the directive parser.
698case MessageID.IDS_FeatureSwitchOnBool: // Checked in the binder.
702case MessageID.IDS_FeatureModuleAttrLoc:
Symbols\Source\ParameterHelpers.cs (8)
212bool allowShadowingNames = withTypeParametersBinder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions) &&
442Binder.CheckFeatureAvailability(modifier, MessageID.IDS_FeatureExtensionMethod, diagnostics);
446Binder.CheckFeatureAvailability(modifier, MessageID.IDS_FeatureRefExtensionMethods, diagnostics);
474Binder.CheckFeatureAvailability(modifier, MessageID.IDS_FeatureRefExtensionMethods, diagnostics);
558MessageID.IDS_FeatureLambdaParamsArray.CheckFeatureAvailability(diagnostics, modifier);
563Binder.CheckFeatureAvailability(modifier, MessageID.IDS_FeatureReadOnlyReferences, diagnostics);
567Binder.CheckFeatureAvailability(modifier, MessageID.IDS_FeatureRefExtensionMethods, diagnostics);
613Binder.CheckFeatureAvailability(modifier, MessageID.IDS_FeatureRefReadonlyParameters, diagnostics);
Symbols\Source\SourceMemberContainerSymbol.cs (15)
498if (reportIfContextual(SyntaxKind.RecordKeyword, MessageID.IDS_FeatureRecords, ErrorCode.WRN_RecordNamedDisallowed)
499|| reportIfContextual(SyntaxKind.RequiredKeyword, MessageID.IDS_FeatureRequiredMembers, ErrorCode.ERR_RequiredNameDisallowed)
500|| reportIfContextual(SyntaxKind.FileKeyword, MessageID.IDS_FeatureFileTypes, ErrorCode.ERR_FileTypeNameDisallowed)
501|| reportIfContextual(SyntaxKind.ScopedKeyword, MessageID.IDS_FeatureRefFields, ErrorCode.ERR_ScopedTypeNameDisallowed))
510bool reportIfContextual(SyntaxKind contextualKind, MessageID featureId, ErrorCode error)
1362Binder.CheckFeatureAvailability(t.DeclaringSyntaxReferences[0].GetSyntax(), MessageID.IDS_DefaultInterfaceImplementation, diagnostics, t.GetFirstLocation());
2160var methodKind = method1.MethodKind == MethodKind.Constructor ? MessageID.IDS_SK_CONSTRUCTOR : MessageID.IDS_SK_METHOD;
4111MessageID.IDS_FeatureParameterlessStructConstructors.CheckFeatureAvailability(diagnostics, m.DeclaringCompilation, location);
4140MessageID.IDS_FeatureStructFieldInitializers.CheckFeatureAvailability(diagnostics, symbol.DeclaringCompilation, symbol.GetFirstLocation());
4458if (baseToStringMethod.ContainingModule != this.ContainingModule && !this.DeclaringCompilation.IsFeatureEnabled(MessageID.IDS_FeatureSealedToStringInRecord))
4461var requiredVersion = MessageID.IDS_FeatureSealedToStringInRecord.RequiredVersion();
4484MessageID.IDS_FeatureSealedToStringInRecord.CheckFeatureAvailability(
4548Binder.CheckFeatureAvailability(syntax, MessageID.IDS_FeaturePositionalFieldsInRecords, diagnostics);
Symbols\Source\SourceMethodSymbolWithAttributes.cs (9)
598MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
603MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
608MessageID.IDS_FeatureModuleInitializers.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
623MessageID.IDS_FeatureRefStructInterfaces.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
637MessageID.IDS_OverloadResolutionPriority.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
699MessageID.IDS_FeatureObsoleteOnPropertyAccessor.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
1419diagnostics.Add(ErrorCode.ERR_CannotUseManagedTypeInUnmanagedCallersOnly, syntax.Location, type, (isParam ? MessageID.IDS_Parameter : MessageID.IDS_Return).Localize());
1546MessageID.IDS_AsyncMethodBuilderOverride.CheckFeatureAvailability(diagnostics, this.DeclaringCompilation, errorLocation);
Symbols\VarianceSafety.cs (9)
176return MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers.RequiredVersion() <= member.DeclaringCompilation.LanguageVersion;
311diagnostics.AddVarianceError(typeParam, context, locationProvider, locationArg, MessageID.IDS_Invariantly);
317diagnostics.AddVarianceError(typeParam, context, locationProvider, locationArg, MessageID.IDS_Covariantly);
323diagnostics.AddVarianceError(typeParam, context, locationProvider, locationArg, MessageID.IDS_Contravariantly);
445MessageID expectedVariance)
448MessageID actualVariance;
452actualVariance = MessageID.IDS_Contravariant;
455actualVariance = MessageID.IDS_Covariant;
475new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers.RequiredVersion()));