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 (48)
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);
1508var requiredVersion = MessageID.IDS_FeatureFieldKeyword.RequiredVersion();
1545case ManagedKind.UnmanagedWithGenerics when MessageID.IDS_FeatureUnmanagedConstructedTypes.GetFeatureAvailabilityDiagnosticInfo(compilation) is CSDiagnosticInfo diagnosticInfo:
1563MessageID.IDS_FeatureDefault.CheckFeatureAvailability(diagnostics, node.Keyword);
1855CheckFeatureAvailability(node, MessageID.IDS_FeatureDiscards, diagnostics);
2295if (!IsInsideNameof || (EnclosingNameofArgument != node && !node.IsFeatureEnabled(MessageID.IDS_FeatureInstanceMemberInNameof)))
2329CheckFeatureAvailability(node, MessageID.IDS_FeatureInstanceMemberInNameof, diagnostics);
2589CheckFeatureAvailability(node, MessageID.IDS_FeatureIndexOperator, diagnostics);
2630CheckFeatureAvailability(node, MessageID.IDS_FeatureRangeOperator, diagnostics);
2811diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, MessageID.IDS_SK_METHOD.Localize(), targetType);
2985nameString = MessageID.IDS_Lambda.Localize().ToString();
3120MessageID.IDS_FeatureReadOnlyReferences.CheckFeatureAvailability(diagnostics, argumentSyntax.RefKindKeyword);
3125MessageID.IDS_FeatureOutVar.CheckFeatureAvailability(diagnostics, argumentSyntax.RefKindKeyword);
3205CheckFeatureAvailability(declarationExpression, MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers, diagnostics);
3283CheckFeatureAvailability(syntax, MessageID.IDS_FeatureRefUnsafeInIteratorAsync, diagnostics);
3323CheckFeatureAvailability(nameColonSyntax, MessageID.IDS_FeatureNamedArgument, diagnostics);
3370new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureNonTrailingNamedArguments.RequiredVersion()));
3442if (!Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters))
3449var available = CheckFeatureAvailability(argument.Syntax, MessageID.IDS_FeatureRefReadonlyParameters, diagnostics);
4095MessageID.IDS_FeatureImplicitArray.CheckFeatureAvailability(diagnostics, node.NewKeyword);
4560LanguageVersion requiredVersion = MessageID.IDS_FeatureNestedStackalloc.RequiredVersion();
4566MessageID.IDS_FeatureNestedStackalloc.CheckFeatureAvailability(diagnostics, node.GetFirstToken());
4585CheckFeatureAvailability(node, MessageID.IDS_FeatureRefStructs, diagnostics);
4648MessageID.IDS_FeatureStackAllocInitializer.CheckFeatureAvailability(diagnostics, stackAllocKeyword);
5148MessageID.IDS_FeatureImplicitObjectCreation.CheckFeatureAvailability(diagnostics, node.NewKeyword);
5235MessageID.IDS_FeatureCollectionExpressions.CheckFeatureAvailability(diagnostics, syntax, syntax.OpenBracketToken.GetLocation());
5660MessageID.IDS_FeatureObjectInitializer.CheckFeatureAvailability(diagnostics, initializerSyntax.OpenBraceToken);
5864MessageID.IDS_FeatureDictionaryInitializer.CheckFeatureAvailability(diagnostics, implicitIndexing.ArgumentList.OpenBracketToken);
5962MessageID.IDS_FeatureImplicitIndexerInitializer.CheckFeatureAvailability(diagnostics, implicitIndexer.Syntax);
6235MessageID.IDS_FeatureCollectionInitializer.CheckFeatureAvailability(diagnostics, initializerSyntax.OpenBraceToken);
6296CheckFeatureAvailability(node, MessageID.IDS_FeatureRefStructInterfaces, diagnostics);
7364MessageID.IDS_FeatureRawStringLiterals.CheckFeatureAvailability(diagnostics, node);
7377CheckFeatureAvailability(node, MessageID.IDS_FeatureRawStringLiterals, diagnostics);
7380CheckFeatureAvailability(node, MessageID.IDS_FeatureUtf8StringLiterals, diagnostics);
7677var msgId = ((UnboundLambda)boundLeft).MessageID;
7876CheckFeatureAvailability(boundLeft.Syntax, MessageID.IDS_FeatureStaticAbstractMembersInInterfaces, diagnostics);
7908Compilation.LanguageVersion < MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())
7937Error(diagnostics, ErrorCode.ERR_BadSKunknown, methodGroup.NameSyntax, method, MessageID.IDS_SK_METHOD.Localize());
8594CheckFeatureAvailability(node, MessageID.IDS_FeatureIndexingMovableFixedBuffers, diagnostics);
8640CheckFeatureAvailability(node, MessageID.IDS_FeatureRefFields, diagnostics);
8849else if (CheckFeatureAvailability(node, MessageID.IDS_FeatureInstanceMemberInNameof, diagnostics))
9219CheckFeatureAvailability(node, MessageID.IDS_FeatureInlineArrays, diagnostics);
9977_ = MessageID.IDS_FeatureIndexOperator.CheckFeatureAvailability(diagnostics, syntax);
10974MessageID.IDS_FeatureNullPropagatingOperator.CheckFeatureAvailability(diagnostics, node.OperatorToken);
11151var 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);
1386Binder.CheckFeatureAvailability(node, MessageID.IDS_DefaultInterfaceImplementation, diagnostics);
2401result = CheckFeatureAvailability(node, MessageID.IDS_FeatureStaticAbstractMembersInInterfaces, diagnostics);
2412result = CheckFeatureAvailability(node, MessageID.IDS_FeatureStaticAbstractMembersInInterfaces, diagnostics);
2420result &= CheckFeatureAvailability(node, MessageID.IDS_FeatureUnsignedRightShift, diagnostics);
2431result &= CheckFeatureAvailability(node, MessageID.IDS_FeatureCheckedUserDefinedOperators, diagnostics);
2435result &= CheckFeatureAvailability(node, MessageID.IDS_FeatureUnsignedRightShift, diagnostics);
2446MessageID.IDS_FeatureNullableReferenceTypes.CheckFeatureAvailability(diagnostics, node.OperatorToken);
3232((CSharpParseOptions)node.SyntaxTree.Options).IsFeatureEnabled(MessageID.IDS_FeaturePatternMatching))
3279if (wasUnderscore && ((CSharpParseOptions)node.SyntaxTree.Options).IsFeatureEnabled(MessageID.IDS_FeatureRecursivePatterns))
4036CheckFeatureAvailability(node, MessageID.IDS_FeatureUnconstrainedTypeParameterInNullCoalescingOperator, diagnostics);
4174MessageID.IDS_FeatureCoalesceAssignmentExpression.CheckFeatureAvailability(diagnostics, node.OperatorToken);
4295CheckFeatureAvailability(node, MessageID.IDS_FeatureRefConditional, diagnostics);
4450CheckFeatureAvailability(syntax, MessageID.IDS_FeatureNativeInt, diagnostics);
4466CheckFeatureAvailability(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);
603MessageID.IDS_FeatureStaticLocalFunctions.CheckFeatureAvailability(diagnostics, modifier);
605MessageID.IDS_FeatureExternLocalFunctions.CheckFeatureAvailability(diagnostics, modifier);
1168return !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());
1622return MessageID.IDS_ArrayAccess.Localize();
1626return MessageID.IDS_PointerElementAccess.Localize();
2504syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType))
3369MessageID.IDS_FeatureExceptionFilter.CheckFeatureAvailability(diagnostics, filter.WhenKeyword);
3567ConstructorDeclarationSyntax or DestructorDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedDeOrConstructor,
3568AccessorDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedAccessor,
3569BaseMethodDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedMethod,
3570IndexerDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedIndexer,
3571PropertyDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedProperty,
3575LocalFunctionStatementSyntax => (MessageID?)null,
3682MessageID.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);
2738internal static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, BindingDiagnosticBag diagnostics, Location? location = null)
2741internal static bool CheckFeatureAvailability(SyntaxToken syntax, MessageID feature, BindingDiagnosticBag diagnostics, bool forceWarning = false)
2744internal static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, BindingDiagnosticBag diagnostics, Location location)
2747private static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, DiagnosticBag? diagnostics, Location? location = null)
2750private static bool CheckFeatureAvailability(SyntaxToken syntax, MessageID feature, DiagnosticBag? diagnostics, bool forceWarning = false)
2753private static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, Location location)
2759private 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);
532CheckFeatureAvailability(foreachKeyword, MessageID.IDS_FeatureRefUnsafeInIteratorAsync, diagnostics);
877CheckFeatureAvailability(collectionExpr.Syntax, MessageID.IDS_FeatureInlineArrays, diagnostics);
1230CheckFeatureAvailability(expr.Syntax, MessageID.IDS_FeatureDisposalPattern, diagnostics);
1273CheckFeatureAvailability(syntax, MessageID.IDS_FeatureRefStructInterfaces, diagnostics);
1451MessageID patternName = isAsync ? MessageID.IDS_FeatureAsyncStreams : MessageID.IDS_Collection;
1487diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, patternType, MessageID.IDS_Collection.Localize(),
1558diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, collectionExpr.Type, MessageID.IDS_Collection.Localize(),
1717diagnostics.Add(ErrorCode.WRN_PatternBadSignature, collectionSyntax.Location, enumeratorType, MessageID.IDS_Collection.Localize(), patternMemberCandidate);
1780CheckFeatureAvailability(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());
1858AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Namespace1.Localize(), arg);
1872AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_Text.Localize(), arg);
1899AddDiagnostic(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 (193)
305private readonly MessageID _id;
307internal LocalizableErrorArgument(MessageID id)
327public static LocalizableErrorArgument Localize(this MessageID id)
338internal static string? RequiredFeature(this MessageID feature)
349this MessageID feature,
363this MessageID feature,
377this MessageID feature,
391this MessageID feature,
405this MessageID feature,
420this MessageID feature,
435this MessageID feature,
448internal static CSDiagnosticInfo? GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpParseOptions options)
451internal static CSDiagnosticInfo? GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpCompilation compilation)
454private static CSDiagnosticInfo GetDisabledFeatureDiagnosticInfo(MessageID feature, LanguageVersion availableVersion)
468internal static LanguageVersion RequiredVersion(this MessageID feature)
479case MessageID.IDS_FeatureFieldKeyword:
480case MessageID.IDS_FeatureFirstClassSpan:
481case MessageID.IDS_FeatureUnboundGenericTypesInNameof:
482case MessageID.IDS_FeatureSimpleLambdaParameterModifiers:
486case MessageID.IDS_FeatureStringEscapeCharacter: // lexer check
487case MessageID.IDS_FeatureImplicitIndexerInitializer:
488case MessageID.IDS_FeatureLockObject:
489case MessageID.IDS_FeatureParamsCollections:
490case MessageID.IDS_FeatureRefUnsafeInIteratorAsync:
491case MessageID.IDS_FeatureRefStructInterfaces:
492case MessageID.IDS_FeatureAllowsRefStructConstraint:
493case MessageID.IDS_FeaturePartialProperties:
494case MessageID.IDS_FeatureOverloadResolutionPriority:
498case MessageID.IDS_FeatureLambdaOptionalParameters: // semantic check
499case MessageID.IDS_FeatureLambdaParamsArray: // semantic check
500case MessageID.IDS_FeaturePrimaryConstructors: // declaration table check
501case MessageID.IDS_FeatureUsingTypeAlias: // semantic check
502case MessageID.IDS_FeatureInstanceMemberInNameof: // semantic check
503case MessageID.IDS_FeatureInlineArrays: // semantic check
504case MessageID.IDS_FeatureCollectionExpressions: // semantic check
505case MessageID.IDS_FeatureRefReadonlyParameters: // semantic check
509case MessageID.IDS_FeatureRawStringLiterals:
510case MessageID.IDS_FeatureStaticAbstractMembersInInterfaces: // semantic check
511case MessageID.IDS_FeatureNewLinesInInterpolations: // semantic check
512case MessageID.IDS_FeatureListPattern: // semantic check
513case MessageID.IDS_FeatureRequiredMembers: // semantic check
514case MessageID.IDS_FeatureCacheStaticMethodGroupConversion: // lowering check
515case MessageID.IDS_FeatureSpanCharConstantPattern:
516case MessageID.IDS_FeatureAutoDefaultStructs: // semantic check
517case MessageID.IDS_FeatureCheckedUserDefinedOperators: // semantic check for declarations, parsing check for doc comments
518case MessageID.IDS_FeatureUtf8StringLiterals: // semantic check
519case MessageID.IDS_FeatureUnsignedRightShift: // semantic check for declarations and consumption, parsing check for doc comments
520case MessageID.IDS_FeatureRelaxedShiftOperator: // semantic check
521case MessageID.IDS_FeatureRefFields: // semantic check
522case MessageID.IDS_FeatureFileTypes: // semantic check
523case MessageID.IDS_FeatureGenericAttributes: // semantic check
527case MessageID.IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction: // semantic check
528case MessageID.IDS_FeatureSealedToStringInRecord: // semantic check
529case MessageID.IDS_FeatureImprovedInterpolatedStrings: // semantic check
530case MessageID.IDS_FeatureRecordStructs:
531case MessageID.IDS_FeatureWithOnStructs: // semantic check
532case MessageID.IDS_FeatureWithOnAnonymousTypes: // semantic check
533case MessageID.IDS_FeaturePositionalFieldsInRecords: // semantic check
534case MessageID.IDS_FeatureGlobalUsing:
535case MessageID.IDS_FeatureInferredDelegateType: // semantic check
536case MessageID.IDS_FeatureLambdaAttributes: // semantic check
537case MessageID.IDS_FeatureExtendedPropertyPatterns: // semantic check
538case MessageID.IDS_FeatureLambdaReturnType: // semantic check
539case MessageID.IDS_AsyncMethodBuilderOverride: // semantic check
540case MessageID.IDS_FeatureConstantInterpolatedStrings: // semantic check
541case MessageID.IDS_FeatureImplicitImplementationOfNonPublicMembers: // semantic check
542case MessageID.IDS_FeatureFileScopedNamespace: // semantic check
543case MessageID.IDS_FeatureParameterlessStructConstructors: // semantic check
544case MessageID.IDS_FeatureStructFieldInitializers: // semantic check
548case MessageID.IDS_FeatureLambdaDiscardParameters: // semantic check
549case MessageID.IDS_FeatureFunctionPointers: // semantic check
550case MessageID.IDS_FeatureLocalFunctionAttributes: // syntax check
551case MessageID.IDS_FeatureExternLocalFunctions: // semantic check
552case MessageID.IDS_FeatureImplicitObjectCreation: // semantic check
553case MessageID.IDS_FeatureMemberNotNull:
554case MessageID.IDS_FeatureAndPattern: // semantic check
555case MessageID.IDS_FeatureNotPattern: // semantic check
556case MessageID.IDS_FeatureOrPattern: // semantic check
557case MessageID.IDS_FeatureParenthesizedPattern: // semantic check
558case MessageID.IDS_FeatureTypePattern: // semantic check
559case MessageID.IDS_FeatureRelationalPattern: // semantic check
560case MessageID.IDS_FeatureExtensionGetEnumerator: // semantic check
561case MessageID.IDS_FeatureExtensionGetAsyncEnumerator: // semantic check
562case MessageID.IDS_FeatureNativeInt:
563case MessageID.IDS_FeatureExtendedPartialMethods: // semantic check
564case MessageID.IDS_TopLevelStatements:
565case MessageID.IDS_FeatureInitOnlySetters: // semantic check
566case MessageID.IDS_FeatureRecords: // semantic check
567case MessageID.IDS_FeatureTargetTypedConditional: // semantic check
568case MessageID.IDS_FeatureCovariantReturnsForOverrides: // semantic check
569case MessageID.IDS_FeatureStaticAnonymousFunction: // semantic check
570case MessageID.IDS_FeatureModuleInitializers: // semantic check on method attribute
571case MessageID.IDS_FeatureDefaultTypeParameterConstraint: // semantic check
572case MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers: // semantic check
576case MessageID.IDS_FeatureAltInterpolatedVerbatimStrings: // semantic check
577case MessageID.IDS_FeatureCoalesceAssignmentExpression: // semantic check
578case MessageID.IDS_FeatureUnconstrainedTypeParameterInNullCoalescingOperator:
579case MessageID.IDS_FeatureNullableReferenceTypes: // syntax and semantic check
580case MessageID.IDS_FeatureIndexOperator: // semantic check
581case MessageID.IDS_FeatureRangeOperator: // semantic check
582case MessageID.IDS_FeatureAsyncStreams: // semantic check
583case MessageID.IDS_FeatureRecursivePatterns: // semantic check
584case MessageID.IDS_FeatureUsingDeclarations: // semantic check
585case MessageID.IDS_FeatureDisposalPattern: //semantic check
586case MessageID.IDS_FeatureStaticLocalFunctions: // semantic check
587case MessageID.IDS_FeatureNameShadowingInNestedFunctions:
588case MessageID.IDS_FeatureUnmanagedConstructedTypes: // semantic check
589case MessageID.IDS_FeatureObsoleteOnPropertyAccessor:
590case MessageID.IDS_FeatureReadOnlyMembers:
591case MessageID.IDS_DefaultInterfaceImplementation: // semantic check
592case MessageID.IDS_OverrideWithConstraints: // semantic check
593case MessageID.IDS_FeatureNestedStackalloc: // semantic check
594case MessageID.IDS_FeatureNotNullGenericTypeConstraint:// semantic check
595case MessageID.IDS_FeatureSwitchExpression:
596case MessageID.IDS_FeatureAsyncUsing:
597case MessageID.IDS_FeatureNullPointerConstantPattern: //semantic check
601case MessageID.IDS_FeatureAttributesOnBackingFields: // semantic check
602case MessageID.IDS_FeatureImprovedOverloadCandidates: // semantic check
603case MessageID.IDS_FeatureTupleEquality: // semantic check
604case MessageID.IDS_FeatureRefReassignment: // semantic check
605case MessageID.IDS_FeatureRefFor:
606case MessageID.IDS_FeatureRefForEach: // semantic check
607case MessageID.IDS_FeatureEnumGenericTypeConstraint: // semantic check
608case MessageID.IDS_FeatureDelegateGenericTypeConstraint: // semantic check
609case MessageID.IDS_FeatureUnmanagedGenericTypeConstraint: // semantic check
610case MessageID.IDS_FeatureStackAllocInitializer: // semantic check
611case MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers: // semantic check
612case MessageID.IDS_FeatureExtensibleFixedStatement: // semantic check
613case MessageID.IDS_FeatureIndexingMovableFixedBuffers: //semantic check
617case MessageID.IDS_FeatureNonTrailingNamedArguments: // semantic check
618case MessageID.IDS_FeatureLeadingDigitSeparator:
619case MessageID.IDS_FeaturePrivateProtected:
620case MessageID.IDS_FeatureReadOnlyReferences: // semantic check
621case MessageID.IDS_FeatureRefStructs: // semantic check
622case MessageID.IDS_FeatureReadOnlyStructs: // semantic check
623case MessageID.IDS_FeatureRefExtensionMethods:
624case MessageID.IDS_FeatureRefConditional:
628case MessageID.IDS_FeatureAsyncMain:
629case MessageID.IDS_FeatureDefaultLiteral: // semantic check
630case MessageID.IDS_FeatureInferredTupleNames:
631case MessageID.IDS_FeatureGenericPatternMatching:
635case MessageID.IDS_FeatureBinaryLiteral:
636case MessageID.IDS_FeatureDigitSeparator:
637case MessageID.IDS_FeatureLocalFunctions: // semantic check
638case MessageID.IDS_FeatureRefLocalsReturns:
639case MessageID.IDS_FeaturePatternMatching: // semantic check
640case MessageID.IDS_FeatureThrowExpression: // semantic check
641case MessageID.IDS_FeatureTuples:
642case MessageID.IDS_FeatureOutVar: // semantic check
643case MessageID.IDS_FeatureExpressionBodiedAccessor:
644case MessageID.IDS_FeatureExpressionBodiedDeOrConstructor:
645case MessageID.IDS_FeatureDiscards:
649case MessageID.IDS_FeatureExceptionFilter: // semantic check
650case MessageID.IDS_FeatureAutoPropertyInitializer: // semantic check
651case MessageID.IDS_FeatureNullPropagatingOperator: // semantic check
652case MessageID.IDS_FeatureExpressionBodiedMethod:
653case MessageID.IDS_FeatureExpressionBodiedProperty: // semantic check
654case MessageID.IDS_FeatureExpressionBodiedIndexer: // semantic check
655case MessageID.IDS_FeatureNameof:
656case MessageID.IDS_FeatureDictionaryInitializer: // semantic check
657case MessageID.IDS_FeatureUsingStatic: // semantic check
658case MessageID.IDS_FeatureInterpolatedStrings: // semantic check
659case MessageID.IDS_AwaitInCatchAndFinally:
660case MessageID.IDS_FeatureReadonlyAutoImplementedProperties:
664case MessageID.IDS_FeatureAsync: // semantic check
668case MessageID.IDS_FeatureDynamic: // Checked in the binder.
669case MessageID.IDS_FeatureTypeVariance: // semantic check
670case MessageID.IDS_FeatureNamedArgument: // semantic check
671case MessageID.IDS_FeatureOptionalParameter: // semantic check
675case MessageID.IDS_FeatureImplicitArray: // semantic check
676case MessageID.IDS_FeatureAnonymousTypes: // semantic check
677case MessageID.IDS_FeatureObjectInitializer:
678case MessageID.IDS_FeatureCollectionInitializer:
679case MessageID.IDS_FeatureLambda: // semantic check
680case MessageID.IDS_FeatureQueryExpression: // semantic check
681case MessageID.IDS_FeatureExtensionMethod:
682case MessageID.IDS_FeaturePartialMethod: // semantic check
683case MessageID.IDS_FeatureImplicitLocal: // Checked in the binder.
684case MessageID.IDS_FeatureAutoImplementedProperties:
688case MessageID.IDS_FeatureGenerics: // Also affects crefs.
689case MessageID.IDS_FeatureAnonDelegates: // semantic check
690case MessageID.IDS_FeatureGlobalNamespace: // Also affects crefs.
691case MessageID.IDS_FeatureFixedBuffer: // semantic check
692case MessageID.IDS_FeatureStaticClasses: // semantic check
693case MessageID.IDS_FeaturePartialTypes: // semantic check
694case MessageID.IDS_FeaturePropertyAccessorMods:
695case MessageID.IDS_FeatureExternAlias: // semantic check
696case MessageID.IDS_FeatureIterators: // semantic check
697case MessageID.IDS_FeatureDefault: // semantic check
698case MessageID.IDS_FeatureNullable:
699case MessageID.IDS_FeaturePragma: // Checked in the directive parser.
700case MessageID.IDS_FeatureSwitchOnBool: // Checked in the binder.
704case 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);
568Binder.CheckFeatureAvailability(modifier, MessageID.IDS_FeatureReadOnlyReferences, diagnostics);
572Binder.CheckFeatureAvailability(modifier, MessageID.IDS_FeatureRefExtensionMethods, diagnostics);
618Binder.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());
2171var methodKind = method1.MethodKind == MethodKind.Constructor ? MessageID.IDS_SK_CONSTRUCTOR : MessageID.IDS_SK_METHOD;
4200MessageID.IDS_FeatureParameterlessStructConstructors.CheckFeatureAvailability(diagnostics, m.DeclaringCompilation, location);
4229MessageID.IDS_FeatureStructFieldInitializers.CheckFeatureAvailability(diagnostics, symbol.DeclaringCompilation, symbol.GetFirstLocation());
4547if (baseToStringMethod.ContainingModule != this.ContainingModule && !this.DeclaringCompilation.IsFeatureEnabled(MessageID.IDS_FeatureSealedToStringInRecord))
4550var requiredVersion = MessageID.IDS_FeatureSealedToStringInRecord.RequiredVersion();
4573MessageID.IDS_FeatureSealedToStringInRecord.CheckFeatureAvailability(
4637Binder.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);
628MessageID.IDS_FeatureRefStructInterfaces.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
642MessageID.IDS_FeatureOverloadResolutionPriority.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
704MessageID.IDS_FeatureObsoleteOnPropertyAccessor.CheckFeatureAvailability(diagnostics, arguments.AttributeSyntaxOpt);
1425diagnostics.Add(ErrorCode.ERR_CannotUseManagedTypeInUnmanagedCallersOnly, syntax.Location, type, (isParam ? MessageID.IDS_Parameter : MessageID.IDS_Return).Localize());
1552MessageID.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()));