3 writes to Compilation
Microsoft.CodeAnalysis.CSharp (3)
Binder\Binder.cs (3)
35this.Compilation = compilation; 43this.Compilation = next.Compilation; 56this.Compilation = next.Compilation;
387 references to Compilation
Microsoft.CodeAnalysis.CSharp (387)
Binder\Binder.cs (8)
43this.Compilation = next.Compilation; 56this.Compilation = next.Compilation; 138return result == OverflowChecks.Enabled || result == OverflowChecks.Implicit && Compilation.Options.CheckOverflow; 160internal bool UseUpdatedEscapeRules => Compilation.SourceModule.UseUpdatedEscapeRules; 265!csTree.IsGeneratedCode(this.Compilation.Options.SyntaxTreeOptionsProvider, CancellationToken.None), 284switch (Compilation.Options.NullableContextOptions) 295throw ExceptionUtilities.UnexpectedValue(Compilation.Options.NullableContextOptions); 854return new CompoundUseSiteInfo<AssemblySymbol>(futureDestination, Compilation.Assembly);
Binder\Binder.IdentifierUsedAsValueFinder.cs (1)
183enclosingBinder.Compilation,
Binder\Binder.ValueChecks.cs (5)
1137var getItemOrSliceHelper = (MethodSymbol)Compilation.GetWellKnownTypeMember(elementAccess.GetItemOrSliceHelper); 1216Compilation.GetWellKnownType(WellKnownType.System_Range), 1263else if (this.IsDirectlyInIterator && Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync)) 1678(Compilation.FeatureStrictEnabled 2005if (setMethod.DeclaringCompilation != this.Compilation)
Binder\Binder.WithQueryLambdaParametersBinder.cs (1)
90new ExtendedErrorTypeSymbol(this.Compilation, "", 0, info));
Binder\Binder_AnonymousTypes.cs (1)
105AnonymousTypeManager manager = this.Compilation.AnonymousTypeManager;
Binder\Binder_Attributes.cs (9)
298return new SourceAttributeData(Compilation, (AttributeSyntax)boundAttribute.Syntax, attributeType, attributeConstructor, hasErrors); 336Compilation, 405if (!paramType.Type.IsValidAttributeParameterType(Compilation)) 541if (setMethod.IsInitOnly && setMethod.DeclaringCompilation != this.Compilation) 671if (!namedArgumentType.IsValidAttributeParameterType(Compilation)) 842var typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.Compilation); 879var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation); 929var typedConstantKind = operandType.GetAttributeParameterTypedConstantKind(_binder.Compilation); 984var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
Binder\Binder_Await.cs (7)
41TypeSymbol awaitExpressionType = (info.GetResult ?? info.RuntimeAsyncAwaitCall?.Method)?.ReturnType ?? (hasErrors ? CreateErrorType() : Compilation.DynamicType); 192else if (method.IsIterator && InMethodBinder.IsAsyncStreamInterface(Compilation, method.RefKind, method.ReturnType)) 303var isRuntimeAsyncEnabled = Compilation.IsRuntimeAsyncEnabledIn(this.ContainingMemberOrLambda); 451new ConstraintsHelper.CheckConstraintsArgs(@this.Compilation, @this.Conversions, includeNullability: false, node.Location, tempDiagnostics))) 492var useUnsafeAwait = Compilation.Conversions.ClassifyImplicitConversionFromType( 494Compilation.GetSpecialType(InternalSpecialType.System_Runtime_CompilerServices_ICriticalNotifyCompletion), 516new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, diagnostics));
Binder\Binder_Constraints.cs (1)
322if (!Compilation.Assembly.RuntimeSupportsByRefLikeGenerics)
Binder\Binder_Conversions.cs (24)
425if (Compilation.SourceModule != method.ContainingModule) 429if (!Compilation.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces) 437Compilation.SourceModule != method.ContainingModule) 445if (!Compilation.Assembly.RuntimeSupportsInlineArrayTypes) 459if (destination.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)) 474Debug.Assert(destination.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions)); 545.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(Compilation, Conversions, includeNullability: false, syntax.Location, diagnostics)); 553TryFindAsSpanCharMethod(Compilation, destination), 715Debug.Assert(destination.Equals(Compilation.GetWellKnownType(WellKnownType.System_IFormattable), TypeCompareKind.ConsiderEverything) || 716destination.Equals(Compilation.GetWellKnownType(WellKnownType.System_FormattableString), TypeCompareKind.ConsiderEverything)); 835if (LocalRewriter.IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType, Compilation)) 876if (targetType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T), TypeCompareKind.ConsiderEverything)) 1068Debug.Assert(parameterType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)); 1073new ConstraintsHelper.CheckConstraintsArgs(Compilation, Conversions, syntax.Location, diagnostics)); 1263var elementPlaceholder = new BoundValuePlaceholder(syntax, Compilation.DynamicType) { WasCompilerGenerated = true }; 1507member, receiverType, addMethodBinder.Compilation, ref useSiteInfo, out wasFullyInferred); 1752var collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(Compilation, targetType, out TypeWithAnnotations elementTypeWithAnnotations); 1811GenerateImplicitConversionError(diagnostics, this.Compilation, spreadElement.Expression.Syntax, elementConversion, enumeratorInfo.ElementType, elementType); 1857var readOnlySpanType = Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T); 1953if (targetTyped && !destination.IsErrorType() && !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureTargetTypedConditional)) 1958Compilation.LanguageVersion.ToDisplayString(), 2182delegateType = Compilation.GetWellKnownType(WellKnownType.System_Linq_Expressions_Expression_T).Construct(delegateType); 2418stackAllocType = Compilation.GetWellKnownType(WellKnownType.System_Span_T).Construct(elementType); 2634return !methodSymbol.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, node.Location, diagnostics));
Binder\Binder_Crefs.cs (2)
1167Debug.Assert(!this.Compilation.ContainsSyntaxTree(typeSyntax.SyntaxTree) || 1168this.Compilation.GetBinderFactory(typeSyntax.SyntaxTree).GetBinder(typeSyntax).Flags ==
Binder\Binder_Deconstruct.cs (6)
46.CheckFeatureAvailability(diagnostics, Compilation, node.Location); 55.CheckFeatureAvailability(diagnostics, Compilation, node.Location); 329GenerateImplicitConversionError(diagnostics, Compilation, single.Syntax, nestedConversion, tupleOrDeconstructedTypes[i], single.Type); 537compilation: Compilation, 580bool disallowInferredNames = this.Compilation.LanguageVersion.DisallowInferredTupleElementNames(); 585tupleNames, this.Compilation,
Binder\Binder_Expressions.cs (64)
245return new ExtendedErrorTypeSymbol(this.Compilation, name, arity: 0, errorInfo: null, unreported: false); 349SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, trueSymbol, falseSymbol); 1007bool disallowInferredNames = this.Compilation.LanguageVersion.DisallowInferredTupleElementNames(); 1016Compilation, 1095bool disallowInferredNames = this.Compilation.LanguageVersion.DisallowInferredTupleElementNames(); 1098this.Compilation, syntax: node, diagnostics: diagnostics, shouldCheckConstraints: true, 1103NamedTypeSymbol.VerifyTupleTypePresent(elements.Length, node, this.Compilation, diagnostics); 1253TypeSymbol typedReferenceType = this.Compilation.GetSpecialType(SpecialType.System_TypedReference); 1301TypeSymbol typedReferenceType = this.Compilation.GetSpecialType(SpecialType.System_TypedReference); 1462bool typeHasErrors = type.IsErrorType() || CheckManagedAddr(Compilation, type, node.Location, diagnostics); 1478diagnostics.Add(ErrorCode.WRN_FieldIsAmbiguous, node, Compilation.LanguageVersion.ToDisplayString()); 1564if (Compilation.LanguageVersion >= requiredVersion) 2221this.Compilation, name: "var", arity: 0, errorInfo: null, variableUsedBeforeDeclaration: true); 2284this.Compilation, name: "var", arity: 0, errorInfo: null, variableUsedBeforeDeclaration: true); 2290isNullableUnknown = (type == (object)Compilation.ImplicitlyTypedVariableUsedInForbiddenZoneType); 2437TypeSymbol hostObjectType = Compilation.GetHostObjectTypeSymbol(); 2871SymbolDistinguisher distinguisher1 = new SymbolDistinguisher(this.Compilation, operand.Type, targetType); 2946SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, operand.Type, targetType); 3120if (Compilation.FeatureStrictEnabled || !isDelegateCreation) 3440if (!hadLangVersionError && !Compilation.LanguageVersion.AllowNonTrailingNamedArguments()) 3964if (!Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 4206var arrayType = ArrayTypeSymbol.CreateCSharpArray(Compilation.Assembly, TypeWithAnnotations.Create(bestType), rank); 4228CheckManagedAddr(Compilation, bestType, node.Location, diagnostics, errorForManaged: true); 4440this.Compilation.CreateArrayTypeSymbol(GetSpecialType(SpecialType.System_Object, diagnostics, node)), 4586hasErrors = hasErrors || CheckManagedAddr(Compilation, elementType.Type, elementTypeSyntax.Location, diagnostics, errorForManaged: true); 4648if (requiredVersion > Compilation.LanguageVersion) 6387initializerType.ContainingModule != Compilation.SourceModule) 6733Debug.Assert((object)this.Compilation.Assembly != null); 6734return IsSymbolAccessibleConditional(constructor, this.Compilation.Assembly, ref useSiteInfo); 7082SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, coClassType, interfaceType); 7725type: Compilation.DynamicType, 8041Compilation.LanguageVersion < MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion()) 8353TypeSymbol.Equals(namedType, Compilation.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncAction), TypeCompareKind.ConsiderEverything2) || 8354TypeSymbol.Equals(namedType, Compilation.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncActionWithProgress_T), TypeCompareKind.ConsiderEverything2) || 8355TypeSymbol.Equals(namedType, Compilation.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncOperation_T), TypeCompareKind.ConsiderEverything2) || 8356TypeSymbol.Equals(namedType, Compilation.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncOperationWithProgress_T2), TypeCompareKind.ConsiderEverything2); 8832&& method.ReduceExtensionMethod(receiverType, binder.Compilation) is null) 8837&& SourceNamedTypeSymbol.ReduceExtensionMember(binder.Compilation, method, receiverType, wasExtensionFullyInferred: out _) is null) 8950errorInfo = OverloadResolutionResult<Symbol>.CreateAmbiguousCallDiagnosticInfo(binder.Compilation, representativeMethod, representativeProperty, symbols, isExtension: true); 9070if ((object)Compilation.SourceModule != fieldSymbol.OriginalDefinition.ContainingModule && 9074if (!Compilation.Assembly.RuntimeSupportsByRefFields) 9195if (!Compilation.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces && Compilation.SourceModule != symbol.ContainingModule) 9207else if (!Compilation.Assembly.RuntimeSupportsDefaultInterfaceImplementation && Compilation.SourceModule != symbol.ContainingModule) 9666if (!Compilation.Assembly.RuntimeSupportsInlineArrayTypes) 9679resultType = Compilation.GetWellKnownType( 9702int? constIndex = InferConstantIndexFromSystemIndex(Compilation, convertedIndex, length, out location); 10390TypeSymbol.Equals(argType, Compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.ConsiderEverything) ? ThreeState.True : 10391TypeSymbol.Equals(argType, Compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything) ? ThreeState.False : 10523var intPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 10594var startArgumentPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 10595var lengthArgumentPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 11025var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true); 11031else if (m.ReduceExtensionMethod(receiver.Type, Compilation) is { } reduced) 11136if (Compilation.LanguageVersion < LanguageVersion.CSharp13) 11236var substituted = (MethodSymbol?)extensionMember.GetReducedAndFilteredSymbol(typeArguments, receiver.Type, Compilation, checkFullyInferred: true); 11304new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, location: NoLocation.Singleton, diagnostics: null), 11376var delegateType = Compilation.GetWellKnownType(wkDelegateType); 11381if (checkConstraints(Compilation, Conversions, delegateType, typeArguments)) 11407return Compilation.AnonymousTypeManager.ConstructAnonymousDelegateSymbol(typeDescr); 11546resultIsUsed = (((SimpleLambdaExpressionSyntax)parent).Body != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda, Compilation); 11550resultIsUsed = (((ParenthesizedLambdaExpressionSyntax)parent).Body != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda, Compilation); 11554resultIsUsed = (((ArrowExpressionClauseSyntax)parent).Expression != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda, Compilation);
Binder\Binder_Flags.cs (1)
100var withoutUnsafe = isIteratorBody && this.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync);
Binder\Binder_Initializers.cs (1)
254if (binder.Compilation.IsSubmission)
Binder\Binder_InterpolatedString.cs (9)
32if (startText.StartsWith("@$\"") && !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureAltInterpolatedVerbatimStrings)) 53var newLinesInInterpolationsAllowed = this.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNewLinesInInterpolations); 85this.Compilation.LanguageVersion.ToDisplayString(), 284var interpolatedStringHandlerType = Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_DefaultInterpolatedStringHandler); 400value = GenerateConversionForAssignment(Compilation.ObjectType, value, diagnostics); 450var interpolatedStringHandlerType = Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_DefaultInterpolatedStringHandler); 664else if (!Compilation.IsFeatureEnabled(MessageID.IDS_FeatureImprovedInterpolatedStrings) && diagnostics.AccumulatesDiagnostics) 998var expected = builderPatternExpectsBool == true ? Compilation.GetSpecialType(SpecialType.System_Boolean) : Compilation.GetSpecialType(SpecialType.System_Void);
Binder\Binder_Invocation.cs (19)
269if (IsInAsyncMethod() && Compilation.IsRuntimeAsyncEnabledIn(ContainingMemberOrLambda)) 393CheckRestrictedTypeReceiver(result, this.Compilation, diagnostics); 500type: Compilation.DynamicType, 512if (!Compilation.LanguageVersion.AllowNonTrailingNamedArguments()) 1038(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics)))) 1457if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_UnknownWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol) 1466if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_DispatchWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol) 1475if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Type__Missing, diagnostics, syntax: syntax) is FieldSymbol fieldSymbol) 1695defaultValue = new BoundLiteral(syntax, ConstantValue.Create(line), Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 1699string path = callerSourceLocation.SourceTree.GetDisplayPath(callerSourceLocation.SourceSpan, Compilation.Options.SourceReferenceResolver); 1700defaultValue = new BoundLiteral(syntax, ConstantValue.Create(path), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1705defaultValue = new BoundLiteral(syntax, ConstantValue.Create(memberName), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1710&& Conversions.ClassifyBuiltInConversion(Compilation.GetSpecialType(SpecialType.System_String), parameterType, isChecked: false, ref discardedUseSiteInfo).Exists 1713defaultValue = new BoundLiteral(syntax, ConstantValue.Create(argument.Syntax.ToString()), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1735TypeSymbol constantType = Compilation.GetSpecialType(defaultConstantValue.SpecialType); 1853if (Compilation.SourceModule != paramsParameter.ContainingModule) 2074var returnType = GetCommonTypeOrReturnType(methods) ?? new ExtendedErrorTypeSymbol(this.Compilation, string.Empty, arity: 0, errorInfo: null); 2317TypeSymbol returnType = new ExtendedErrorTypeSymbol(this.Compilation, string.Empty, arity: 0, errorInfo: null); 2423return new BoundNameOfOperator(node, boundArgument, ConstantValue.Create(name), Compilation.GetSpecialType(SpecialType.System_String));
Binder\Binder_Lambda.cs (4)
196ReportUseSiteDiagnosticForSynthesizedAttribute(Compilation, 318refCustomModifiers = [CSharpCustomModifier.CreateRequired(Binder.GetWellKnownType(Compilation, WellKnownType.System_Runtime_InteropServices_InAttribute, diagnostics, syntax.Location))]; 381bool allowShadowingNames = binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions); 401binder.Compilation,
Binder\Binder_Lookup.cs (28)
335bool isSubmissionTree = Compilation.IsSubmissionSyntaxTree(declarationSyntax.SyntaxTree); 338for (CSharpCompilation submission = Compilation; submission != null; submission = submission.PreviousSubmission) 342var isCurrentSubmission = submission == Compilation; 356submissionImports = ((SourceNamespaceSymbol)Compilation.SourceModule.GlobalNamespace).GetImports(declarationSyntax, basesBeingResolved); 390submissionImports = Imports.ExpandPreviousSubmissionImports(submissionImports, Compilation); 466Compilation.MarkImportDirectiveAsUsed(directive); 766if (Compilation.IsEqualOrDerivedFromWellKnownClass(namedType, WellKnownType.System_Attribute, ref useSiteInfo)) 914var error = new ExtendedErrorTypeSymbol(this.Compilation, name, arity, diagInfo, unreported: true); 926currentType = currentType.GetNextBaseTypeNoUseSiteDiagnostics(basesBeingResolved, this.Compilation, ref visited); 1033idictSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IDictionary_KV); 1034iroDictSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IReadOnlyDictionary_KV); 1035iListSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_IList); 1036iCollectionSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_ICollection); 1037inccSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_Specialized_INotifyCollectionChanged); 1038inpcSymbol = Compilation.GetWellKnownType(WellKnownType.System_ComponentModel_INotifyPropertyChanged); 1235this.LookupMembersInClass(tmp, this.Compilation.GetSpecialType(SpecialType.System_Object), name, arity, basesBeingResolved, options, originalBinder, type, diagnose, ref useSiteInfo); 1327if (!IsDerivedType(baseType: hiddenContainer, derivedType: hidingSym.ContainingType, basesBeingResolved, this.Compilation, useSiteInfo: ref useSiteInfo) && 1424if ((object)symbol.DeclaringCompilation != this.Compilation 1485else if (!this.Compilation.SourceModule.Equals(unwrappedSymbol.ContainingModule) && unwrappedSymbol.IsHiddenByCodeAnalysisEmbeddedAttribute()) 1540diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_FriendRefNotEqualToThis, unwrappedSymbol.ContainingAssembly.Identity.ToString(), AssemblyIdentity.PublicKeyToString(this.Compilation.Assembly.PublicKey)); 1588var assemblyName = this.Compilation.AssemblyName; 1599ImmutableArray<byte> publicKey = this.Compilation.Assembly.PublicKey; 1725return !IsEffectivelyPrivate(symbol) || symbol.ContainingAssembly == this.Compilation.Assembly; 1969for (CSharpCompilation submission = Compilation; submission != null; submission = submission.PreviousSubmission) 1976bool isCurrentSubmission = submission == Compilation; 1984submissionImports = Imports.ExpandPreviousSubmissionImports(submissionImports, Compilation); 2090type = type.GetNextBaseTypeNoUseSiteDiagnostics(null, this.Compilation, ref visited); 2107this.AddMemberLookupSymbolsInfoInClass(result, Compilation.GetSpecialType(SpecialType.System_Object), options, originalBinder, accessThroughType);
Binder\Binder_NameConflicts.cs (1)
121bool allowShadowing = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions);
Binder\Binder_Operators.cs (16)
76var finalDynamicConversion = this.Compilation.Conversions.ClassifyConversionFromExpression(placeholder, left.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 89Compilation.DynamicType), 492if (Compilation.SourceModule != method.ContainingModule) 727if (!eventSymbol.OriginalDefinition.IsFromCompilation(this.Compilation)) 854type: Compilation.DynamicType, 1388return type is NamedTypeSymbol namedType && Compilation.IsReadOnlySpanType(namedType) && 1614var booleanType = Compilation.GetSpecialType(SpecialType.System_Boolean); 2233operatorMethod.ContainingModule != Compilation.SourceModule) 3581if (Compilation.SourceModule != method.ContainingModule) 3990if (Compilation.SourceModule != methodOpt.ContainingModule) 3994if (!Compilation.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces) 4018if (Compilation.SourceModule != methodOpt.ContainingModule) 4140hasErrors = CheckManagedAddr(Compilation, operandType, managedKind, node.Location, diagnostics); 5431bool hasErrors = ReportAsOperatorConversionDiagnostics(node, diagnostics, this.Compilation, operandType, targetType, conversion.Kind, operand.ConstantValueOpt); 6039if (Compilation.Assembly.RuntimeSupportsNumericIntPtr) 6055if (Compilation.Assembly.RuntimeSupportsNumericIntPtr)
Binder\Binder_Patterns.cs (19)
60this.Compilation, pattern.Syntax, expression, innerPattern, whenTrueLabel: whenTrueLabel, whenFalseLabel: whenFalseLabel, diagnostics); 131if (!wasReported && diagnostics.AccumulatesDiagnostics && DecisionDagBuilder.EnableRedundantPatternsCheck(this.Compilation)) 133DecisionDagBuilder.CheckRedundantPatternsForIsPattern(this.Compilation, pattern.Syntax, expression, pattern, diagnostics); 375hasErrors |= !TryGetSpecialTypeMember(Compilation, SpecialMember.System_Array__Length, node, diagnostics, out PropertySymbol lengthProperty); 644if (Compilation.LanguageVersion < requiredVersion && !patternExpressionConversion.IsImplicit) 666if (MessageID.IDS_FeatureSpanCharConstantPattern.CheckFeatureAvailability(diagnostics, Compilation, node.Location)) 786if (requiredVersion > Compilation.LanguageVersion) 790Compilation.LanguageVersion.ToDisplayString(), 1126var objectType = Compilation.GetSpecialType(SpecialType.System_Object); 1153var objectType = Compilation.GetSpecialType(SpecialType.System_Object); 1258if (Compilation.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion()) 1263iTupleType = Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_ITuple); 1272if (declType != (object)Compilation.GetSpecialType(SpecialType.System_Object) && 1273declType != (object)Compilation.DynamicType && 1281iTupleGetLength = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Length); 1282iTupleGetItem = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Item); 1299var result = Compilation.Conversions.ClassifyBuiltInConversion(type, possibleBaseInterface, isChecked: CheckOverflowAtRuntime, ref useSiteInfo).IsImplicit; 1336|| (inputType.IsPointerType() && Compilation.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion())) 1369var declType = TypeWithState.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Binder_Query.cs (1)
824AnonymousTypeManager manager = this.Compilation.AnonymousTypeManager;
Binder\Binder_QueryErrors.cs (4)
89var ienumerable_t = Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T); 90var iqueryable_t = Compilation.GetWellKnownType(WellKnownType.System_Linq_IQueryable_T); 127var ienumerable = Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable); 128var iqueryable = Compilation.GetWellKnownType(WellKnownType.System_Linq_IQueryable);
Binder\Binder_Statements.cs (19)
174if (!this.Compilation.Options.AllowUnsafe) 270else if (InUnsafeRegion && Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync)) 396if (Compilation.LanguageVersion < MessageID.IDS_FeatureSwitchExpression.RequiredVersion()) 413if ((object)type == null || !type.IsErrorType() && !Compilation.IsExceptionType(type.EffectiveType(ref useSiteInfo), ref useSiteInfo)) 641return method.ReturnsVoid || method.IsIterator || method.IsAsyncEffectivelyReturningTask(this.Compilation); 1315if (CheckManagedAddr(Compilation, elementType, initializerSyntax.Location, diagnostics)) 1380GenerateImplicitConversionError(diagnostics, this.Compilation, initializerSyntax, elementConversionClassification, pointerType, declType); 2061var reason = Conversions.IsAnonymousFunctionCompatibleWithType(anonymousFunction, targetType, this.Compilation); 2190this.Compilation)) 2248SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, lambdaParameterType, delegateParameterType); 2481GenerateImplicitConversionError(diagnostics, this.Compilation, syntax, conversion, sourceType, targetType, operand.ConstantValueOpt); 2991return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningTask(this.Compilation); 2997return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningGenericTask(this.Compilation); 3006return method.IsAsyncReturningIAsyncEnumerable(this.Compilation) || 3007method.IsAsyncReturningIAsyncEnumerator(this.Compilation); 3306if (!Compilation.IsExceptionType(effectiveType, ref useSiteInfo)) 3359else if (TypeSymbol.Equals(previousType, Compilation.GetWellKnownType(WellKnownType.System_Exception), TypeCompareKind.ConsiderEverything2) && 3360Compilation.SourceAssembly.RuntimeCompatibilityWrapNonExceptionThrows) 3832initializerInvocation = BindImplicitConstructorInitializer((MethodSymbol)this.ContainingMember(), diagnostics, Compilation);
Binder\Binder_Symbols.cs (38)
359return this.Compilation.Assembly.GlobalNamespace; 366return this.Compilation.GlobalNamespaceAlias; 553TypeWithAnnotations constructedType = typeArgument.SetIsAnnotated(Compilation); 559diagnostics.Add(new LazyUseSiteDiagnosticsInfoForNullableType(Compilation.LanguageVersion, constructedType), syntax.GetLocation()); 566type.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: true, location, diagnostics)); 568else if (GetNullableUnconstrainedTypeParameterDiagnosticIfNecessary(Compilation.LanguageVersion, constructedType) is { } diagnosticInfo) 607CheckManagedAddr(Compilation, elementType.Type, node.Location, diagnostics); 678var array = ArrayTypeSymbol.CreateCSharpArray(this.Compilation.Assembly, type, rankSpecifier.Rank); 731ReportMissingTupleElementNamesAttributesIfNeeded(Compilation, syntax.GetLocation(), diagnostics); 742bool includeNullability = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes); 749this.Compilation, 843return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(qualifierOpt ?? this.Compilation.Assembly.GlobalNamespace, string.Empty, arity: 0, errorInfo: null)); 870Compilation.Assembly.GlobalNamespace, identifierValueText, 0, 898bindingResult = Compilation.DynamicType; 940if (Compilation.LanguageVersion < MessageID.IDS_FeatureDynamic.RequiredVersion()) 1052if (!Compilation.HasDynamicEmitAttributes(bag, node.Location)) 1340return new ExtendedErrorTypeSymbol(this.Compilation, name, arity, diagnosticInfo, unreported: false); 1367var binder = !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureUsingTypeAlias) 1581&& extensionMethod.ReduceExtensionMethod(receiverType, Compilation) is { } reduced) 1589if (SourceNamedTypeSymbol.ReduceExtensionMember(this.Compilation, symbol, receiverType, wasExtensionFullyInferred: out _) is { } compatibleSubstitutedMember) 1630bool includeNullability = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes); 1631type.CheckConstraintsForNamedType(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability, typeSyntax.Location, diagnostics), 1700return GetSpecialType(this.Compilation, typeId, node, diagnostics); 1725return GetSpecialTypeMember(this.Compilation, member, diagnostics, syntax); 1828return GetWellKnownType(this.Compilation, type, diagnostics, location); 1873NamedTypeSymbol typeSymbol = this.Compilation.GetWellKnownType(type); 1881return GetWellKnownTypeMember(Compilation, member, diagnostics, location, syntax, isOptional); 1990if (container is object && container != Compilation.Assembly && container != Compilation.Assembly.CorLibrary) 2215if (ns.ContainingAssembly == Compilation.Assembly) 2227Debug.Assert(arg2.ContainingAssembly == Compilation.Assembly); 2270Compilation.IsAttributeType((NamedTypeSymbol)first) && 2271Compilation.IsAttributeType((NamedTypeSymbol)second)) 2329((SourceModuleSymbol)this.Compilation.SourceModule).AnyReferencedAssembliesAreLinked) 2384return new ExtendedErrorTypeSymbol(qualifierOpt ?? Compilation.Assembly.GlobalNamespace, simpleName, arity, info); 2546var compilation = this.Compilation; 2648if (ReferenceEquals(qualifierOpt, Compilation.GlobalNamespace)) 2704Compilation.Assembly.Modules[0].GetReferencedAssemblySymbols())
Binder\Binder_TupleOperators.cs (2)
198TypeSymbol dynamicType = hasError ? CreateErrorType() : Compilation.DynamicType; 250var compilation = this.Compilation;
Binder\Binder_Unsafe.cs (1)
65else if (this.IsIndirectlyInIterator && MessageID.IDS_FeatureRefUnsafeInIteratorAsync.GetFeatureAvailabilityDiagnosticInfo(Compilation) is { } unsafeInIteratorDiagnosticInfo)
Binder\BinderFactory.BinderFactoryVisitor.cs (2)
912container = outer.Compilation.GlobalNamespace; 920outer = AddInImportsBinders((SourceNamespaceSymbol)outer.Compilation.SourceModule.GetModuleNamespace(ns), namespaceDecl, outer, inUsing);
Binder\BuckStopsHereBinder.cs (1)
70return IsSymbolAccessibleConditional(symbol, Compilation.Assembly, ref useSiteInfo);
Binder\ForEachLoopBinder.cs (18)
244messageId.CheckFeatureAvailability(diagnostics, Compilation, collectionExpr.Syntax.Location); 502SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, inferredType.Type, iterationVariableType.Type); 588IsIEnumerableT(builder.CollectionType.OriginalDefinition, IsAsync, Compilation) || 1078this.Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerable_T) : 1079this.Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T)); 1102getEnumeratorMethod = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerable_T__GetAsyncEnumerator, 1138Debug.Assert(enumeratorType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerator_T))); 1148currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false); 1268NamedTypeSymbol targetInterface = isAsync ? this.Compilation.GetWellKnownType(WellKnownType.System_IAsyncDisposable) : this.Compilation.GetSpecialType(SpecialType.System_IDisposable); 1278enumeratorType.ContainingModule != Compilation.SourceModule && 1279!LocalRewriter.CanRewriteForEachAsFor(Compilation, syntax, collectionType, out _, out _, BindingDiagnosticBag.Discarded)) 1315TypeSymbol.Equals(builder.GetEnumeratorInfo.Method.ReturnType, this.Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerator), TypeCompareKind.ConsiderEverything2)); 1772return type.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerable_T)); 1795NamedTypeSymbol implementedIEnumerable = GetIEnumerableOfT(type, isAsync, Compilation, ref useSiteInfo, out foundMultiple, out bool needSupportForRefStructInterfaces); 1804var implementedNonGeneric = this.Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable); 1813if (implementedIEnumerable is not null && needSupportForRefStructInterfaces && type.ContainingModule != Compilation.SourceModule && 1814!LocalRewriter.CanRewriteForEachAsFor(Compilation, collectionSyntax, type, out _, out _, BindingDiagnosticBag.Discarded))
Binder\HostObjectModeBinder.cs (1)
24TypeSymbol result = this.Compilation.GetHostObjectTypeSymbol();
Binder\InContainerBinder.cs (2)
48return ((object)merged != null) ? merged.GetConstituentForCompilation(this.Compilation) : _container; 104return TypeWithAnnotations.Create(this.Compilation.GetSpecialType(SpecialType.System_Object));
Binder\InMethodBinder.cs (1)
139var elementType = GetIteratorElementTypeFromReturnType(Compilation, refKind, returnType, errorLocation: null, diagnostics: null);
Binder\InSubmissionClassBinder.cs (3)
41for (var submission = this.Compilation; submission != null; submission = submission.PreviousSubmission) 60internal override ImmutableArray<AliasAndExternAliasDirective> ExternAliases => ((SourceNamespaceSymbol)Compilation.SourceModule.GlobalNamespace).GetExternAliases(_declarationSyntax); 62internal override ImmutableArray<AliasAndUsingDirective> UsingAliases => ((SourceNamespaceSymbol)Compilation.SourceModule.GlobalNamespace).GetUsingAliases(_declarationSyntax, basesBeingResolved: null);
Binder\LockBinder.cs (2)
46if (expr.ConstantValueOpt != ConstantValue.Null || Compilation.FeatureStrictEnabled) // Dev10 allows the null literal. 52else if (!exprType.IsReferenceType && (exprType.IsValueType || Compilation.FeatureStrictEnabled))
Binder\Semantics\Conversions\Conversions.cs (3)
25: base(binder.Compilation.Assembly.CorLibrary, currentRecursionDepth, includeNullability, otherNullabilityOpt) 36protected override CSharpCompilation Compilation { get { return _binder.Compilation; } } 257GetDelegateOrFunctionPointerArguments(source.Syntax, analyzedArguments, delegateInvokeMethodOpt.Parameters, binder.Compilation);
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (1)
393TypeSymbol systemDelegateType = _binder.Compilation.GetSpecialType(SpecialType.System_Delegate);
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (2)
302binder.Compilation, 1513Conversions.GetDelegateOrFunctionPointerArguments(source.Syntax, analyzedArguments, delegateParameters, binder.Compilation);
Binder\Semantics\OverloadResolution\OverloadResolution.cs (10)
40get { return _binder.Compilation; } 55bool value = _binder.Compilation.FeatureStrictEnabled; 1315(binder.Compilation.LanguageVersion > LanguageVersion.CSharp12 || member.ContainingModule == binder.Compilation.SourceModule))) 1334var collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(binder.Compilation, type, out elementType); 2967if (_binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureImprovedInterpolatedStrings) && 3976if (argRefKind == RefKind.Ref && binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 3986else if (AreRefsCompatibleForMethodConversion(candidateMethodParameterRefKind: paramRefKind, delegateParameterRefKind: argRefKind, binder.Compilation)) 4450var extensionTypeArguments = MethodTypeInferrer.InferTypeArgumentsFromReceiverType(member.ContainingType, args[0], _binder.Compilation, _binder.Conversions, ref useSiteInfo); 4461_binder.Compilation,
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (7)
241if (HadAmbiguousBestMethods(binder.Compilation, diagnostics, symbols, location, isExtension)) 264if (HadAmbiguousWorseMethods(binder.Compilation, diagnostics, symbols, location, queryClause != null, receiver, name, isExtension)) 341if (HadConstructedParameterFailedConstraintCheck(binder.Conversions, binder.Compilation, diagnostics, location)) 1286!(refArg == RefKind.Ref && refParameter == RefKind.In && binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) && 1297else if (refArg == RefKind.Ref && refParameter == RefKind.In && !binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 1305binder.Compilation.LanguageVersion.ToDisplayString(), 1375SymbolDistinguisher distinguisher = new SymbolDistinguisher(binder.Compilation, displayArg, unwrapIfParamsCollection(badArg, parameter, isLastParameter));
Binder\SwitchBinder_Patterns.cs (3)
46compilation: this.Compilation, 61if (!wasReported && diagnostics.AccumulatesDiagnostics && DecisionDagBuilder.EnableRedundantPatternsCheck(this.Compilation)) 63DecisionDagBuilder.CheckRedundantPatternsForSwitchStatement(this.Compilation, syntax: node, boundSwitchGoverningExpression, switchSections, diagnostics);
Binder\SwitchExpressionBinder.cs (3)
42if (!wasReported && diagnostics.AccumulatesDiagnostics && DecisionDagBuilder.EnableRedundantPatternsCheck(this.Compilation)) 44DecisionDagBuilder.CheckRedundantPatternsForSwitchExpression(this.Compilation, node, boundInputExpression, switchArms, diagnostics); 72decisionDag = DecisionDagBuilder.CreateDecisionDagForSwitchExpression(this.Compilation, node, boundInputExpression, switchArms, defaultLabel, diagnostics);
Binder\UsingStatementBinder.cs (5)
207MessageID.IDS_FeatureDisposalPattern.CheckFeatureAvailability(diagnostics, originalBinder.Compilation, syntax.Location); 251awaitableType = originalBinder.Compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_ValueTask); 294(fromExpression ? expressionOpt!.Type : declarationTypeOpt)!.ContainingModule != originalBinder.Compilation.SourceModule) 305? originalBinder.Compilation.GetWellKnownType(WellKnownType.System_IAsyncDisposable) 306: originalBinder.Compilation.GetSpecialType(SpecialType.System_IDisposable);
Binder\WithExternAndUsingAliasesBinder.cs (1)
178foreach (var declaration in ((SourceNamespaceSymbol)Compilation.SourceModule.GlobalNamespace).MergedDeclaration.Declarations)
BoundTree\UnboundLambda.cs (10)
156var compilation = Binder.Compilation; 238var useSiteInfo = withDependencies ? new CompoundUseSiteInfo<AssemblySymbol>(binder.Compilation.Assembly) : CompoundUseSiteInfo<AssemblySymbol>.DiscardedDependencies; 334binder.Compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task); 349binder.Compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T); 803returnType = TypeWithAnnotations.Create(Binder.Compilation.GetSpecialType(SpecialType.System_Void)); 828var compilation = Binder.Compilation; 895if (Binder.MethodOrLambdaRequiresValue(lambdaSymbol, this.Binder.Compilation)) 933Binder.Compilation, 1015? TypeWithAnnotations.Create(this.Binder.Compilation.GetSpecialType(SpecialType.System_Void)) 1271? this.Binder.Compilation.GetSpecialType(SpecialType.System_Void)
BoundTree\VariablePendingInference.cs (1)
45type = TypeWithAnnotations.Create(binderOpt!.Compilation.ImplicitlyTypedVariableInferenceFailedType);
Compilation\CSharpSemanticModel.cs (4)
1684if (SourceNamedTypeSymbol.ReduceExtensionMember(binder.Compilation, symbol, receiverType, wasExtensionFullyInferred: out _) is { } compatibleSubstitutedMember) 4594binder.Compilation); 4609binder.Compilation); 4656binder.Compilation);
Compiler\MethodCompiler.cs (1)
1943var compilation = bodyBinder.Compilation;
Errors\LazyMissingNonNullTypesContextDiagnosticInfo.cs (1)
75var code = tree.IsGeneratedCode(binder.Compilation.Options.SyntaxTreeOptionsProvider, CancellationToken.None)
FlowAnalysis\NullableWalker.cs (4)
1686binder.Compilation, 1761var compilation = binder.Compilation; 4979var walker = new NullableWalker(binder.Compilation, 5021reportRemainingWarnings: false, reportTopLevelWarnings: false).ToTypeWithAnnotations(binder.Compilation);
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (1)
26CallingConvention callingConvention = getCallingConvention(typeBinder.Compilation, syntax.CallingConvention, customModifiers, diagnostics);
Symbols\FunctionTypeSymbol.cs (1)
88if (_binder.Compilation.TestOnlyCompilationData is InferredDelegateTypeData data &&
Symbols\Source\LocalFunctionSymbol.cs (1)
45Debug.Assert(containingSymbol.DeclaringCompilation == binder.Compilation);
Symbols\Source\ParameterHelpers.cs (1)
228bool allowShadowingNames = withTypeParametersBinder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions) &&
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
80if (binder.Compilation.GetSpecialType(SpecialType.System_IAsyncResult).TypeKind != TypeKind.Error && 81binder.Compilation.GetSpecialType(SpecialType.System_AsyncCallback).TypeKind != TypeKind.Error &&
Symbols\Source\SourceLocalSymbol.cs (1)
84Debug.Assert(containingSymbol.DeclaringCompilation == scopeBinder.Compilation);
Symbols\Source\SourceParameterSymbol.cs (1)
52Binder.ReportUseSiteDiagnosticForSynthesizedAttribute(context.Compilation,
Symbols\Symbol_Attributes.cs (1)
868if (!boundAttribute.HasErrors && ValidateAttributeUsage(boundAttribute, attributeSyntax, binder.Compilation, symbolPart, diagnostics, uniqueAttributeTypes))