3 writes to Compilation
Microsoft.CodeAnalysis.CSharp (3)
Binder\Binder.cs (3)
35
this.
Compilation
= compilation;
43
this.
Compilation
= next.Compilation;
56
this.
Compilation
= next.Compilation;
366 references to Compilation
Microsoft.CodeAnalysis.CSharp (366)
Binder\Binder.cs (8)
43
this.Compilation = next.
Compilation
;
56
this.Compilation = next.
Compilation
;
138
return result == OverflowChecks.Enabled || result == OverflowChecks.Implicit &&
Compilation
.Options.CheckOverflow;
160
internal bool UseUpdatedEscapeRules =>
Compilation
.SourceModule.UseUpdatedEscapeRules;
265
!csTree.IsGeneratedCode(this.
Compilation
.Options.SyntaxTreeOptionsProvider, CancellationToken.None),
284
switch (
Compilation
.Options.NullableContextOptions)
295
throw ExceptionUtilities.UnexpectedValue(
Compilation
.Options.NullableContextOptions);
854
return new CompoundUseSiteInfo<AssemblySymbol>(futureDestination,
Compilation
.Assembly);
Binder\Binder.IdentifierUsedAsValueFinder.cs (1)
183
enclosingBinder.
Compilation
,
Binder\Binder.ValueChecks.cs (5)
912
var getItemOrSliceHelper = (MethodSymbol)
Compilation
.GetWellKnownTypeMember(elementAccess.GetItemOrSliceHelper);
991
Compilation
.GetWellKnownType(WellKnownType.System_Range),
1038
else if (this.IsDirectlyInIterator &&
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync))
1453
(
Compilation
.FeatureStrictEnabled
1780
if (setMethod.DeclaringCompilation != this.
Compilation
)
Binder\Binder.WithQueryLambdaParametersBinder.cs (1)
90
new ExtendedErrorTypeSymbol(this.
Compilation
, "", 0, info));
Binder\Binder_AnonymousTypes.cs (1)
105
AnonymousTypeManager manager = this.
Compilation
.AnonymousTypeManager;
Binder\Binder_Attributes.cs (9)
296
return new SourceAttributeData(
Compilation
, (AttributeSyntax)boundAttribute.Syntax, attributeType, attributeConstructor, hasErrors);
334
Compilation
,
403
if (!paramType.Type.IsValidAttributeParameterType(
Compilation
))
539
if (setMethod.IsInitOnly && setMethod.DeclaringCompilation != this.
Compilation
)
669
if (!namedArgumentType.IsValidAttributeParameterType(
Compilation
))
840
var typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.
Compilation
);
877
var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.
Compilation
);
927
var typedConstantKind = operandType.GetAttributeParameterTypedConstantKind(_binder.
Compilation
);
982
var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.
Compilation
);
Binder\Binder_Await.cs (1)
40
TypeSymbol awaitExpressionType = info.GetResult?.ReturnType ?? (hasErrors ? CreateErrorType() :
Compilation
.DynamicType);
Binder\Binder_Constraints.cs (1)
322
if (!
Compilation
.Assembly.RuntimeSupportsByRefLikeGenerics)
Binder\Binder_Conversions.cs (24)
419
if (
Compilation
.SourceModule != method.ContainingModule)
423
if (!
Compilation
.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces)
431
Compilation
.SourceModule != method.ContainingModule)
439
if (!
Compilation
.Assembly.RuntimeSupportsInlineArrayTypes)
453
if (destination.OriginalDefinition.Equals(
Compilation
.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions))
468
Debug.Assert(destination.OriginalDefinition.Equals(
Compilation
.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions));
539
.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(
Compilation
, Conversions, includeNullability: false, syntax.Location, diagnostics));
547
TryFindAsSpanCharMethod(
Compilation
, destination),
709
Debug.Assert(destination.Equals(
Compilation
.GetWellKnownType(WellKnownType.System_IFormattable), TypeCompareKind.ConsiderEverything) ||
710
destination.Equals(
Compilation
.GetWellKnownType(WellKnownType.System_FormattableString), TypeCompareKind.ConsiderEverything));
829
if (LocalRewriter.IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType,
Compilation
))
870
if (targetType.OriginalDefinition.Equals(
Compilation
.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T), TypeCompareKind.ConsiderEverything))
1062
Debug.Assert(parameterType.OriginalDefinition.Equals(
Compilation
.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions));
1067
new ConstraintsHelper.CheckConstraintsArgs(
Compilation
, Conversions, syntax.Location, diagnostics));
1257
var elementPlaceholder = new BoundValuePlaceholder(syntax,
Compilation
.DynamicType) { WasCompilerGenerated = true };
1487
member, receiverType, addMethodBinder.
Compilation
, ref useSiteInfo, out wasFullyInferred);
1764
var collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(
Compilation
, targetType, out TypeWithAnnotations elementTypeWithAnnotations);
1823
GenerateImplicitConversionError(diagnostics, this.
Compilation
, spreadElement.Expression.Syntax, elementConversion, enumeratorInfo.ElementType, elementType);
1869
var readOnlySpanType =
Compilation
.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T);
1965
if (targetTyped && !destination.IsErrorType() && !
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureTargetTypedConditional))
1970
Compilation
.LanguageVersion.ToDisplayString(),
2194
delegateType =
Compilation
.GetWellKnownType(WellKnownType.System_Linq_Expressions_Expression_T).Construct(delegateType);
2430
stackAllocType =
Compilation
.GetWellKnownType(WellKnownType.System_Span_T).Construct(elementType);
2646
return !methodSymbol.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.
Compilation
, this.Conversions, includeNullability: false, node.Location, diagnostics));
Binder\Binder_Crefs.cs (2)
1149
Debug.Assert(!this.
Compilation
.ContainsSyntaxTree(typeSyntax.SyntaxTree) ||
1150
this.
Compilation
.GetBinderFactory(typeSyntax.SyntaxTree).GetBinder(typeSyntax).Flags ==
Binder\Binder_Deconstruct.cs (6)
46
.CheckFeatureAvailability(diagnostics,
Compilation
, node.Location);
55
.CheckFeatureAvailability(diagnostics,
Compilation
, node.Location);
329
GenerateImplicitConversionError(diagnostics,
Compilation
, single.Syntax, nestedConversion, tupleOrDeconstructedTypes[i], single.Type);
537
compilation:
Compilation
,
580
bool disallowInferredNames = this.
Compilation
.LanguageVersion.DisallowInferredTupleElementNames();
585
tupleNames, this.
Compilation
,
Binder\Binder_Expressions.cs (62)
232
return new ExtendedErrorTypeSymbol(this.
Compilation
, name, arity: 0, errorInfo: null, unreported: false);
324
SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.
Compilation
, trueSymbol, falseSymbol);
981
bool disallowInferredNames = this.
Compilation
.LanguageVersion.DisallowInferredTupleElementNames();
990
Compilation
,
1069
bool disallowInferredNames = this.
Compilation
.LanguageVersion.DisallowInferredTupleElementNames();
1072
this.
Compilation
, syntax: node, diagnostics: diagnostics, shouldCheckConstraints: true,
1077
NamedTypeSymbol.VerifyTupleTypePresent(elements.Length, node, this.
Compilation
, diagnostics);
1227
TypeSymbol typedReferenceType = this.
Compilation
.GetSpecialType(SpecialType.System_TypedReference);
1275
TypeSymbol typedReferenceType = this.
Compilation
.GetSpecialType(SpecialType.System_TypedReference);
1436
bool typeHasErrors = type.IsErrorType() || CheckManagedAddr(
Compilation
, type, node.Location, diagnostics);
1452
diagnostics.Add(ErrorCode.WRN_FieldIsAmbiguous, node,
Compilation
.LanguageVersion.ToDisplayString());
1516
if (
Compilation
.LanguageVersion >= requiredVersion)
2008
this.
Compilation
, name: "var", arity: 0, errorInfo: null, variableUsedBeforeDeclaration: true);
2071
this.
Compilation
, name: "var", arity: 0, errorInfo: null, variableUsedBeforeDeclaration: true);
2087
this.
Compilation
, name: "var", arity: 0, errorInfo: null, variableUsedBeforeDeclaration: true);
2380
TypeSymbol hostObjectType =
Compilation
.GetHostObjectTypeSymbol();
2814
SymbolDistinguisher distinguisher1 = new SymbolDistinguisher(this.
Compilation
, operand.Type, targetType);
2889
SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.
Compilation
, operand.Type, targetType);
3063
if (
Compilation
.FeatureStrictEnabled || !isDelegateCreation)
3383
if (!hadLangVersionError && !
Compilation
.LanguageVersion.AllowNonTrailingNamedArguments())
3898
if (!
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters))
4140
var arrayType = ArrayTypeSymbol.CreateCSharpArray(
Compilation
.Assembly, TypeWithAnnotations.Create(bestType), rank);
4162
CheckManagedAddr(
Compilation
, bestType, node.Location, diagnostics, errorForManaged: true);
4374
this.
Compilation
.CreateArrayTypeSymbol(GetSpecialType(SpecialType.System_Object, diagnostics, node)),
4520
hasErrors = hasErrors || CheckManagedAddr(
Compilation
, elementType.Type, elementTypeSyntax.Location, diagnostics, errorForManaged: true);
4582
if (requiredVersion >
Compilation
.LanguageVersion)
6315
initializerType.ContainingModule !=
Compilation
.SourceModule)
6661
Debug.Assert((object)this.
Compilation
.Assembly != null);
6662
return IsSymbolAccessibleConditional(constructor, this.
Compilation
.Assembly, ref useSiteInfo);
7009
SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.
Compilation
, coClassType, interfaceType);
7629
type:
Compilation
.DynamicType,
7945
Compilation
.LanguageVersion < MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())
8257
TypeSymbol.Equals(namedType,
Compilation
.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncAction), TypeCompareKind.ConsiderEverything2) ||
8258
TypeSymbol.Equals(namedType,
Compilation
.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncActionWithProgress_T), TypeCompareKind.ConsiderEverything2) ||
8259
TypeSymbol.Equals(namedType,
Compilation
.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncOperation_T), TypeCompareKind.ConsiderEverything2) ||
8260
TypeSymbol.Equals(namedType,
Compilation
.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncOperationWithProgress_T2), TypeCompareKind.ConsiderEverything2);
8733
&& (object)method.ReduceExtensionMethod(receiverType, binder.
Compilation
) == null)
8738
&& SourceNamedTypeSymbol.GetCompatibleSubstitutedMember(binder.
Compilation
, method, receiverType) == null)
8993
if ((object)
Compilation
.SourceModule != fieldSymbol.OriginalDefinition.ContainingModule &&
8997
if (!
Compilation
.Assembly.RuntimeSupportsByRefFields)
9099
if (!
Compilation
.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces &&
Compilation
.SourceModule != symbol.ContainingModule)
9111
else if (!
Compilation
.Assembly.RuntimeSupportsDefaultInterfaceImplementation &&
Compilation
.SourceModule != symbol.ContainingModule)
9570
if (!
Compilation
.Assembly.RuntimeSupportsInlineArrayTypes)
9583
resultType =
Compilation
.GetWellKnownType(
9606
int? constIndex = InferConstantIndexFromSystemIndex(
Compilation
, convertedIndex, length, out location);
10294
TypeSymbol.Equals(argType,
Compilation
.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.ConsiderEverything) ? ThreeState.True :
10295
TypeSymbol.Equals(argType,
Compilation
.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything) ? ThreeState.False :
10427
var intPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax,
Compilation
.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true };
10498
var startArgumentPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax,
Compilation
.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true };
10499
var lengthArgumentPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax,
Compilation
.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true };
10904
if (m.ReduceExtensionMethod(receiver.Type,
Compilation
) is { } reduced)
10993
if (
Compilation
.LanguageVersion < LanguageVersion.CSharp13)
11100
var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type,
Compilation
, checkFullyInferred: true);
11168
new ConstraintsHelper.CheckConstraintsArgs(this.
Compilation
, this.Conversions, includeNullability: false, location: NoLocation.Singleton, diagnostics: null),
11240
var delegateType =
Compilation
.GetWellKnownType(wkDelegateType);
11245
if (checkConstraints(
Compilation
, Conversions, delegateType, typeArguments))
11271
return
Compilation
.AnonymousTypeManager.ConstructAnonymousDelegateSymbol(typeDescr);
11410
resultIsUsed = (((SimpleLambdaExpressionSyntax)parent).Body != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda,
Compilation
);
11414
resultIsUsed = (((ParenthesizedLambdaExpressionSyntax)parent).Body != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda,
Compilation
);
11418
resultIsUsed = (((ArrowExpressionClauseSyntax)parent).Expression != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda,
Compilation
);
Binder\Binder_Flags.cs (1)
100
var withoutUnsafe = isIteratorBody && this.
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync);
Binder\Binder_Initializers.cs (1)
254
if (binder.
Compilation
.IsSubmission)
Binder\Binder_InterpolatedString.cs (9)
32
if (startText.StartsWith("@$\"") && !
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureAltInterpolatedVerbatimStrings))
53
var newLinesInInterpolationsAllowed = this.
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureNewLinesInInterpolations);
85
this.
Compilation
.LanguageVersion.ToDisplayString(),
284
var interpolatedStringHandlerType =
Compilation
.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_DefaultInterpolatedStringHandler);
400
value = GenerateConversionForAssignment(
Compilation
.ObjectType, value, diagnostics);
450
var interpolatedStringHandlerType =
Compilation
.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_DefaultInterpolatedStringHandler);
664
else if (!
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureImprovedInterpolatedStrings) && diagnostics.AccumulatesDiagnostics)
998
var expected = builderPatternExpectsBool == true ?
Compilation
.GetSpecialType(SpecialType.System_Boolean) :
Compilation
.GetSpecialType(SpecialType.System_Void);
Binder\Binder_Invocation.cs (18)
386
CheckRestrictedTypeReceiver(result, this.
Compilation
, diagnostics);
493
type:
Compilation
.DynamicType,
505
if (!
Compilation
.LanguageVersion.AllowNonTrailingNamedArguments())
1015
(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.
Compilation
, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics))))
1451
if (GetWellKnownTypeMember(
Compilation
, WellKnownMember.System_Runtime_InteropServices_UnknownWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1460
if (GetWellKnownTypeMember(
Compilation
, WellKnownMember.System_Runtime_InteropServices_DispatchWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol)
1469
if (GetWellKnownTypeMember(
Compilation
, WellKnownMember.System_Type__Missing, diagnostics, syntax: syntax) is FieldSymbol fieldSymbol)
1686
defaultValue = new BoundLiteral(syntax, ConstantValue.Create(line),
Compilation
.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true };
1690
string path = callerSourceLocation.SourceTree.GetDisplayPath(callerSourceLocation.SourceSpan,
Compilation
.Options.SourceReferenceResolver);
1691
defaultValue = new BoundLiteral(syntax, ConstantValue.Create(path),
Compilation
.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1696
defaultValue = new BoundLiteral(syntax, ConstantValue.Create(memberName),
Compilation
.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1700
&& Conversions.ClassifyBuiltInConversion(
Compilation
.GetSpecialType(SpecialType.System_String), parameterType, isChecked: false, ref discardedUseSiteInfo).Exists
1705
defaultValue = new BoundLiteral(syntax, ConstantValue.Create(argument.Syntax.ToString()),
Compilation
.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true };
1727
TypeSymbol constantType =
Compilation
.GetSpecialType(defaultConstantValue.SpecialType);
1793
if (
Compilation
.SourceModule != paramsParameter.ContainingModule)
2013
var returnType = GetCommonTypeOrReturnType(methods) ?? new ExtendedErrorTypeSymbol(this.
Compilation
, string.Empty, arity: 0, errorInfo: null);
2254
TypeSymbol returnType = new ExtendedErrorTypeSymbol(this.
Compilation
, string.Empty, arity: 0, errorInfo: null);
2349
return new BoundNameOfOperator(node, boundArgument, ConstantValue.Create(name),
Compilation
.GetSpecialType(SpecialType.System_String));
Binder\Binder_Lambda.cs (3)
195
ReportUseSiteDiagnosticForSynthesizedAttribute(
Compilation
,
374
bool allowShadowingNames = binder.
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions);
394
binder.
Compilation
,
Binder\Binder_Lookup.cs (28)
336
bool isSubmissionTree =
Compilation
.IsSubmissionSyntaxTree(declarationSyntax.SyntaxTree);
339
for (CSharpCompilation submission =
Compilation
; submission != null; submission = submission.PreviousSubmission)
343
var isCurrentSubmission = submission ==
Compilation
;
357
submissionImports = ((SourceNamespaceSymbol)
Compilation
.SourceModule.GlobalNamespace).GetImports(declarationSyntax, basesBeingResolved);
391
submissionImports = Imports.ExpandPreviousSubmissionImports(submissionImports,
Compilation
);
467
Compilation
.MarkImportDirectiveAsUsed(directive);
789
if (
Compilation
.IsEqualOrDerivedFromWellKnownClass(namedType, WellKnownType.System_Attribute, ref useSiteInfo))
928
var error = new ExtendedErrorTypeSymbol(this.
Compilation
, name, arity, diagInfo, unreported: true);
940
currentType = currentType.GetNextBaseTypeNoUseSiteDiagnostics(basesBeingResolved, this.
Compilation
, ref visited);
1047
idictSymbol =
Compilation
.GetWellKnownType(WellKnownType.System_Collections_Generic_IDictionary_KV);
1048
iroDictSymbol =
Compilation
.GetWellKnownType(WellKnownType.System_Collections_Generic_IReadOnlyDictionary_KV);
1049
iListSymbol =
Compilation
.GetWellKnownType(WellKnownType.System_Collections_IList);
1050
iCollectionSymbol =
Compilation
.GetWellKnownType(WellKnownType.System_Collections_ICollection);
1051
inccSymbol =
Compilation
.GetWellKnownType(WellKnownType.System_Collections_Specialized_INotifyCollectionChanged);
1052
inpcSymbol =
Compilation
.GetWellKnownType(WellKnownType.System_ComponentModel_INotifyPropertyChanged);
1249
this.LookupMembersInClass(tmp, this.
Compilation
.GetSpecialType(SpecialType.System_Object), name, arity, basesBeingResolved, options, originalBinder, type, diagnose, ref useSiteInfo);
1341
if (!IsDerivedType(baseType: hiddenContainer, derivedType: hidingSym.ContainingType, basesBeingResolved, this.
Compilation
, useSiteInfo: ref useSiteInfo) &&
1438
if ((object)symbol.DeclaringCompilation != this.
Compilation
1499
else if (!this.
Compilation
.SourceModule.Equals(unwrappedSymbol.ContainingModule) && unwrappedSymbol.IsHiddenByCodeAnalysisEmbeddedAttribute())
1554
diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_FriendRefNotEqualToThis, unwrappedSymbol.ContainingAssembly.Identity.ToString(), AssemblyIdentity.PublicKeyToString(this.
Compilation
.Assembly.PublicKey));
1602
var assemblyName = this.
Compilation
.AssemblyName;
1613
ImmutableArray<byte> publicKey = this.
Compilation
.Assembly.PublicKey;
1739
return !IsEffectivelyPrivate(symbol) || symbol.ContainingAssembly == this.
Compilation
.Assembly;
1983
for (CSharpCompilation submission =
Compilation
; submission != null; submission = submission.PreviousSubmission)
1990
bool isCurrentSubmission = submission ==
Compilation
;
1998
submissionImports = Imports.ExpandPreviousSubmissionImports(submissionImports,
Compilation
);
2104
type = type.GetNextBaseTypeNoUseSiteDiagnostics(null, this.
Compilation
, ref visited);
2121
this.AddMemberLookupSymbolsInfoInClass(result,
Compilation
.GetSpecialType(SpecialType.System_Object), options, originalBinder, accessThroughType);
Binder\Binder_NameConflicts.cs (1)
121
bool allowShadowing =
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions);
Binder\Binder_Operators.cs (16)
69
var finalDynamicConversion = this.
Compilation
.Conversions.ClassifyConversionFromExpression(placeholder, left.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo);
82
Compilation
.DynamicType),
473
if (
Compilation
.SourceModule != method.ContainingModule)
685
if (!eventSymbol.OriginalDefinition.IsFromCompilation(this.
Compilation
))
812
type:
Compilation
.DynamicType,
1329
return type is NamedTypeSymbol namedType &&
Compilation
.IsReadOnlySpanType(namedType) &&
1549
var booleanType =
Compilation
.GetSpecialType(SpecialType.System_Boolean);
2103
operatorMethod.ContainingModule !=
Compilation
.SourceModule)
3400
if (
Compilation
.SourceModule != method.ContainingModule)
3782
if (
Compilation
.SourceModule != methodOpt.ContainingModule)
3786
if (!
Compilation
.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces)
3810
if (
Compilation
.SourceModule != methodOpt.ContainingModule)
3932
hasErrors = CheckManagedAddr(
Compilation
, operandType, managedKind, node.Location, diagnostics);
5218
bool hasErrors = ReportAsOperatorConversionDiagnostics(node, diagnostics, this.
Compilation
, operandType, targetType, conversion.Kind, operand.ConstantValueOpt);
5828
if (
Compilation
.Assembly.RuntimeSupportsNumericIntPtr)
5844
if (
Compilation
.Assembly.RuntimeSupportsNumericIntPtr)
Binder\Binder_Patterns.cs (17)
60
this.
Compilation
, pattern.Syntax, expression, innerPattern, whenTrueLabel: whenTrueLabel, whenFalseLabel: whenFalseLabel, diagnostics);
364
hasErrors |= !TryGetSpecialTypeMember(
Compilation
, SpecialMember.System_Array__Length, node, diagnostics, out PropertySymbol lengthProperty);
633
if (
Compilation
.LanguageVersion < requiredVersion && !patternExpressionConversion.IsImplicit)
655
if (MessageID.IDS_FeatureSpanCharConstantPattern.CheckFeatureAvailability(diagnostics,
Compilation
, node.Location))
775
if (requiredVersion >
Compilation
.LanguageVersion)
779
Compilation
.LanguageVersion.ToDisplayString(),
1115
var objectType =
Compilation
.GetSpecialType(SpecialType.System_Object);
1142
var objectType =
Compilation
.GetSpecialType(SpecialType.System_Object);
1247
if (
Compilation
.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion())
1252
iTupleType =
Compilation
.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_ITuple);
1261
if (declType != (object)
Compilation
.GetSpecialType(SpecialType.System_Object) &&
1262
declType != (object)
Compilation
.DynamicType &&
1270
iTupleGetLength = (MethodSymbol?)
Compilation
.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Length);
1271
iTupleGetItem = (MethodSymbol?)
Compilation
.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Item);
1288
var result =
Compilation
.Conversions.ClassifyBuiltInConversion(type, possibleBaseInterface, isChecked: CheckOverflowAtRuntime, ref useSiteInfo).IsImplicit;
1325
|| (inputType.IsPointerType() &&
Compilation
.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion()))
1358
var declType = TypeWithState.ForType(inputType).ToTypeWithAnnotations(
Compilation
);
Binder\Binder_Query.cs (1)
813
AnonymousTypeManager manager = this.
Compilation
.AnonymousTypeManager;
Binder\Binder_QueryErrors.cs (4)
89
var ienumerable_t =
Compilation
.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T);
90
var iqueryable_t =
Compilation
.GetWellKnownType(WellKnownType.System_Linq_IQueryable_T);
127
var ienumerable =
Compilation
.GetSpecialType(SpecialType.System_Collections_IEnumerable);
128
var iqueryable =
Compilation
.GetWellKnownType(WellKnownType.System_Linq_IQueryable);
Binder\Binder_Statements.cs (19)
174
if (!this.
Compilation
.Options.AllowUnsafe)
270
else if (InUnsafeRegion &&
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync))
396
if (
Compilation
.LanguageVersion < MessageID.IDS_FeatureSwitchExpression.RequiredVersion())
413
if ((object)type == null || !type.IsErrorType() && !
Compilation
.IsExceptionType(type.EffectiveType(ref useSiteInfo), ref useSiteInfo))
641
return method.ReturnsVoid || method.IsIterator || method.IsAsyncEffectivelyReturningTask(this.
Compilation
);
1310
if (CheckManagedAddr(
Compilation
, elementType, initializerSyntax.Location, diagnostics))
1375
GenerateImplicitConversionError(diagnostics, this.
Compilation
, initializerSyntax, elementConversionClassification, pointerType, declType);
2032
var reason = Conversions.IsAnonymousFunctionCompatibleWithType(anonymousFunction, targetType, this.
Compilation
);
2161
this.
Compilation
))
2219
SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.
Compilation
, lambdaParameterType, delegateParameterType);
2452
GenerateImplicitConversionError(diagnostics, this.
Compilation
, syntax, conversion, sourceType, targetType, operand.ConstantValueOpt);
2959
return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningTask(this.
Compilation
);
2965
return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningGenericTask(this.
Compilation
);
2974
return method.IsAsyncReturningIAsyncEnumerable(this.
Compilation
) ||
2975
method.IsAsyncReturningIAsyncEnumerator(this.
Compilation
);
3274
if (!
Compilation
.IsExceptionType(effectiveType, ref useSiteInfo))
3327
else if (TypeSymbol.Equals(previousType,
Compilation
.GetWellKnownType(WellKnownType.System_Exception), TypeCompareKind.ConsiderEverything2) &&
3328
Compilation
.SourceAssembly.RuntimeCompatibilityWrapNonExceptionThrows)
3800
initializerInvocation = BindImplicitConstructorInitializer((MethodSymbol)this.ContainingMember(), diagnostics,
Compilation
);
Binder\Binder_Symbols.cs (38)
358
return this.
Compilation
.Assembly.GlobalNamespace;
365
return this.
Compilation
.GlobalNamespaceAlias;
552
TypeWithAnnotations constructedType = typeArgument.SetIsAnnotated(
Compilation
);
558
diagnostics.Add(new LazyUseSiteDiagnosticsInfoForNullableType(
Compilation
.LanguageVersion, constructedType), syntax.GetLocation());
565
type.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.
Compilation
, this.Conversions, includeNullability: true, location, diagnostics));
567
else if (GetNullableUnconstrainedTypeParameterDiagnosticIfNecessary(
Compilation
.LanguageVersion, constructedType) is { } diagnosticInfo)
606
CheckManagedAddr(
Compilation
, elementType.Type, node.Location, diagnostics);
677
var array = ArrayTypeSymbol.CreateCSharpArray(this.
Compilation
.Assembly, type, rankSpecifier.Rank);
730
ReportMissingTupleElementNamesAttributesIfNeeded(
Compilation
, syntax.GetLocation(), diagnostics);
741
bool includeNullability =
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes);
748
this.
Compilation
,
842
return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(qualifierOpt ?? this.
Compilation
.Assembly.GlobalNamespace, string.Empty, arity: 0, errorInfo: null));
869
Compilation
.Assembly.GlobalNamespace, identifierValueText, 0,
897
bindingResult =
Compilation
.DynamicType;
939
if (
Compilation
.LanguageVersion < MessageID.IDS_FeatureDynamic.RequiredVersion())
1051
if (!
Compilation
.HasDynamicEmitAttributes(bag, node.Location))
1339
return new ExtendedErrorTypeSymbol(this.
Compilation
, name, arity, diagnosticInfo, unreported: false);
1366
var binder = !
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureUsingTypeAlias)
1580
&& extensionMethod.ReduceExtensionMethod(receiverType,
Compilation
) is { } reduced)
1588
if (SourceNamedTypeSymbol.GetCompatibleSubstitutedMember(this.
Compilation
, symbol, receiverType) is { } compatibleSubstitutedMember)
1629
bool includeNullability =
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes);
1630
type.CheckConstraintsForNamedType(new ConstraintsHelper.CheckConstraintsArgs(this.
Compilation
, this.Conversions, includeNullability, typeSyntax.Location, diagnostics),
1699
return GetSpecialType(this.
Compilation
, typeId, node, diagnostics);
1724
return GetSpecialTypeMember(this.
Compilation
, member, diagnostics, syntax);
1827
return GetWellKnownType(this.
Compilation
, type, diagnostics, location);
1853
NamedTypeSymbol typeSymbol = this.
Compilation
.GetWellKnownType(type);
1861
return GetWellKnownTypeMember(
Compilation
, member, diagnostics, location, syntax, isOptional);
1970
if (container is object && container !=
Compilation
.Assembly && container !=
Compilation
.Assembly.CorLibrary)
2195
if (ns.ContainingAssembly ==
Compilation
.Assembly)
2207
Debug.Assert(arg2.ContainingAssembly ==
Compilation
.Assembly);
2250
Compilation
.IsAttributeType((NamedTypeSymbol)first) &&
2251
Compilation
.IsAttributeType((NamedTypeSymbol)second))
2309
((SourceModuleSymbol)this.
Compilation
.SourceModule).AnyReferencedAssembliesAreLinked)
2364
return new ExtendedErrorTypeSymbol(qualifierOpt ??
Compilation
.Assembly.GlobalNamespace, simpleName, arity, info);
2526
var compilation = this.
Compilation
;
2628
if (ReferenceEquals(qualifierOpt,
Compilation
.GlobalNamespace))
2684
Compilation
.Assembly.Modules[0].GetReferencedAssemblySymbols())
Binder\Binder_TupleOperators.cs (2)
194
TypeSymbol dynamicType = hasError ? CreateErrorType() :
Compilation
.DynamicType;
243
var compilation = this.
Compilation
;
Binder\Binder_Unsafe.cs (1)
65
else if (this.IsIndirectlyInIterator && MessageID.IDS_FeatureRefUnsafeInIteratorAsync.GetFeatureAvailabilityDiagnosticInfo(
Compilation
) is { } unsafeInIteratorDiagnosticInfo)
Binder\BinderFactory.BinderFactoryVisitor.cs (2)
912
container = outer.
Compilation
.GlobalNamespace;
920
outer = AddInImportsBinders((SourceNamespaceSymbol)outer.
Compilation
.SourceModule.GetModuleNamespace(ns), namespaceDecl, outer, inUsing);
Binder\BuckStopsHereBinder.cs (1)
70
return IsSymbolAccessibleConditional(symbol,
Compilation
.Assembly, ref useSiteInfo);
Binder\ForEachLoopBinder.cs (16)
244
messageId.CheckFeatureAvailability(diagnostics,
Compilation
, collectionExpr.Syntax.Location);
503
SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.
Compilation
, inferredType.Type, iterationVariableType.Type);
584
IsIEnumerableT(builder.CollectionType.OriginalDefinition, IsAsync,
Compilation
) ||
1089
this.
Compilation
.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerable_T) :
1090
this.
Compilation
.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T));
1113
getEnumeratorMethod = (MethodSymbol)GetWellKnownTypeMember(
Compilation
, WellKnownMember.System_Collections_Generic_IAsyncEnumerable_T__GetAsyncEnumerator,
1149
Debug.Assert(enumeratorType.OriginalDefinition.Equals(
Compilation
.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerator_T)));
1159
currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(
Compilation
, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false);
1288
NamedTypeSymbol targetInterface = isAsync ? this.
Compilation
.GetWellKnownType(WellKnownType.System_IAsyncDisposable) : this.
Compilation
.GetSpecialType(SpecialType.System_IDisposable);
1298
enumeratorType.ContainingModule !=
Compilation
.SourceModule)
1334
TypeSymbol.Equals(builder.GetEnumeratorInfo.Method.ReturnType, this.
Compilation
.GetSpecialType(SpecialType.System_Collections_IEnumerator), TypeCompareKind.ConsiderEverything2));
1786
return type.OriginalDefinition.Equals(
Compilation
.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerable_T));
1809
NamedTypeSymbol implementedIEnumerable = GetIEnumerableOfT(type, isAsync,
Compilation
, ref useSiteInfo, out foundMultiple, out bool needSupportForRefStructInterfaces);
1818
var implementedNonGeneric = this.
Compilation
.GetSpecialType(SpecialType.System_Collections_IEnumerable);
1827
if (implementedIEnumerable is not null && needSupportForRefStructInterfaces && type.ContainingModule !=
Compilation
.SourceModule)
Binder\HostObjectModeBinder.cs (1)
24
TypeSymbol result = this.
Compilation
.GetHostObjectTypeSymbol();
Binder\InContainerBinder.cs (2)
48
return ((object)merged != null) ? merged.GetConstituentForCompilation(this.
Compilation
) : _container;
102
return TypeWithAnnotations.Create(this.
Compilation
.GetSpecialType(SpecialType.System_Object));
Binder\InMethodBinder.cs (1)
139
var elementType = GetIteratorElementTypeFromReturnType(
Compilation
, refKind, returnType, errorLocation: null, diagnostics: null);
Binder\InSubmissionClassBinder.cs (3)
41
for (var submission = this.
Compilation
; submission != null; submission = submission.PreviousSubmission)
60
internal override ImmutableArray<AliasAndExternAliasDirective> ExternAliases => ((SourceNamespaceSymbol)
Compilation
.SourceModule.GlobalNamespace).GetExternAliases(_declarationSyntax);
62
internal override ImmutableArray<AliasAndUsingDirective> UsingAliases => ((SourceNamespaceSymbol)
Compilation
.SourceModule.GlobalNamespace).GetUsingAliases(_declarationSyntax, basesBeingResolved: null);
Binder\LockBinder.cs (2)
46
if (expr.ConstantValueOpt != ConstantValue.Null ||
Compilation
.FeatureStrictEnabled) // Dev10 allows the null literal.
52
else if (!exprType.IsReferenceType && (exprType.IsValueType ||
Compilation
.FeatureStrictEnabled))
Binder\Semantics\Conversions\Conversions.cs (3)
25
: base(binder.
Compilation
.Assembly.CorLibrary, currentRecursionDepth, includeNullability, otherNullabilityOpt)
36
protected override CSharpCompilation Compilation { get { return _binder.
Compilation
; } }
257
GetDelegateOrFunctionPointerArguments(source.Syntax, analyzedArguments, delegateInvokeMethodOpt.Parameters, binder.
Compilation
);
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (1)
393
TypeSymbol systemDelegateType = _binder.
Compilation
.GetSpecialType(SpecialType.System_Delegate);
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (2)
300
binder.
Compilation
,
1511
Conversions.GetDelegateOrFunctionPointerArguments(source.Syntax, analyzedArguments, delegateParameters, binder.
Compilation
);
Binder\Semantics\OverloadResolution\OverloadResolution.cs (10)
40
get { return _binder.
Compilation
; }
55
bool value = _binder.
Compilation
.FeatureStrictEnabled;
1315
(binder.
Compilation
.LanguageVersion > LanguageVersion.CSharp12 || member.ContainingModule == binder.
Compilation
.SourceModule)))
1334
var collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(binder.
Compilation
, type, out elementType);
2957
if (_binder.
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureImprovedInterpolatedStrings) &&
3966
if (argRefKind == RefKind.Ref && binder.
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters))
3976
else if (AreRefsCompatibleForMethodConversion(candidateMethodParameterRefKind: paramRefKind, delegateParameterRefKind: argRefKind, binder.
Compilation
))
4440
var extensionTypeArguments = MethodTypeInferrer.InferTypeArgumentsFromReceiverType(member.ContainingType, args[0], _binder.
Compilation
, _binder.Conversions, ref useSiteInfo);
4451
_binder.
Compilation
,
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (5)
323
if (HadConstructedParameterFailedConstraintCheck(binder.Conversions, binder.
Compilation
, diagnostics, location))
1256
!(refArg == RefKind.Ref && refParameter == RefKind.In && binder.
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) &&
1267
else if (refArg == RefKind.Ref && refParameter == RefKind.In && !binder.
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters))
1275
binder.
Compilation
.LanguageVersion.ToDisplayString(),
1345
SymbolDistinguisher distinguisher = new SymbolDistinguisher(binder.
Compilation
, displayArg, unwrapIfParamsCollection(badArg, parameter, isLastParameter));
Binder\SwitchBinder_Patterns.cs (1)
46
compilation: this.
Compilation
,
Binder\SwitchExpressionBinder.cs (1)
63
decisionDag = DecisionDagBuilder.CreateDecisionDagForSwitchExpression(this.
Compilation
, node, boundInputExpression, switchArms, defaultLabel, diagnostics);
Binder\UsingStatementBinder.cs (5)
204
MessageID.IDS_FeatureDisposalPattern.CheckFeatureAvailability(diagnostics, originalBinder.
Compilation
, syntax.Location);
247
awaitableType = originalBinder.
Compilation
.GetWellKnownType(WellKnownType.System_Threading_Tasks_ValueTask);
290
(fromExpression ? expressionOpt!.Type : declarationTypeOpt)!.ContainingModule != originalBinder.
Compilation
.SourceModule)
301
? originalBinder.
Compilation
.GetWellKnownType(WellKnownType.System_IAsyncDisposable)
302
: originalBinder.
Compilation
.GetSpecialType(SpecialType.System_IDisposable);
Binder\WithExternAndUsingAliasesBinder.cs (1)
178
foreach (var declaration in ((SourceNamespaceSymbol)
Compilation
.SourceModule.GlobalNamespace).MergedDeclaration.Declarations)
BoundTree\UnboundLambda.cs (10)
147
var compilation = Binder.
Compilation
;
226
var useSiteInfo = withDependencies ? new CompoundUseSiteInfo<AssemblySymbol>(binder.
Compilation
.Assembly) : CompoundUseSiteInfo<AssemblySymbol>.DiscardedDependencies;
319
binder.
Compilation
.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task);
334
binder.
Compilation
.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T);
782
returnType = TypeWithAnnotations.Create(Binder.
Compilation
.GetSpecialType(SpecialType.System_Void));
807
var compilation = Binder.
Compilation
;
873
if (Binder.MethodOrLambdaRequiresValue(lambdaSymbol, this.Binder.
Compilation
))
910
Binder.
Compilation
,
985
? TypeWithAnnotations.Create(this.Binder.
Compilation
.GetSpecialType(SpecialType.System_Void))
1233
? this.Binder.
Compilation
.GetSpecialType(SpecialType.System_Void)
Compilation\CSharpSemanticModel.cs (4)
1681
if (SourceNamedTypeSymbol.GetCompatibleSubstitutedMember(binder.
Compilation
, symbol, receiverType) is { } compatibleSubstitutedMember)
4598
binder.
Compilation
);
4613
binder.
Compilation
);
4660
binder.
Compilation
);
Compiler\MethodCompiler.cs (1)
1910
var compilation = bodyBinder.
Compilation
;
Errors\LazyMissingNonNullTypesContextDiagnosticInfo.cs (1)
75
var code = tree.IsGeneratedCode(binder.
Compilation
.Options.SyntaxTreeOptionsProvider, CancellationToken.None)
FlowAnalysis\NullableWalker.cs (4)
1663
binder.
Compilation
,
1738
var compilation = binder.
Compilation
;
4921
var walker = new NullableWalker(binder.
Compilation
,
4963
reportRemainingWarnings: false, reportTopLevelWarnings: false).ToTypeWithAnnotations(binder.
Compilation
);
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (1)
26
CallingConvention callingConvention = getCallingConvention(typeBinder.
Compilation
, syntax.CallingConvention, customModifiers, diagnostics);
Symbols\FunctionTypeSymbol.cs (1)
88
if (_binder.
Compilation
.TestOnlyCompilationData is InferredDelegateTypeData data &&
Symbols\Source\LocalFunctionSymbol.cs (1)
44
Debug.Assert(containingSymbol.DeclaringCompilation == binder.
Compilation
);
Symbols\Source\ParameterHelpers.cs (1)
228
bool allowShadowingNames = withTypeParametersBinder.
Compilation
.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions) &&
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
80
if (binder.
Compilation
.GetSpecialType(SpecialType.System_IAsyncResult).TypeKind != TypeKind.Error &&
81
binder.
Compilation
.GetSpecialType(SpecialType.System_AsyncCallback).TypeKind != TypeKind.Error &&
Symbols\Source\SourceLocalSymbol.cs (1)
53
Debug.Assert(containingSymbol.DeclaringCompilation == scopeBinder.
Compilation
);
Symbols\Source\SourceParameterSymbol.cs (1)
52
Binder.ReportUseSiteDiagnosticForSynthesizedAttribute(context.
Compilation
,
Symbols\Symbol_Attributes.cs (1)
864
if (!boundAttribute.HasErrors && ValidateAttributeUsage(boundAttribute, attributeSyntax, binder.
Compilation
, symbolPart, diagnostics, uniqueAttributeTypes))