Binder\Binder.ValueChecks.cs (15)
736Error(diagnostics, ErrorCode.ERR_BadSKknown, node, ns.NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
741Error(diagnostics, ErrorCode.ERR_BadSKknown, node, type.Type, MessageID.IDS_SK_TYPE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
752Error(diagnostics, GetMethodGroupOrFunctionPointerLvalueError(valueKind), node, unconvertedAddressOf.Operand.Name, MessageID.IDS_AddressOfMethodGroup.Localize());
763Error(diagnostics, GetMethodGroupOrFunctionPointerLvalueError(valueKind), node, methodGroup.Name, MessageID.IDS_MethodGroup.Localize());
1017Error(diagnostics, ErrorCode.ERR_BadSKknown, expr.Syntax, ((BoundNamespaceExpression)expr).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
1020Error(diagnostics, ErrorCode.ERR_BadSKunknown, expr.Syntax, expr.Type, MessageID.IDS_SK_TYPE.Localize());
1035else if (this.IsDirectlyInIterator && Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync))
1772CheckFeatureAvailability(node, MessageID.IDS_FeatureInitOnlySetters, diagnostics);
3092MessageID cause;
3095cause = MessageID.IDS_FOREACHLOCAL;
3099cause = MessageID.IDS_USINGLOCAL;
3103cause = 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);
1512case ManagedKind.UnmanagedWithGenerics when MessageID.IDS_FeatureUnmanagedConstructedTypes.GetFeatureAvailabilityDiagnosticInfo(compilation) is CSDiagnosticInfo diagnosticInfo:
1530MessageID.IDS_FeatureDefault.CheckFeatureAvailability(diagnostics, node.Keyword);
1822CheckFeatureAvailability(node, MessageID.IDS_FeatureDiscards, diagnostics);
2262if (!IsInsideNameof || (EnclosingNameofArgument != node && !node.IsFeatureEnabled(MessageID.IDS_FeatureInstanceMemberInNameof)))
2296CheckFeatureAvailability(node, MessageID.IDS_FeatureInstanceMemberInNameof, diagnostics);
2556CheckFeatureAvailability(node, MessageID.IDS_FeatureIndexOperator, diagnostics);
2597CheckFeatureAvailability(node, MessageID.IDS_FeatureRangeOperator, diagnostics);
2778diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, MessageID.IDS_SK_METHOD.Localize(), targetType);
2952nameString = MessageID.IDS_Lambda.Localize().ToString();
3087MessageID.IDS_FeatureReadOnlyReferences.CheckFeatureAvailability(diagnostics, argumentSyntax.RefKindKeyword);
3092MessageID.IDS_FeatureOutVar.CheckFeatureAvailability(diagnostics, argumentSyntax.RefKindKeyword);
3170CheckFeatureAvailability(declarationExpression, MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers, diagnostics);
3248CheckFeatureAvailability(syntax, MessageID.IDS_FeatureRefUnsafeInIteratorAsync, diagnostics);
3288CheckFeatureAvailability(nameColonSyntax, MessageID.IDS_FeatureNamedArgument, diagnostics);
3335new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureNonTrailingNamedArguments.RequiredVersion()));
3407if (!Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters))
3414var available = CheckFeatureAvailability(argument.Syntax, MessageID.IDS_FeatureRefReadonlyParameters, diagnostics);
4060MessageID.IDS_FeatureImplicitArray.CheckFeatureAvailability(diagnostics, node.NewKeyword);
4525LanguageVersion requiredVersion = MessageID.IDS_FeatureNestedStackalloc.RequiredVersion();
4531MessageID.IDS_FeatureNestedStackalloc.CheckFeatureAvailability(diagnostics, node.GetFirstToken());
4550CheckFeatureAvailability(node, MessageID.IDS_FeatureRefStructs, diagnostics);
4613MessageID.IDS_FeatureStackAllocInitializer.CheckFeatureAvailability(diagnostics, stackAllocKeyword);
5113MessageID.IDS_FeatureImplicitObjectCreation.CheckFeatureAvailability(diagnostics, node.NewKeyword);
5200MessageID.IDS_FeatureCollectionExpressions.CheckFeatureAvailability(diagnostics, syntax, syntax.OpenBracketToken.GetLocation());
5625MessageID.IDS_FeatureObjectInitializer.CheckFeatureAvailability(diagnostics, initializerSyntax.OpenBraceToken);
5829MessageID.IDS_FeatureDictionaryInitializer.CheckFeatureAvailability(diagnostics, implicitIndexing.ArgumentList.OpenBracketToken);
5927MessageID.IDS_FeatureImplicitIndexerInitializer.CheckFeatureAvailability(diagnostics, implicitIndexer.Syntax);
6200MessageID.IDS_FeatureCollectionInitializer.CheckFeatureAvailability(diagnostics, initializerSyntax.OpenBraceToken);
6261CheckFeatureAvailability(node, MessageID.IDS_FeatureRefStructInterfaces, diagnostics);
7331MessageID.IDS_FeatureRawStringLiterals.CheckFeatureAvailability(diagnostics, node);
7344CheckFeatureAvailability(node, MessageID.IDS_FeatureRawStringLiterals, diagnostics);
7347CheckFeatureAvailability(node, MessageID.IDS_FeatureUtf8StringLiterals, diagnostics);
7644var msgId = ((UnboundLambda)boundLeft).MessageID;
7843CheckFeatureAvailability(boundLeft.Syntax, MessageID.IDS_FeatureStaticAbstractMembersInInterfaces, diagnostics);
7875Compilation.LanguageVersion < MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())
7904Error(diagnostics, ErrorCode.ERR_BadSKunknown, methodGroup.NameSyntax, method, MessageID.IDS_SK_METHOD.Localize());
8561CheckFeatureAvailability(node, MessageID.IDS_FeatureIndexingMovableFixedBuffers, diagnostics);
8607CheckFeatureAvailability(node, MessageID.IDS_FeatureRefFields, diagnostics);
8816else if (CheckFeatureAvailability(node, MessageID.IDS_FeatureInstanceMemberInNameof, diagnostics))
9186CheckFeatureAvailability(node, MessageID.IDS_FeatureInlineArrays, diagnostics);
9944_ = MessageID.IDS_FeatureIndexOperator.CheckFeatureAvailability(diagnostics, syntax);
10941MessageID.IDS_FeatureNullPropagatingOperator.CheckFeatureAvailability(diagnostics, node.OperatorToken);
11118var 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());
1607return MessageID.IDS_ArrayAccess.Localize();
1611return MessageID.IDS_PointerElementAccess.Localize();
2485syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType))
3348MessageID.IDS_FeatureExceptionFilter.CheckFeatureAvailability(diagnostics, filter.WhenKeyword);
3546ConstructorDeclarationSyntax or DestructorDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedDeOrConstructor,
3547AccessorDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedAccessor,
3548BaseMethodDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedMethod,
3549IndexerDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedIndexer,
3550PropertyDeclarationSyntax => MessageID.IDS_FeatureExpressionBodiedProperty,
3554LocalFunctionStatementSyntax => (MessageID?)null,
3661MessageID.IDS_TopLevelStatements.CheckFeatureAvailability(diagnostics, topLevelStatement);
Binder\Binder_Symbols.cs (23)
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)
1378Error(diagnostics, ErrorCode.ERR_BadArity, typeSyntax, type, MessageID.IDS_SK_TYPE.Localize(), typeArgumentsSyntax.Count);
1413Error(diagnostics, ErrorCode.ERR_BadArity, syntax, plainName, MessageID.IDS_MethodGroup.Localize(), typeArgumentsSyntax.Count);
1563bool includeNullability = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes);
2718internal static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, BindingDiagnosticBag diagnostics, Location? location = null)
2721internal static bool CheckFeatureAvailability(SyntaxToken syntax, MessageID feature, BindingDiagnosticBag diagnostics, bool forceWarning = false)
2724internal static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, BindingDiagnosticBag diagnostics, Location location)
2727private static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, DiagnosticBag? diagnostics, Location? location = null)
2730private static bool CheckFeatureAvailability(SyntaxToken syntax, MessageID feature, DiagnosticBag? diagnostics, bool forceWarning = false)
2733private static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, Location location)
2739private 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 (191)
303private readonly MessageID _id;
305internal LocalizableErrorArgument(MessageID id)
325public static LocalizableErrorArgument Localize(this MessageID id)
336internal static string? RequiredFeature(this MessageID feature)
347this MessageID feature,
361this MessageID feature,
375this MessageID feature,
389this MessageID feature,
403this MessageID feature,
418this MessageID feature,
433this MessageID feature,
446internal static CSDiagnosticInfo? GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpParseOptions options)
449internal static CSDiagnosticInfo? GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpCompilation compilation)
452private static CSDiagnosticInfo GetDisabledFeatureDiagnosticInfo(MessageID feature, LanguageVersion availableVersion)
466internal static LanguageVersion RequiredVersion(this MessageID feature)
477case MessageID.IDS_FeatureFieldKeyword:
478case MessageID.IDS_FeatureFirstClassSpan:
482case MessageID.IDS_FeatureStringEscapeCharacter: // lexer check
483case MessageID.IDS_FeatureImplicitIndexerInitializer:
484case MessageID.IDS_FeatureLockObject:
485case MessageID.IDS_FeatureParamsCollections:
486case MessageID.IDS_FeatureRefUnsafeInIteratorAsync:
487case MessageID.IDS_FeatureRefStructInterfaces:
488case MessageID.IDS_FeatureAllowsRefStructConstraint:
489case MessageID.IDS_FeaturePartialProperties:
490case MessageID.IDS_OverloadResolutionPriority:
494case MessageID.IDS_FeatureLambdaOptionalParameters: // semantic check
495case MessageID.IDS_FeatureLambdaParamsArray: // semantic check
496case MessageID.IDS_FeaturePrimaryConstructors: // declaration table check
497case MessageID.IDS_FeatureUsingTypeAlias: // semantic check
498case MessageID.IDS_FeatureInstanceMemberInNameof: // semantic check
499case MessageID.IDS_FeatureInlineArrays: // semantic check
500case MessageID.IDS_FeatureCollectionExpressions: // semantic check
501case MessageID.IDS_FeatureRefReadonlyParameters: // semantic check
505case MessageID.IDS_FeatureRawStringLiterals:
506case MessageID.IDS_FeatureStaticAbstractMembersInInterfaces: // semantic check
507case MessageID.IDS_FeatureNewLinesInInterpolations: // semantic check
508case MessageID.IDS_FeatureListPattern: // semantic check
509case MessageID.IDS_FeatureRequiredMembers: // semantic check
510case MessageID.IDS_FeatureCacheStaticMethodGroupConversion: // lowering check
511case MessageID.IDS_FeatureSpanCharConstantPattern:
512case MessageID.IDS_FeatureAutoDefaultStructs: // semantic check
513case MessageID.IDS_FeatureCheckedUserDefinedOperators: // semantic check for declarations, parsing check for doc comments
514case MessageID.IDS_FeatureUtf8StringLiterals: // semantic check
515case MessageID.IDS_FeatureUnsignedRightShift: // semantic check for declarations and consumption, parsing check for doc comments
516case MessageID.IDS_FeatureRelaxedShiftOperator: // semantic check
517case MessageID.IDS_FeatureRefFields: // semantic check
518case MessageID.IDS_FeatureFileTypes: // semantic check
519case MessageID.IDS_FeatureGenericAttributes: // semantic check
523case MessageID.IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction: // semantic check
524case MessageID.IDS_FeatureSealedToStringInRecord: // semantic check
525case MessageID.IDS_FeatureImprovedInterpolatedStrings: // semantic check
526case MessageID.IDS_FeatureRecordStructs:
527case MessageID.IDS_FeatureWithOnStructs: // semantic check
528case MessageID.IDS_FeatureWithOnAnonymousTypes: // semantic check
529case MessageID.IDS_FeaturePositionalFieldsInRecords: // semantic check
530case MessageID.IDS_FeatureGlobalUsing:
531case MessageID.IDS_FeatureInferredDelegateType: // semantic check
532case MessageID.IDS_FeatureLambdaAttributes: // semantic check
533case MessageID.IDS_FeatureExtendedPropertyPatterns: // semantic check
534case MessageID.IDS_FeatureLambdaReturnType: // semantic check
535case MessageID.IDS_AsyncMethodBuilderOverride: // semantic check
536case MessageID.IDS_FeatureConstantInterpolatedStrings: // semantic check
537case MessageID.IDS_FeatureImplicitImplementationOfNonPublicMembers: // semantic check
538case MessageID.IDS_FeatureFileScopedNamespace: // semantic check
539case MessageID.IDS_FeatureParameterlessStructConstructors: // semantic check
540case MessageID.IDS_FeatureStructFieldInitializers: // semantic check
544case MessageID.IDS_FeatureLambdaDiscardParameters: // semantic check
545case MessageID.IDS_FeatureFunctionPointers: // semantic check
546case MessageID.IDS_FeatureLocalFunctionAttributes: // syntax check
547case MessageID.IDS_FeatureExternLocalFunctions: // semantic check
548case MessageID.IDS_FeatureImplicitObjectCreation: // semantic check
549case MessageID.IDS_FeatureMemberNotNull:
550case MessageID.IDS_FeatureAndPattern: // semantic check
551case MessageID.IDS_FeatureNotPattern: // semantic check
552case MessageID.IDS_FeatureOrPattern: // semantic check
553case MessageID.IDS_FeatureParenthesizedPattern: // semantic check
554case MessageID.IDS_FeatureTypePattern: // semantic check
555case MessageID.IDS_FeatureRelationalPattern: // semantic check
556case MessageID.IDS_FeatureExtensionGetEnumerator: // semantic check
557case MessageID.IDS_FeatureExtensionGetAsyncEnumerator: // semantic check
558case MessageID.IDS_FeatureNativeInt:
559case MessageID.IDS_FeatureExtendedPartialMethods: // semantic check
560case MessageID.IDS_TopLevelStatements:
561case MessageID.IDS_FeatureInitOnlySetters: // semantic check
562case MessageID.IDS_FeatureRecords: // semantic check
563case MessageID.IDS_FeatureTargetTypedConditional: // semantic check
564case MessageID.IDS_FeatureCovariantReturnsForOverrides: // semantic check
565case MessageID.IDS_FeatureStaticAnonymousFunction: // semantic check
566case MessageID.IDS_FeatureModuleInitializers: // semantic check on method attribute
567case MessageID.IDS_FeatureDefaultTypeParameterConstraint: // semantic check
568case MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers: // semantic check
572case MessageID.IDS_FeatureAltInterpolatedVerbatimStrings: // semantic check
573case MessageID.IDS_FeatureCoalesceAssignmentExpression: // semantic check
574case MessageID.IDS_FeatureUnconstrainedTypeParameterInNullCoalescingOperator:
575case MessageID.IDS_FeatureNullableReferenceTypes: // syntax and semantic check
576case MessageID.IDS_FeatureIndexOperator: // semantic check
577case MessageID.IDS_FeatureRangeOperator: // semantic check
578case MessageID.IDS_FeatureAsyncStreams: // semantic check
579case MessageID.IDS_FeatureRecursivePatterns: // semantic check
580case MessageID.IDS_FeatureUsingDeclarations: // semantic check
581case MessageID.IDS_FeatureDisposalPattern: //semantic check
582case MessageID.IDS_FeatureStaticLocalFunctions: // semantic check
583case MessageID.IDS_FeatureNameShadowingInNestedFunctions:
584case MessageID.IDS_FeatureUnmanagedConstructedTypes: // semantic check
585case MessageID.IDS_FeatureObsoleteOnPropertyAccessor:
586case MessageID.IDS_FeatureReadOnlyMembers:
587case MessageID.IDS_DefaultInterfaceImplementation: // semantic check
588case MessageID.IDS_OverrideWithConstraints: // semantic check
589case MessageID.IDS_FeatureNestedStackalloc: // semantic check
590case MessageID.IDS_FeatureNotNullGenericTypeConstraint:// semantic check
591case MessageID.IDS_FeatureSwitchExpression:
592case MessageID.IDS_FeatureAsyncUsing:
593case MessageID.IDS_FeatureNullPointerConstantPattern: //semantic check
597case MessageID.IDS_FeatureAttributesOnBackingFields: // semantic check
598case MessageID.IDS_FeatureImprovedOverloadCandidates: // semantic check
599case MessageID.IDS_FeatureTupleEquality: // semantic check
600case MessageID.IDS_FeatureRefReassignment: // semantic check
601case MessageID.IDS_FeatureRefFor:
602case MessageID.IDS_FeatureRefForEach: // semantic check
603case MessageID.IDS_FeatureEnumGenericTypeConstraint: // semantic check
604case MessageID.IDS_FeatureDelegateGenericTypeConstraint: // semantic check
605case MessageID.IDS_FeatureUnmanagedGenericTypeConstraint: // semantic check
606case MessageID.IDS_FeatureStackAllocInitializer: // semantic check
607case MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers: // semantic check
608case MessageID.IDS_FeatureExtensibleFixedStatement: // semantic check
609case MessageID.IDS_FeatureIndexingMovableFixedBuffers: //semantic check
613case MessageID.IDS_FeatureNonTrailingNamedArguments: // semantic check
614case MessageID.IDS_FeatureLeadingDigitSeparator:
615case MessageID.IDS_FeaturePrivateProtected:
616case MessageID.IDS_FeatureReadOnlyReferences: // semantic check
617case MessageID.IDS_FeatureRefStructs: // semantic check
618case MessageID.IDS_FeatureReadOnlyStructs: // semantic check
619case MessageID.IDS_FeatureRefExtensionMethods:
620case MessageID.IDS_FeatureRefConditional:
624case MessageID.IDS_FeatureAsyncMain:
625case MessageID.IDS_FeatureDefaultLiteral: // semantic check
626case MessageID.IDS_FeatureInferredTupleNames:
627case MessageID.IDS_FeatureGenericPatternMatching:
631case MessageID.IDS_FeatureBinaryLiteral:
632case MessageID.IDS_FeatureDigitSeparator:
633case MessageID.IDS_FeatureLocalFunctions: // semantic check
634case MessageID.IDS_FeatureRefLocalsReturns:
635case MessageID.IDS_FeaturePatternMatching: // semantic check
636case MessageID.IDS_FeatureThrowExpression: // semantic check
637case MessageID.IDS_FeatureTuples:
638case MessageID.IDS_FeatureOutVar: // semantic check
639case MessageID.IDS_FeatureExpressionBodiedAccessor:
640case MessageID.IDS_FeatureExpressionBodiedDeOrConstructor:
641case MessageID.IDS_FeatureDiscards:
645case MessageID.IDS_FeatureExceptionFilter: // semantic check
646case MessageID.IDS_FeatureAutoPropertyInitializer: // semantic check
647case MessageID.IDS_FeatureNullPropagatingOperator: // semantic check
648case MessageID.IDS_FeatureExpressionBodiedMethod:
649case MessageID.IDS_FeatureExpressionBodiedProperty: // semantic check
650case MessageID.IDS_FeatureExpressionBodiedIndexer: // semantic check
651case MessageID.IDS_FeatureNameof:
652case MessageID.IDS_FeatureDictionaryInitializer: // semantic check
653case MessageID.IDS_FeatureUsingStatic: // semantic check
654case MessageID.IDS_FeatureInterpolatedStrings: // semantic check
655case MessageID.IDS_AwaitInCatchAndFinally:
656case MessageID.IDS_FeatureReadonlyAutoImplementedProperties:
660case MessageID.IDS_FeatureAsync: // semantic check
664case MessageID.IDS_FeatureDynamic: // Checked in the binder.
665case MessageID.IDS_FeatureTypeVariance: // semantic check
666case MessageID.IDS_FeatureNamedArgument: // semantic check
667case MessageID.IDS_FeatureOptionalParameter: // semantic check
671case MessageID.IDS_FeatureImplicitArray: // semantic check
672case MessageID.IDS_FeatureAnonymousTypes: // semantic check
673case MessageID.IDS_FeatureObjectInitializer:
674case MessageID.IDS_FeatureCollectionInitializer:
675case MessageID.IDS_FeatureLambda: // semantic check
676case MessageID.IDS_FeatureQueryExpression: // semantic check
677case MessageID.IDS_FeatureExtensionMethod:
678case MessageID.IDS_FeaturePartialMethod: // semantic check
679case MessageID.IDS_FeatureImplicitLocal: // Checked in the binder.
680case MessageID.IDS_FeatureAutoImplementedProperties:
684case MessageID.IDS_FeatureGenerics: // Also affects crefs.
685case MessageID.IDS_FeatureAnonDelegates: // semantic check
686case MessageID.IDS_FeatureGlobalNamespace: // Also affects crefs.
687case MessageID.IDS_FeatureFixedBuffer: // semantic check
688case MessageID.IDS_FeatureStaticClasses: // semantic check
689case MessageID.IDS_FeaturePartialTypes: // semantic check
690case MessageID.IDS_FeaturePropertyAccessorMods:
691case MessageID.IDS_FeatureExternAlias: // semantic check
692case MessageID.IDS_FeatureIterators: // semantic check
693case MessageID.IDS_FeatureDefault: // semantic check
694case MessageID.IDS_FeatureNullable:
695case MessageID.IDS_FeaturePragma: // Checked in the directive parser.
696case MessageID.IDS_FeatureSwitchOnBool: // Checked in the binder.
700case 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()));