diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/Operators/UnaryOperatorOverloadResolution.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/Operators/UnaryOperatorOverloadResolution.cs index f4eb223b6c22f..afca304bf7fe0 100644 --- a/src/Compilers/CSharp/Portable/Binder/Semantics/Operators/UnaryOperatorOverloadResolution.cs +++ b/src/Compilers/CSharp/Portable/Binder/Semantics/Operators/UnaryOperatorOverloadResolution.cs @@ -261,8 +261,10 @@ public bool Equals(MethodSymbol? x, MethodSymbol? y) return false; } - var xGroupingKey = new SourceMemberContainerTypeSymbol.ExtensionGroupingKey(x.OriginalDefinition.ContainingType); - var yGroupingKey = new SourceMemberContainerTypeSymbol.ExtensionGroupingKey(y.OriginalDefinition.ContainingType); + var xExtension = x.OriginalDefinition.ContainingType; + var xGroupingKey = ((SourceNamedTypeSymbol)xExtension).GetExtensionGroupingMetadataName(); + var yExtension = y.OriginalDefinition.ContainingType; + var yGroupingKey = ((SourceNamedTypeSymbol)yExtension).GetExtensionGroupingMetadataName(); if (!xGroupingKey.Equals(yGroupingKey)) { @@ -270,8 +272,18 @@ public bool Equals(MethodSymbol? x, MethodSymbol? y) } return SourceMemberContainerTypeSymbol.DoOperatorsPair( - x.OriginalDefinition.AsMember(xGroupingKey.NormalizedExtension), - y.OriginalDefinition.AsMember(yGroupingKey.NormalizedExtension)); + x.OriginalDefinition.AsMember(Normalize(xExtension)), + y.OriginalDefinition.AsMember(Normalize(yExtension))); + } + + private static NamedTypeSymbol Normalize(NamedTypeSymbol extension) + { + if (extension.Arity != 0) + { + extension = extension.Construct(IndexedTypeParameterSymbol.Take(extension.Arity)); + } + + return extension; } public int GetHashCode(MethodSymbol op) @@ -280,10 +292,11 @@ public int GetHashCode(MethodSymbol op) int result = typeComparer.GetHashCode(op.OriginalDefinition.ContainingType.ContainingType); - var groupingKey = new SourceMemberContainerTypeSymbol.ExtensionGroupingKey(op.OriginalDefinition.ContainingType); + var extension = op.OriginalDefinition.ContainingType; + var groupingKey = ((SourceNamedTypeSymbol)extension).GetExtensionGroupingMetadataName(); result = Hash.Combine(result, groupingKey.GetHashCode()); - foreach (var parameter in op.OriginalDefinition.AsMember(groupingKey.NormalizedExtension).Parameters) + foreach (var parameter in op.OriginalDefinition.AsMember(Normalize(extension)).Parameters) { result = Hash.Combine(result, typeComparer.GetHashCode(parameter.Type)); } diff --git a/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs b/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs index 1b61da90332a2..f4bd5ffc888ae 100644 --- a/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs +++ b/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs @@ -498,6 +498,14 @@ private void CompileNamedType(NamedTypeSymbol containingType) } var members = containingType.GetMembers(); + + if (containingType.IsExtension && ((SourceNamedTypeSymbol)containingType).TryGetOrCreateExtensionMarker() is { } marker) + { + // The marker method is not among the members of the type, so we need to compile it separately. + Binder.ProcessedFieldInitializers processedInitializers = default; + CompileMethod(marker, -1, ref processedInitializers, synthesizedSubmissionFields, compilationState); + } + for (int memberOrdinal = 0; memberOrdinal < members.Length; memberOrdinal++) { var member = members[memberOrdinal]; diff --git a/src/Compilers/CSharp/Portable/DocumentationComments/DocumentationCommentIDVisitor.PartVisitor.cs b/src/Compilers/CSharp/Portable/DocumentationComments/DocumentationCommentIDVisitor.PartVisitor.cs index d40824ac80acb..117d7f2d2b977 100644 --- a/src/Compilers/CSharp/Portable/DocumentationComments/DocumentationCommentIDVisitor.PartVisitor.cs +++ b/src/Compilers/CSharp/Portable/DocumentationComments/DocumentationCommentIDVisitor.PartVisitor.cs @@ -181,6 +181,8 @@ public override object VisitNamedType(NamedTypeSymbol symbol, StringBuilder buil builder.Append('.'); } + // PROTOTYPE: Finalize the doc ID story. When we refer to a member, we probably need to use grouping type name, + // but when we refer to an extension block, we probably need to "dot" through both names. builder.Append(symbol.IsExtension ? symbol.ExtensionName : symbol.Name); if (symbol.Arity != 0) @@ -189,8 +191,11 @@ public override object VisitNamedType(NamedTypeSymbol symbol, StringBuilder buil // (and return type, for conversions) as constructed with its own type parameters. if (!_inParameterOrReturnType && TypeSymbol.Equals(symbol, symbol.ConstructedFrom, TypeCompareKind.AllIgnoreOptions)) { - builder.Append('`'); - builder.Append(symbol.Arity); + if (!symbol.IsExtension) + { + builder.Append('`'); + builder.Append(symbol.Arity); + } } else { diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/GenericNestedTypeInstanceReference.cs b/src/Compilers/CSharp/Portable/Emitter/Model/GenericNestedTypeInstanceReference.cs index de9cf582fe2d7..2932a31cbd2a7 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/GenericNestedTypeInstanceReference.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/GenericNestedTypeInstanceReference.cs @@ -44,5 +44,7 @@ public override Cci.ISpecializedNestedTypeReference AsSpecializedNestedTypeRefer { get { return null; } } + + bool Cci.INestedTypeReference.InheritsEnclosingTypeTypeParameters => true; } } diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/MethodSymbolAdapter.cs b/src/Compilers/CSharp/Portable/Emitter/Model/MethodSymbolAdapter.cs index 9d811e630d82d..9237e359075c8 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/MethodSymbolAdapter.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/MethodSymbolAdapter.cs @@ -82,6 +82,16 @@ Cci.ITypeReference Cci.ITypeMemberReference.GetContainingType(EmitContext contex } NamedTypeSymbol containingType = AdaptedMethodSymbol.ContainingType; + + if (AdaptedMethodSymbol is SynthesizedExtensionMarker) + { + return ((SourceMemberContainerTypeSymbol)containingType.ContainingType).GetExtensionGroupingInfo().GetCorrespondingMarkerType((SourceNamedTypeSymbol)containingType); + } + else if (AdaptedMethodSymbol.GetIsNewExtensionMember()) + { + return ((SourceMemberContainerTypeSymbol)containingType.ContainingType).GetExtensionGroupingInfo().GetCorrespondingGroupingType((SourceNamedTypeSymbol)containingType); + } + var moduleBeingBuilt = (PEModuleBuilder)context.Module; return moduleBeingBuilt.Translate(containingType, @@ -300,6 +310,18 @@ Cci.ITypeDefinition Cci.ITypeDefinitionMember.ContainingTypeDefinition return synthesizedGlobalMethod.ContainingPrivateImplementationDetailsType; } + // PROTOTYPE: Share logic with Cci.ITypeMemberReference.GetContainingType implementation? + if (AdaptedMethodSymbol is SynthesizedExtensionMarker) + { + var containingType = AdaptedMethodSymbol.ContainingType; + return ((SourceMemberContainerTypeSymbol)containingType.ContainingType).GetExtensionGroupingInfo().GetCorrespondingMarkerType((SourceNamedTypeSymbol)containingType); + } + else if (AdaptedMethodSymbol.GetIsNewExtensionMember()) + { + var containingType = AdaptedMethodSymbol.ContainingType; + return ((SourceMemberContainerTypeSymbol)containingType.ContainingType).GetExtensionGroupingInfo().GetCorrespondingGroupingType((SourceNamedTypeSymbol)containingType); + } + return AdaptedMethodSymbol.ContainingType.GetCciAdapter(); } } diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/NamedTypeSymbolAdapter.cs b/src/Compilers/CSharp/Portable/Emitter/Model/NamedTypeSymbolAdapter.cs index 7be1ce2af196a..2480e0b661cfa 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/NamedTypeSymbolAdapter.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/NamedTypeSymbolAdapter.cs @@ -157,6 +157,8 @@ Cci.INestedTypeReference Cci.ITypeReference.AsNestedTypeReference } } + bool Cci.INestedTypeReference.InheritsEnclosingTypeTypeParameters => true; + Cci.INestedTypeDefinition Cci.ITypeReference.AsNestedTypeDefinition(EmitContext context) { PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module; @@ -629,7 +631,7 @@ bool Cci.ITypeDefinition.IsSealed { Debug.Assert((object)method != null); - if ((alwaysIncludeConstructors && method.MethodKind == MethodKind.Constructor) || method is SynthesizedExtensionMarker || method.GetCciAdapter().ShouldInclude(context)) + if ((alwaysIncludeConstructors && method.MethodKind == MethodKind.Constructor) || method.GetCciAdapter().ShouldInclude(context)) { yield return method.GetCciAdapter(); } @@ -655,9 +657,22 @@ bool Cci.ITypeDefinition.IsSealed foreach (NamedTypeSymbol type in AdaptedNamedTypeSymbol.GetTypeMembers()) // Ordered. { + if (type.IsExtension) + { + continue; + } + yield return type.GetCciAdapter(); } + if (AdaptedNamedTypeSymbol is SourceMemberContainerTypeSymbol { MergedDeclaration.ContainsExtensionDeclarations: true } container) + { + foreach (var groupingType in container.GetExtensionGroupingInfo().GetGroupingTypes()) + { + yield return groupingType; + } + } + IEnumerable generated = ((PEModuleBuilder)context.Module).GetSynthesizedTypes(AdaptedNamedTypeSymbol); if (generated != null) @@ -782,7 +797,7 @@ string Cci.INamedEntity.Name { if (AdaptedNamedTypeSymbol.IsExtension) { - return AdaptedNamedTypeSymbol.ExtensionName; + throw ExceptionUtilities.Unreachable(); } string unsuffixedName = AdaptedNamedTypeSymbol.Name; diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/PEAssemblyBuilder.cs b/src/Compilers/CSharp/Portable/Emitter/Model/PEAssemblyBuilder.cs index 8f884e92d2e00..6ca796e6b6cca 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/PEAssemblyBuilder.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/PEAssemblyBuilder.cs @@ -45,6 +45,7 @@ internal abstract class PEAssemblyBuilderBase : PEModuleBuilder, Cci.IAssemblyRe private SynthesizedEmbeddedNativeIntegerAttributeSymbol _lazyNativeIntegerAttribute; private SynthesizedEmbeddedScopedRefAttributeSymbol _lazyScopedRefAttribute; private SynthesizedEmbeddedRefSafetyRulesAttributeSymbol _lazyRefSafetyRulesAttribute; + private SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol _lazyExtensionMarkerNameAttribute; /// /// The behavior of the C# command-line compiler is as follows: @@ -111,6 +112,7 @@ internal sealed override ImmutableArray GetEmbeddedTypes(Bindin builder.AddIfNotNull(_lazyNativeIntegerAttribute); builder.AddIfNotNull(_lazyScopedRefAttribute); builder.AddIfNotNull(_lazyRefSafetyRulesAttribute); + builder.AddIfNotNull(_lazyExtensionMarkerNameAttribute); return builder.ToImmutableAndFree(); } @@ -337,6 +339,25 @@ protected override SynthesizedAttributeData TrySynthesizeParamCollectionAttribut return base.TrySynthesizeParamCollectionAttribute(); } + protected override SynthesizedAttributeData TrySynthesizeExtensionMarkerNameAttribute(string markerName) + { + if ((object)_lazyExtensionMarkerNameAttribute != null) + { + return SynthesizedAttributeData.Create( + Compilation, + _lazyExtensionMarkerNameAttribute.Constructors[0], + [new TypedConstant(Compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, markerName)], + ImmutableArray>.Empty); + } + + return base.TrySynthesizeExtensionMarkerNameAttribute(markerName); + } + + internal override SynthesizedEmbeddedAttributeSymbol TryGetSynthesizedIsUnmanagedAttribute() + { + return _lazyIsUnmanagedAttribute; + } + protected override SynthesizedAttributeData TrySynthesizeIsUnmanagedAttribute() { if ((object)_lazyIsUnmanagedAttribute != null) @@ -494,6 +515,15 @@ private void CreateEmbeddedAttributesIfNeeded(BindingDiagnosticBag diagnostics) AttributeDescription.RefSafetyRulesAttribute, CreateRefSafetyRulesAttributeSymbol); } + + if ((needsAttributes & EmbeddableAttributes.ExtensionMarkerNameAttribute) != 0) + { + CreateAttributeIfNeeded( + ref _lazyExtensionMarkerNameAttribute, + diagnostics, + AttributeDescription.ExtensionMarkerNameAttribute, + CreateExtensionMarkerNameAttributeSymbol); + } } private SynthesizedEmbeddedAttributeSymbol CreateParameterlessEmbeddedAttributeSymbol(string name, NamespaceSymbol containingNamespace, BindingDiagnosticBag diagnostics) @@ -550,6 +580,14 @@ private SynthesizedEmbeddedRefSafetyRulesAttributeSymbol CreateRefSafetyRulesAtt GetWellKnownType(WellKnownType.System_Attribute, diagnostics), GetSpecialType(SpecialType.System_Int32, diagnostics)); + private SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol CreateExtensionMarkerNameAttributeSymbol(string name, NamespaceSymbol containingNamespace, BindingDiagnosticBag diagnostics) + => new SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol( + name, + containingNamespace, + SourceModule, + GetWellKnownType(WellKnownType.System_Attribute, diagnostics), + GetSpecialType(SpecialType.System_String, diagnostics)); + #nullable enable private void CreateAttributeIfNeeded( ref T symbol, diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs b/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs index 44178fe8e4c02..1ce04ade72578 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs @@ -382,7 +382,10 @@ private static void GetDocumentsForMethodsAndNestedTypes(PooledHashSet true; } } diff --git a/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.Types.cs b/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.Types.cs index 6b8fd91e46265..a519f3cf1334a 100644 --- a/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.Types.cs +++ b/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.Types.cs @@ -345,6 +345,7 @@ private void AddNameAndTypeArgumentsOrParameters(INamedTypeSymbol symbol) { if (Format.CompilerInternalOptions.HasFlag(SymbolDisplayCompilerInternalOptions.UseMetadataMemberNames)) { + // PROTOTYPE: What should we output as the name here var extensionIdentifier = underlyingTypeSymbol!.ExtensionName; // Tracked by https://github.com/dotnet/roslyn/issues/78957 : public API, use public API once it's available Builder.Add(CreatePart(SymbolDisplayPartKind.ClassName, symbol, extensionIdentifier)); } diff --git a/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs b/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs index 4f9e927d0a7f1..e5c9577cb33b4 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs @@ -573,6 +573,11 @@ internal void EnsureScopedRefAttributeExists(BindingDiagnosticBag? diagnostics, EnsureEmbeddableAttributeExists(EmbeddableAttributes.ScopedRefAttribute, diagnostics, location, modifyCompilation); } + internal void EnsureExtensionMarkerNameAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation) + { + EnsureEmbeddableAttributeExists(EmbeddableAttributes.ExtensionMarkerNameAttribute, diagnostics, location, modifyCompilation); + } + internal bool CheckIfAttributeShouldBeEmbedded(EmbeddableAttributes attribute, BindingDiagnosticBag? diagnosticsOpt, Location locationOpt) { switch (attribute) @@ -659,6 +664,13 @@ internal bool CheckIfAttributeShouldBeEmbedded(EmbeddableAttributes attribute, B WellKnownType.System_Runtime_CompilerServices_ParamCollectionAttribute, WellKnownMember.System_Runtime_CompilerServices_ParamCollectionAttribute__ctor); + case EmbeddableAttributes.ExtensionMarkerNameAttribute: + return CheckIfAttributeShouldBeEmbedded( + diagnosticsOpt, + locationOpt, + WellKnownType.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute, + WellKnownMember.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute__ctor); + default: throw ExceptionUtilities.UnexpectedValue(attribute); } diff --git a/src/Compilers/CSharp/Portable/Symbols/EmbeddableAttributes.cs b/src/Compilers/CSharp/Portable/Symbols/EmbeddableAttributes.cs index 617846637f925..1cbc877267fa5 100644 --- a/src/Compilers/CSharp/Portable/Symbols/EmbeddableAttributes.cs +++ b/src/Compilers/CSharp/Portable/Symbols/EmbeddableAttributes.cs @@ -20,5 +20,6 @@ internal enum EmbeddableAttributes RefSafetyRulesAttribute = 0x100, RequiresLocationAttribute = 0x200, ParamCollectionAttribute = 0x400, + ExtensionMarkerNameAttribute = 0x800, } } diff --git a/src/Compilers/CSharp/Portable/Symbols/MemberSymbolExtensions.cs b/src/Compilers/CSharp/Portable/Symbols/MemberSymbolExtensions.cs index 1aa4b38d583e3..224291f145abb 100644 --- a/src/Compilers/CSharp/Portable/Symbols/MemberSymbolExtensions.cs +++ b/src/Compilers/CSharp/Portable/Symbols/MemberSymbolExtensions.cs @@ -85,8 +85,9 @@ internal static bool GetIsNewExtensionMember(this Symbol member) switch (member.Kind) { case SymbolKind.Method: + return GetIsNewExtensionMember((MethodSymbol)member); case SymbolKind.Property: - return member.ContainingSymbol is TypeSymbol { IsExtension: true }; + return GetIsNewExtensionMember((PropertySymbol)member); default: return false; } @@ -94,7 +95,7 @@ internal static bool GetIsNewExtensionMember(this Symbol member) internal static bool GetIsNewExtensionMember(this MethodSymbol member) { - return member.ContainingSymbol is TypeSymbol { IsExtension: true }; + return member is { ContainingSymbol: TypeSymbol { IsExtension: true }, OriginalDefinition: not SynthesizedExtensionMarker }; } internal static bool GetIsNewExtensionMember(this PropertySymbol member) diff --git a/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PENamedTypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PENamedTypeSymbol.cs index 798382228edd4..86e3e034ad7fd 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PENamedTypeSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PENamedTypeSymbol.cs @@ -153,7 +153,7 @@ private sealed class UncommonProperties internal ImmutableArray lazyFilePathChecksum = default; internal string lazyDisplayFileName; - internal ExtensionInfo lazyExtensionInfo; + internal ExtensionInfo extensionInfo; #if DEBUG internal bool IsDefaultValue() @@ -173,16 +173,18 @@ internal bool IsDefaultValue() (object)lazyCollectionBuilderAttributeData == CollectionBuilderAttributeData.Uninitialized && lazyFilePathChecksum.IsDefault && lazyDisplayFileName == null && - lazyExtensionInfo is null; + extensionInfo is null; } #endif } #nullable enable - private class ExtensionInfo(MethodDefinitionHandle markerMethod) + private class ExtensionInfo(TypeDefinitionHandle groupingType, MethodDefinitionHandle markerMethod) { - public readonly MethodDefinitionHandle MarkerMethod = markerMethod; + public readonly TypeDefinitionHandle GroupingTypeHandle = groupingType; + public readonly MethodDefinitionHandle MarkerMethodHandle = markerMethod; + public PEMethodSymbol? LazyMarkerMethodSymbol; public StrongBox? LazyExtensionParameter; public ConcurrentDictionary? LazyImplementationMap; } @@ -207,7 +209,7 @@ internal static PENamedTypeSymbol Create( if (arity == 0) { - result = new PENamedTypeSymbolNonGeneric(moduleSymbol, containingNamespace, handle, emittedNamespaceName); + result = new PENamedTypeSymbolNonGeneric(moduleSymbol, containingNamespace, handle, emittedNamespaceName, groupingType: default, markerMethod: default); } else { @@ -217,7 +219,9 @@ internal static PENamedTypeSymbol Create( handle, emittedNamespaceName, genericParameterHandles, - arity); + arity, + groupingType: default, + markerMethod: default); } if (mrEx != null) @@ -247,7 +251,9 @@ private static void GetGenericInfo(PEModuleSymbol moduleSymbol, TypeDefinitionHa internal static PENamedTypeSymbol Create( PEModuleSymbol moduleSymbol, PENamedTypeSymbol containingType, - TypeDefinitionHandle handle) + TypeDefinitionHandle handle, + TypeDefinitionHandle groupingType = default, + MethodDefinitionHandle markerMethod = default) { GenericParameterHandleCollection genericParameterHandles; ushort metadataArity; @@ -267,7 +273,7 @@ internal static PENamedTypeSymbol Create( if (metadataArity == 0) { - result = new PENamedTypeSymbolNonGeneric(moduleSymbol, containingType, handle, null); + result = new PENamedTypeSymbolNonGeneric(moduleSymbol, containingType, handle, emittedNamespaceName: null, groupingType, markerMethod); } else { @@ -277,7 +283,9 @@ internal static PENamedTypeSymbol Create( handle, null, genericParameterHandles, - arity); + arity, + groupingType, + markerMethod); } if (mrEx != null || metadataArity < containerMetadataArity) @@ -294,11 +302,15 @@ private PENamedTypeSymbol( TypeDefinitionHandle handle, string emittedNamespaceName, ushort arity, + TypeDefinitionHandle groupingType, + MethodDefinitionHandle markerMethod, out bool mangleName) { Debug.Assert(!handle.IsNil); Debug.Assert((object)container != null); Debug.Assert(arity == 0 || this is PENamedTypeSymbolGeneric); + Debug.Assert(groupingType.IsNil == markerMethod.IsNil); + Debug.Assert(groupingType.IsNil || container.IsType); string metadataName; bool makeBad = false; @@ -325,7 +337,7 @@ private PENamedTypeSymbol( makeBad = true; } - if (arity == 0) + if (arity == 0 || !groupingType.IsNil) { _name = metadataName; mangleName = false; @@ -347,6 +359,8 @@ private PENamedTypeSymbol( // this is needed to allow EE to bind to file types from metadata, for example. if (container.IsNamespace && GeneratedNameParser.TryParseFileTypeName(_name, out var displayFileName, out var ordinal, out var originalTypeName)) { + Debug.Assert(groupingType.IsNil); + _name = originalTypeName; _lazyUncommonProperties = new UncommonProperties() { @@ -354,6 +368,13 @@ private PENamedTypeSymbol( lazyDisplayFileName = displayFileName }; } + else if (!groupingType.IsNil) + { + _lazyUncommonProperties = new UncommonProperties() + { + extensionInfo = new ExtensionInfo(groupingType, markerMethod) + }; + } // check if this is one of the COR library types if (emittedNamespaceName != null && @@ -392,7 +413,7 @@ internal sealed override ParameterSymbol? ExtensionParameter return null; } - var uncommon = GetUncommonProperties().lazyExtensionInfo; + var uncommon = GetUncommonProperties().extensionInfo; if (uncommon.LazyExtensionParameter is null) { @@ -406,9 +427,7 @@ internal sealed override ParameterSymbol? ExtensionParameter { var methodSymbol = GetMarkerMethodSymbol(@this, uncommon); - if (methodSymbol.DeclaredAccessibility != Accessibility.Private || - methodSymbol.IsGenericMethod || - !methodSymbol.IsStatic || + if (methodSymbol.IsGenericMethod || !methodSymbol.ReturnsVoid || methodSymbol.ParameterCount != 1) { @@ -427,23 +446,20 @@ internal sealed override ParameterSymbol? ExtensionParameter return null; } - var uncommon = GetUncommonProperties().lazyExtensionInfo; + var uncommon = GetUncommonProperties().extensionInfo; return GetMarkerMethodSymbol(this, uncommon); } - private static MethodSymbol GetMarkerMethodSymbol(PENamedTypeSymbol @this, ExtensionInfo uncommon) + private static PEMethodSymbol GetMarkerMethodSymbol(PENamedTypeSymbol @this, ExtensionInfo uncommon) { - Debug.Assert(!uncommon.MarkerMethod.IsNil); + Debug.Assert(!uncommon.MarkerMethodHandle.IsNil); - foreach (var member in @this.GetMembers(WellKnownMemberNames.ExtensionMarkerMethodName)) + if (uncommon.LazyMarkerMethodSymbol is null) { - if (member is PEMethodSymbol candidate && candidate.Handle == uncommon.MarkerMethod) - { - return candidate; - } + Interlocked.CompareExchange(ref uncommon.LazyMarkerMethodSymbol, new PEMethodSymbol(@this.ContainingPEModule, @this, uncommon.MarkerMethodHandle), null); } - throw ExceptionUtilities.Unreachable(); + return uncommon.LazyMarkerMethodSymbol; } public sealed override MethodSymbol? TryGetCorrespondingExtensionImplementationMethod(MethodSymbol method) @@ -462,7 +478,7 @@ private static MethodSymbol GetMarkerMethodSymbol(PENamedTypeSymbol @this, Exten return null; } - var uncommon = GetUncommonProperties().lazyExtensionInfo; + var uncommon = GetUncommonProperties().extensionInfo; if (uncommon.LazyImplementationMap is null) { @@ -842,6 +858,11 @@ public override Accessibility DeclaredAccessibility { get { + if (IsExtension) + { + return Accessibility.Public; + } + Accessibility access = Accessibility.Private; switch (_flags & TypeAttributes.VisibilityMask) @@ -908,26 +929,39 @@ public override ImmutableArray GetAttributes() if (uncommon.lazyCustomAttributes.IsDefault) { - var loadedCustomAttributes = ContainingPEModule.GetCustomAttributesForToken( - Handle, - out _, - // Filter out [Extension] - MightContainExtensionMethods ? AttributeDescription.CaseSensitiveExtensionAttribute : default, - out _, - // Filter out [Obsolete], unless it was user defined - (IsRefLikeType && ObsoleteAttributeData is null) ? AttributeDescription.ObsoleteAttribute : default, - out _, - // Filter out [IsReadOnly] - IsReadOnly ? AttributeDescription.IsReadOnlyAttribute : default, - out _, - // Filter out [IsByRefLike] - IsRefLikeType ? AttributeDescription.IsByRefLikeAttribute : default, - out _, - // Filter out [CompilerFeatureRequired] - (IsRefLikeType && DeriveCompilerFeatureRequiredDiagnostic() is null) ? AttributeDescription.CompilerFeatureRequiredAttribute : default, - out CustomAttributeHandle requiredHandle, - // Filter out [RequiredMember] - AttributeDescription.RequiredMemberAttribute); + ImmutableArray loadedCustomAttributes; + CustomAttributeHandle requiredHandle; + + if (IsExtension) + { + // We do not recognize any attributes on extension blocks + // PROTOTYPE: Add a test demonstrating the fact that we do not load attributes from grouping and marker types. + loadedCustomAttributes = []; + requiredHandle = default; + } + else + { + loadedCustomAttributes = ContainingPEModule.GetCustomAttributesForToken( + Handle, + out _, + // Filter out [Extension] + MightContainExtensionMethods ? AttributeDescription.CaseSensitiveExtensionAttribute : default, + out _, + // Filter out [Obsolete], unless it was user defined + (IsRefLikeType && ObsoleteAttributeData is null) ? AttributeDescription.ObsoleteAttribute : default, + out _, + // Filter out [IsReadOnly] + IsReadOnly ? AttributeDescription.IsReadOnlyAttribute : default, + out _, + // Filter out [IsByRefLike] + IsRefLikeType ? AttributeDescription.IsByRefLikeAttribute : default, + out _, + // Filter out [CompilerFeatureRequired] + (IsRefLikeType && DeriveCompilerFeatureRequiredDiagnostic() is null) ? AttributeDescription.CompilerFeatureRequiredAttribute : default, + out requiredHandle, + // Filter out [RequiredMember] + AttributeDescription.RequiredMemberAttribute); + } ImmutableInterlocked.InterlockedInitialize(ref uncommon.lazyCustomAttributes, loadedCustomAttributes); @@ -1828,7 +1862,21 @@ public override string Name { get { - return _name; + return IsExtension ? "" : _name; // PROTOTYPE: add test coverage + } + } + + public override string MetadataName + { + get + { + if (IsExtension) + { + Debug.Assert(!MangleName); + return _name; // PROTOTYPE: add test coverage + } + + return base.MetadataName; } } @@ -1959,6 +2007,8 @@ public override bool MightContainExtensionMethods } } + public override bool IsExtension => _lazyUncommonProperties?.extensionInfo is { }; + public override TypeKind TypeKind { get @@ -1967,7 +2017,12 @@ public override TypeKind TypeKind if (result == TypeKind.Unknown) { - if (_flags.IsInterface()) + if (IsExtension) + { + // Extension + result = TypeKind.Extension; + } + else if (_flags.IsInterface()) { result = TypeKind.Interface; } @@ -2001,21 +2056,6 @@ public override TypeKind TypeKind result = TypeKind.Struct; } break; - - case SpecialType.System_Object: - if (TryGetExtensionMarkerMethod() is { IsNil: false } markerHandle) - { - // Extension - result = TypeKind.Extension; - - if (_lazyUncommonProperties is null) - { - Interlocked.CompareExchange(ref _lazyUncommonProperties, new UncommonProperties(), null); - } - - Interlocked.CompareExchange(ref _lazyUncommonProperties.lazyExtensionInfo, new ExtensionInfo(markerHandle), null); - } - break; } } } @@ -2034,14 +2074,6 @@ public override TypeKind TypeKind /// private MethodDefinitionHandle TryGetExtensionMarkerMethod() { - if (!this.HasSpecialName || - !this.IsSealed || - this.DeclaredAccessibility != Accessibility.Public || - !this.InterfacesNoUseSiteDiagnostics().IsEmpty) - { - return default; - } - var moduleSymbol = this.ContainingPEModule; var module = moduleSymbol.Module; @@ -2055,7 +2087,8 @@ private MethodDefinitionHandle TryGetExtensionMarkerMethod() MethodAttributes flags; module.GetMethodDefPropsOrThrow(methodHandle, out methodName, out _, out flags, out _); - if ((flags & MethodAttributes.SpecialName) != 0 && methodName is WellKnownMemberNames.ExtensionMarkerMethodName) + if ((flags & (MethodAttributes.SpecialName | MethodAttributes.Static | MethodAttributes.MemberAccessMask)) == (MethodAttributes.SpecialName | MethodAttributes.Static | MethodAttributes.Private) && + methodName is WellKnownMemberNames.ExtensionMarkerMethodName) { if (!foundMarkerMethod.IsNil) { @@ -2128,6 +2161,13 @@ private ImmutableArray MakeAcyclicInterfaces() private IEnumerable CreateNestedTypes() { + if (IsExtension) + { + // We do not support type declarations in extension blocks + // PROTOTYPE: Add a test demonstrating the fact that we do not load nested types from grouping and marker types. + yield break; + } + var moduleSymbol = this.ContainingPEModule; var module = moduleSymbol.Module; @@ -2142,6 +2182,10 @@ private IEnumerable CreateNestedTypes() yield break; } + // PROTOTYPE: test effect of every condition here + bool checkForExtensionGroup = this.IsStatic && this.ContainingType is null && this.TypeKind == TypeKind.Class && + module.HasExtensionAttribute(_handle, ignoreCase: false) && !this.IsGenericType; + // Currently, it appears that we must import ALL types, even private ones, // in order to maintain language semantics. This is because a class may implement // private interfaces, and we use the interfaces (even if inaccessible) to determine @@ -2156,7 +2200,50 @@ private IEnumerable CreateNestedTypes() // importing the type A.X. foreach (var typeRid in nestedTypeDefs) { - yield return PENamedTypeSymbol.Create(moduleSymbol, this, typeRid); + var type = PENamedTypeSymbol.Create(moduleSymbol, this, typeRid); + + // PROTOTYPE: test effect of every condition here + if (checkForExtensionGroup && + type.DeclaredAccessibility == Accessibility.Public && + type.HasSpecialName && type.IsSealed && module.HasExtensionAttribute(type.Handle, ignoreCase: false) && + type.TypeKind == TypeKind.Class && type.BaseTypeNoUseSiteDiagnostics.IsObjectType() && + type.InterfacesNoUseSiteDiagnostics().IsEmpty) + { + // This looks like an extension grouping type. Restore extension blocks from marker types + ImmutableArray markerTypeDefs; + + try + { + markerTypeDefs = module.GetNestedTypeDefsOrThrow(type.Handle); + } + catch (BadImageFormatException) + { + yield break; + } + + foreach (var markerRid in markerTypeDefs) + { + var marker = PENamedTypeSymbol.Create(moduleSymbol, type, markerRid); + + // PROTOTYPE: test effect of every condition here + if (marker.HasSpecialName && marker.IsStatic && marker.DeclaredAccessibility == Accessibility.Private && + marker.TypeKind == TypeKind.Class && marker.BaseTypeNoUseSiteDiagnostics.IsObjectType() && marker.Arity == 0 && + marker.InterfacesNoUseSiteDiagnostics().IsEmpty && + (type.Arity == 0 || (marker is PENamedTypeSymbolGeneric genericMarker && genericMarker.MatchesContainingTypeParameters()))) + { + // Try to locate the marker method. + if (marker.TryGetExtensionMarkerMethod() is { IsNil: false } markerHandle) + { + marker = PENamedTypeSymbol.Create(moduleSymbol, this, markerRid, type.Handle, markerHandle); + yield return marker; + } + } + } + + continue; + } + + yield return type; } } @@ -2164,6 +2251,12 @@ private MultiDictionary CreateFields(ArrayBuilder(); + if (IsExtension) + { + // PROTOTYPE: Add a test demonstrating the fact that we do not load fields from grouping and marker types. + return privateFieldNameToSymbols; + } + var moduleSymbol = this.ContainingPEModule; var module = moduleSymbol.Module; @@ -2256,17 +2349,24 @@ private PooledDictionary CreateMethods(A // for ordinary embeddable struct types we import private members so that we can report appropriate errors if the structure is used var isOrdinaryEmbeddableStruct = (this.TypeKind == TypeKind.Struct) && (this.SpecialType == Microsoft.CodeAnalysis.SpecialType.None) && this.ContainingAssembly.IsLinked; + bool isExtension = IsExtension; - MethodDefinitionHandle? extensionMarkerMethod = _lazyUncommonProperties?.lazyExtensionInfo?.MarkerMethod; - Debug.Assert(extensionMarkerMethod is not null || this.TypeKind is not TypeKind.Extension); + // PROTOTYPE: Add a test demonstrating the fact that we do not load methods from marker types into the extension blocks. try { - foreach (var methodHandle in module.GetMethodsOfTypeOrThrow(_handle)) + foreach (var methodHandle in module.GetMethodsOfTypeOrThrow(isExtension ? _lazyUncommonProperties.extensionInfo.GroupingTypeHandle : _handle)) { - if (isOrdinaryEmbeddableStruct || module.ShouldImportMethod(_handle, methodHandle, moduleSymbol.ImportOptions) || - extensionMarkerMethod == methodHandle) + if (isOrdinaryEmbeddableStruct || module.ShouldImportMethod(_handle, methodHandle, moduleSymbol.ImportOptions)) { + // PROTOTYPE: Would it be worth building a map across all methods to optimize this? + // PROTOTYPE: Should we strip the ExtensionMarkerNameAttribute from GetAttributes()? + if (isExtension && (!module.HasExtensionMarkerNameAttribute(methodHandle, out string markerName) || markerName != MetadataName)) + { + // Method doesn't belong to this extension block + continue; + } + var method = new PEMethodSymbol(moduleSymbol, this, methodHandle); members.Add(method); map.Add(methodHandle, method); @@ -2283,13 +2383,24 @@ private void CreateProperties(Dictionary { var moduleSymbol = this.ContainingPEModule; var module = moduleSymbol.Module; + bool isExtension = IsExtension; + + // PROTOTYPE: Add a test demonstrating the fact that we do not load properties from marker types into extension blocks. try { - foreach (var propertyDef in module.GetPropertiesOfTypeOrThrow(_handle)) + foreach (var propertyDef in module.GetPropertiesOfTypeOrThrow(isExtension ? _lazyUncommonProperties.extensionInfo.GroupingTypeHandle : _handle)) { try { + // PROTOTYPE: Would it be worth building a map across all properties to optimize this? + // PROTOTYPE: Should we strip the ExtensionMarkerNameAttribute from GetAttributes()? + if (isExtension && (!module.HasExtensionMarkerNameAttribute(propertyDef, out string markerName) || markerName != MetadataName)) + { + // Property doesn't belong to this extension block + continue; + } + var methods = module.GetPropertyMethodsOrThrow(propertyDef); PEMethodSymbol getMethod = GetAccessorMethod(module, methodHandleToSymbol, _handle, methods.Getter); @@ -2313,6 +2424,13 @@ private void CreateEvents( Dictionary methodHandleToSymbol, ArrayBuilder members) { + if (IsExtension) + { + // We do not support event declarations in extension blocks + // PROTOTYPE: Add a test demonstrating the fact that we do not load events from grouping and marker types. + return; + } + var moduleSymbol = this.ContainingPEModule; var module = moduleSymbol.Module; @@ -2577,7 +2695,28 @@ public override bool IsRefLikeType } internal override string ExtensionName - => Name; // Tracked by https://github.com/dotnet/roslyn/issues/76130 : Confirm implementation + { + get + { + if (!IsExtension) + { + throw ExceptionUtilities.Unreachable(); + } + + string groupName; + + try + { + groupName = ContainingPEModule.Module.GetTypeDefNameOrThrow(_lazyUncommonProperties.extensionInfo.GroupingTypeHandle); + } + catch (BadImageFormatException) + { + groupName = string.Empty; + } + + return groupName; // PROTOTYPE: is this the right value to return? + } + } public override bool IsReadOnly { @@ -2824,8 +2963,10 @@ internal PENamedTypeSymbolNonGeneric( PEModuleSymbol moduleSymbol, NamespaceOrTypeSymbol container, TypeDefinitionHandle handle, - string emittedNamespaceName) : - base(moduleSymbol, container, handle, emittedNamespaceName, 0, out _) + string emittedNamespaceName, + TypeDefinitionHandle groupingType, + MethodDefinitionHandle markerMethod) : + base(moduleSymbol, container, handle, emittedNamespaceName, 0, groupingType, markerMethod, out _) { } @@ -2895,12 +3036,16 @@ internal PENamedTypeSymbolGeneric( TypeDefinitionHandle handle, string emittedNamespaceName, GenericParameterHandleCollection genericParameterHandles, - ushort arity) + ushort arity, + TypeDefinitionHandle groupingType, + MethodDefinitionHandle markerMethod) : base(moduleSymbol, container, handle, emittedNamespaceName, arity, + groupingType, + markerMethod, out bool mangleName) { Debug.Assert(genericParameterHandles.Count > 0); @@ -3009,7 +3154,7 @@ protected override DiagnosticInfo GetUseSiteDiagnosticImpl() /// that represent the corresponding type parameters on the containing /// types, in fact match the actual type parameters on the containing types. /// - private bool MatchesContainingTypeParameters() + internal bool MatchesContainingTypeParameters() { var container = this.ContainingType; if ((object)container == null) diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/ExtensionGroupingInfo.cs b/src/Compilers/CSharp/Portable/Symbols/Source/ExtensionGroupingInfo.cs new file mode 100644 index 0000000000000..393c468fa41e6 --- /dev/null +++ b/src/Compilers/CSharp/Portable/Symbols/Source/ExtensionGroupingInfo.cs @@ -0,0 +1,531 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Runtime.InteropServices; +using Microsoft.Cci; +using Microsoft.CodeAnalysis.Collections; +using Microsoft.CodeAnalysis.CSharp.Emit; +using Microsoft.CodeAnalysis.Emit; +using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Symbols; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.CSharp.Symbols +{ + internal sealed class ExtensionGroupingInfo + { + /// + /// Extension block symbols declared in a class are grouped by their corresponding grouping type metadata name (top level key), + /// then grouped by their corresponding extension marker type metadata name (the secondary key used by MultiDictionary). + /// s are the extension blocks. + /// + private readonly Dictionary> _groupingMap; + private ImmutableArray _lazyGroupingTypes; + + public ExtensionGroupingInfo(SourceMemberContainerTypeSymbol container) + { + var groupingMap = new Dictionary>(EqualityComparer.Default); + + foreach (var type in container.GetTypeMembers("")) + { + if (!type.IsExtension) + { + continue; + } + + var sourceNamedType = (SourceNamedTypeSymbol)type; + var groupingMetadataName = sourceNamedType.GetExtensionGroupingMetadataName(); + + MultiDictionary? markerMap; + + if (!groupingMap.TryGetValue(groupingMetadataName, out markerMap)) + { + markerMap = new MultiDictionary(EqualityComparer.Default, ReferenceEqualityComparer.Instance); + groupingMap.Add(groupingMetadataName, markerMap); + } + + markerMap.Add(sourceNamedType.GetExtensionMarkerMetadataName(), sourceNamedType); + } + + _groupingMap = groupingMap; + } + + public ImmutableArray GetGroupingTypes() + { + if (_lazyGroupingTypes.IsDefault) + { + var builder = ArrayBuilder.GetInstance(_groupingMap.Count); + + foreach (KeyValuePair> pair in _groupingMap) + { + builder.Add(new ExtensionGroupingType(pair.Key, pair.Value)); + } + + builder.Sort(); + + ImmutableInterlocked.InterlockedInitialize(ref _lazyGroupingTypes, builder.ToImmutableAndFree()); + } + + return ImmutableArray.CastUp(_lazyGroupingTypes); + } + + public Cci.ITypeDefinition GetCorrespondingMarkerType(SourceNamedTypeSymbol type) + { + GetGroupingTypes(); + + // PROTOTYPE: Optimize lookup with side dictionaries? + var groupingName = type.GetExtensionGroupingMetadataName(); + var markerName = type.GetExtensionMarkerMetadataName(); + + foreach (var groupingType in _lazyGroupingTypes) + { + if (groupingType.Name != groupingName) + { + continue; + } + + foreach (var markerType in groupingType.ExtensionMarkerTypes) + { + if (markerType.Name == markerName) + { + return markerType; + } + } + + break; + } + + throw ExceptionUtilities.Unreachable(); + } + + public Cci.ITypeDefinition GetCorrespondingGroupingType(SourceNamedTypeSymbol type) + { + GetGroupingTypes(); + + // PROTOTYPE: Optimize lookup with a side dictionary? + var groupingName = type.GetExtensionGroupingMetadataName(); + + foreach (var groupingType in _lazyGroupingTypes) + { + if (groupingType.Name == groupingName) + { + return groupingType; + } + } + + throw ExceptionUtilities.Unreachable(); + } + + private abstract class ExtensionGroupingOrMarkerType : Cci.INestedTypeDefinition + { + ushort ITypeDefinition.Alignment => 0; + + IEnumerable ITypeDefinition.GenericParameters => GenericParameters; + + protected abstract IEnumerable GenericParameters { get; } + + ushort ITypeDefinition.GenericParameterCount => GenericParameterCount; + + ushort INamedTypeReference.GenericParameterCount => GenericParameterCount; + + protected abstract ushort GenericParameterCount { get; } + + bool ITypeDefinition.HasDeclarativeSecurity => false; + + bool ITypeDefinition.IsAbstract => IsAbstract; + + protected abstract bool IsAbstract { get; } + + bool ITypeDefinition.IsBeforeFieldInit => false; + + bool ITypeDefinition.IsComObject => false; + + bool ITypeDefinition.IsGeneric => GenericParameterCount != 0; + + bool ITypeDefinition.IsInterface => false; + + bool ITypeDefinition.IsDelegate => false; + + bool ITypeDefinition.IsRuntimeSpecial => false; + + bool ITypeDefinition.IsSerializable => false; + + bool ITypeDefinition.IsSpecialName => true; + + bool ITypeDefinition.IsWindowsRuntimeImport => false; + + bool ITypeDefinition.IsSealed => IsSealed; + + protected abstract bool IsSealed { get; } + + LayoutKind ITypeDefinition.Layout => LayoutKind.Auto; + + IEnumerable ITypeDefinition.SecurityAttributes => SpecializedCollections.EmptyEnumerable(); + + uint ITypeDefinition.SizeOf => 0; + + CharSet ITypeDefinition.StringFormat => CharSet.Ansi; + + ITypeDefinition ITypeDefinitionMember.ContainingTypeDefinition => ContainingTypeDefinition; + + protected abstract ITypeDefinition ContainingTypeDefinition { get; } + + TypeMemberVisibility ITypeDefinitionMember.Visibility => Visibility; + + protected abstract TypeMemberVisibility Visibility { get; } + + bool IDefinition.IsEncDeleted => false; + + bool INamedTypeReference.MangleName => false; + + string? INamedTypeReference.AssociatedFileIdentifier => null; + + bool ITypeReference.IsEnum => false; + + bool ITypeReference.IsValueType => false; + + Cci.PrimitiveTypeCode ITypeReference.TypeCode => Cci.PrimitiveTypeCode.NotPrimitive; + + TypeDefinitionHandle ITypeReference.TypeDef => default; + + IGenericMethodParameterReference? ITypeReference.AsGenericMethodParameterReference => null; + + IGenericTypeInstanceReference? ITypeReference.AsGenericTypeInstanceReference => null; + + IGenericTypeParameterReference? ITypeReference.AsGenericTypeParameterReference => null; + + INamespaceTypeReference? ITypeReference.AsNamespaceTypeReference => null; + + INestedTypeReference? ITypeReference.AsNestedTypeReference => this; + + ISpecializedNestedTypeReference? ITypeReference.AsSpecializedNestedTypeReference => null; + + string? INamedEntity.Name => Name; + + public abstract string Name { get; } + + IDefinition? IReference.AsDefinition(EmitContext context) + { + return this; + } + + INamespaceTypeDefinition? ITypeReference.AsNamespaceTypeDefinition(EmitContext context) + { + return null; + } + + INestedTypeDefinition? ITypeReference.AsNestedTypeDefinition(EmitContext context) + { + return this; + } + + bool Cci.INestedTypeReference.InheritsEnclosingTypeTypeParameters => false; + + ITypeDefinition? ITypeReference.AsTypeDefinition(EmitContext context) + { + return this; + } + + void IReference.Dispatch(MetadataVisitor visitor) + { + visitor.Visit((INamedTypeDefinition)this); + } + + IEnumerable IReference.GetAttributes(EmitContext context) + { + return GetAttributes(context); + } + + protected abstract IEnumerable GetAttributes(EmitContext context); + + ITypeReference? ITypeDefinition.GetBaseClass(EmitContext context) + { + return ObjectType; + } + + protected abstract ITypeReference? ObjectType { get; } + + ITypeReference ITypeMemberReference.GetContainingType(EmitContext context) + { + return ContainingTypeDefinition; + } + + IEnumerable ITypeDefinition.GetEvents(EmitContext context) + { + return SpecializedCollections.EmptyEnumerable(); + } + + IEnumerable ITypeDefinition.GetExplicitImplementationOverrides(EmitContext context) + { + return SpecializedCollections.EmptyEnumerable(); + } + + IEnumerable ITypeDefinition.GetFields(EmitContext context) + { + return SpecializedCollections.EmptyEnumerable(); + } + + ISymbolInternal? IReference.GetInternalSymbol() + { + return null; + } + + IEnumerable ITypeDefinition.GetMethods(EmitContext context) + { + return GetMethods(context); + } + + protected abstract IEnumerable GetMethods(EmitContext context); + + IEnumerable ITypeDefinition.GetNestedTypes(EmitContext context) + { + return NestedTypes; + } + + protected abstract IEnumerable NestedTypes { get; } + + IEnumerable ITypeDefinition.GetProperties(EmitContext context) + { + return GetProperties(context); + } + + protected abstract IEnumerable GetProperties(EmitContext context); + + ITypeDefinition? ITypeReference.GetResolvedType(EmitContext context) + { + return this; + } + + IEnumerable ITypeDefinition.Interfaces(EmitContext context) + { + return SpecializedCollections.EmptyEnumerable(); + } + + public sealed override bool Equals(object? obj) + { + // It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used. + throw ExceptionUtilities.Unreachable(); + } + + public sealed override int GetHashCode() + { + // It is not supported to rely on default equality of these Cci objects, an explicit way to compare and hash them should be used. + throw ExceptionUtilities.Unreachable(); + } + } + + private sealed class ExtensionGroupingType : ExtensionGroupingOrMarkerType, IComparable + { + private readonly string _name; + public readonly ImmutableArray ExtensionMarkerTypes; + private readonly ImmutableArray _typeParameters; + + public ExtensionGroupingType(string name, MultiDictionary extensionMarkerTypes) + { + _name = name; + + var builder = ArrayBuilder.GetInstance(extensionMarkerTypes.Count); + + foreach (var pair in extensionMarkerTypes) + { + builder.Add(new ExtensionMarkerType(this, pair.Key, pair.Value)); + } + + builder.Sort(); + ExtensionMarkerTypes = builder.ToImmutableAndFree(); + + _typeParameters = ExtensionMarkerTypes[0].UnderlyingExtensions[0].Arity != 0 ? + ((INestedTypeDefinition)ExtensionMarkerTypes[0].UnderlyingExtensions[0].GetCciAdapter()).GenericParameters.SelectAsArray(static (p, @this) => new ExtensionGroupingTypeTypeParameter(@this, p), this) : + []; + } + + int IComparable.CompareTo(ExtensionGroupingType? other) + { + Debug.Assert(other is { }); + return ExtensionMarkerTypes[0].CompareTo(other.ExtensionMarkerTypes[0]); + } + + protected override IEnumerable GenericParameters => _typeParameters; + + protected override ushort GenericParameterCount => (ushort)ExtensionMarkerTypes[0].UnderlyingExtensions[0].Arity; + + protected override bool IsAbstract => false; + + protected override bool IsSealed => true; + + protected override ITypeDefinition ContainingTypeDefinition => ExtensionMarkerTypes[0].UnderlyingExtensions[0].ContainingType!.GetCciAdapter(); + + protected override TypeMemberVisibility Visibility => TypeMemberVisibility.Public; + + public override string Name => _name; + + protected override ITypeReference? ObjectType => ExtensionMarkerTypes[0].UnderlyingExtensions[0].ContainingAssembly.GetSpecialType(SpecialType.System_Object).GetCciAdapter(); + + protected override IEnumerable GetMethods(EmitContext context) + { + foreach (var marker in ExtensionMarkerTypes) + { + foreach (var type in marker.UnderlyingExtensions) + { + foreach (var method in type.GetMethodsToEmit()) + { + Debug.Assert((object)method != null); + + if (method.GetCciAdapter().ShouldInclude(context)) + { + yield return method.GetCciAdapter(); + } + } + } + } + } + + protected override IEnumerable NestedTypes => ExtensionMarkerTypes; + + protected override IEnumerable GetProperties(EmitContext context) + { + foreach (var marker in ExtensionMarkerTypes) + { + foreach (var type in marker.UnderlyingExtensions) + { + foreach (PropertySymbol property in type.GetPropertiesToEmit()) + { + Debug.Assert((object)property != null); + IPropertyDefinition definition = property.GetCciAdapter(); + // If any accessor should be included, then the property should be included too + if (definition.ShouldInclude(context) || !definition.GetAccessors(context).IsEmpty()) + { + yield return definition; + } + } + } + } + } + + protected override IEnumerable GetAttributes(EmitContext context) + { + SynthesizedAttributeData? extensionAttribute = ExtensionMarkerTypes[0].UnderlyingExtensions[0].DeclaringCompilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_ExtensionAttribute__ctor); + + if (extensionAttribute is { }) + { + yield return extensionAttribute; + } + } + } + + private sealed class ExtensionGroupingTypeTypeParameter : InheritedTypeParameter + { + internal ExtensionGroupingTypeTypeParameter(ExtensionGroupingType inheritingType, IGenericTypeParameter parentParameter) : + base(parentParameter.Index, inheritingType, parentParameter) + { + } + + public override string? Name => "$T" + Index; + + public override IEnumerable GetConstraints(EmitContext context) + { + // Drop all attributes from constraints, they are about C# specific semantics. + foreach (var constraint in base.GetConstraints(context)) + { + yield return new TypeReferenceWithAttributes(constraint.TypeRef); + } + } + + public override IEnumerable GetAttributes(EmitContext context) + { + // Preserve only the synthesized IsUnmanagedAttribute. + if (MustBeValueType) + { + // PROTOTYPE: Make sure we have coverage for the WellKnownMember.System_Runtime_CompilerServices_IsUnmanagedAttribute__ctor case + var unmanagedCtor = ((PEModuleBuilder)context.Module).TryGetSynthesizedIsUnmanagedAttribute()?.Constructors[0] ?? + ((ExtensionGroupingType)DefiningType).ExtensionMarkerTypes[0].UnderlyingExtensions[0].DeclaringCompilation. + GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_IsUnmanagedAttribute__ctor); + + if (unmanagedCtor is { }) + { + foreach (var attribute in base.GetAttributes(context)) + { + if (attribute is SynthesizedAttributeData synthesized && + synthesized.AttributeConstructor == unmanagedCtor) + { + return [synthesized]; + } + } + } + } + + return SpecializedCollections.EmptyEnumerable(); + } + } + + private sealed class ExtensionMarkerType : ExtensionGroupingOrMarkerType, IComparable + { + public readonly ExtensionGroupingType GroupingType; + private readonly string _name; + public readonly ImmutableArray UnderlyingExtensions; + private readonly ImmutableArray _typeParameters; + + public ExtensionMarkerType(ExtensionGroupingType groupingType, string name, MultiDictionary.ValueSet extensions) + { + GroupingType = groupingType; + _name = name; + + var builder = ArrayBuilder.GetInstance(extensions.Count); + builder.AddRange(extensions); + builder.Sort(LexicalOrderSymbolComparer.Instance); + UnderlyingExtensions = builder.ToImmutableAndFree(); + + _typeParameters = UnderlyingExtensions[0].Arity != 0 ? + ((INestedTypeDefinition)UnderlyingExtensions[0].GetCciAdapter()).GenericParameters.SelectAsArray(static (p, @this) => new InheritedTypeParameter(p.Index, @this, p), this) : + []; + } + + public int CompareTo(ExtensionMarkerType? other) + { + Debug.Assert(other is { }); + return LexicalOrderSymbolComparer.Instance.Compare(UnderlyingExtensions[0], other.UnderlyingExtensions[0]); + } + + protected override IEnumerable GenericParameters => _typeParameters; + + protected override ushort GenericParameterCount => (ushort)UnderlyingExtensions[0].Arity; + + protected override bool IsAbstract => true; + + protected override bool IsSealed => true; + + protected override ITypeDefinition ContainingTypeDefinition => GroupingType; + + protected override TypeMemberVisibility Visibility => TypeMemberVisibility.Private; + + public override string Name => _name; + + protected override ITypeReference? ObjectType => UnderlyingExtensions[0].ContainingAssembly.GetSpecialType(SpecialType.System_Object).GetCciAdapter(); + + protected override IEnumerable GetMethods(EmitContext context) + { + var marker = UnderlyingExtensions[0].TryGetOrCreateExtensionMarker(); + + if (marker is { }) + { + yield return marker.GetCciAdapter(); + } + } + + protected override IEnumerable NestedTypes => SpecializedCollections.EmptyEnumerable(); + + protected override IEnumerable GetProperties(EmitContext context) => SpecializedCollections.EmptyEnumerable(); + + protected override IEnumerable GetAttributes(EmitContext context) + { + return SpecializedCollections.EmptyEnumerable(); + } + } + } +} diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs index fb9b111e317e1..17ff668d69093 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs @@ -217,6 +217,9 @@ public bool SetHasDeclaredRequiredMembers(bool value) private ThreeState _lazyContainsExtensionMethods; private ThreeState _lazyAnyMemberHasAttributes; + // PROTOTYPE: Move some fields into "uncommon" class field? + private ExtensionGroupingInfo? _lazyExtensionGroupingInfo; + #region Construction internal SourceMemberContainerTypeSymbol( @@ -608,6 +611,11 @@ internal override void ForceComplete(SourceLocation? locationOpt, Predicate members = this.GetMembersUnordered(); bool allCompleted = true; @@ -2023,8 +2036,7 @@ private static void CheckMemberNameConflicts( { if (symbol.Kind == SymbolKind.NamedType || symbol.IsAccessor() || - symbol.IsIndexer() || - symbol.OriginalDefinition is SynthesizedExtensionMarker) + symbol.IsIndexer()) { continue; } @@ -2178,7 +2190,7 @@ private static void ReportMethodSignatureCollision(SourceMemberContainerTypeSymb method2 is SourceExtensionImplementationMethodSymbol { UnderlyingMethod: var underlying2 } && underlying1.IsStatic == underlying2.IsStatic && ((object)underlying1.ContainingType == underlying2.ContainingType || - new ExtensionGroupingKey(underlying1.ContainingType).Equals(new ExtensionGroupingKey(underlying2.ContainingType))) && + ((SourceNamedTypeSymbol)underlying1.ContainingType).GetExtensionGroupingMetadataName() == ((SourceNamedTypeSymbol)underlying2.ContainingType).GetExtensionGroupingMetadataName()) && diagnostics.DiagnosticBag?.AsEnumerableWithoutResolution().Any( static (d, arg) => (d.Code is (int)ErrorCode.ERR_OverloadRefKind or (int)ErrorCode.ERR_MemberAlreadyExists or @@ -2375,7 +2387,7 @@ void checkMemberNameConflicts( void checkMemberNameConflictsInExtensions(BindingDiagnosticBag diagnostics) { - IEnumerable> extensionsByReceiverType = GetTypeMembers("").Where(static t => t.IsExtension).GroupBy(static t => new ExtensionGroupingKey(t)); + IEnumerable> extensionsByReceiverType = GetTypeMembers("").Where(static t => t.IsExtension).GroupBy(static t => ((SourceNamedTypeSymbol)t).GetExtensionGroupingMetadataName()); foreach (var grouping in extensionsByReceiverType) { @@ -2391,7 +2403,7 @@ void checkMemberNameConflictsInExtensions(BindingDiagnosticBag diagnostics) } } - static (Dictionary, ImmutableArray>? membersByName, ImmutableArray membersUnordered) mergeMembersInGroup(IGrouping grouping) + static (Dictionary, ImmutableArray>? membersByName, ImmutableArray membersUnordered) mergeMembersInGroup(IGrouping grouping) { Dictionary, ImmutableArray>? membersByName = null; ImmutableArray membersUnordered = []; @@ -2403,8 +2415,7 @@ void checkMemberNameConflictsInExtensions(BindingDiagnosticBag diagnostics) var extension = item; Dictionary, ImmutableArray> membersByNameToMerge = ((SourceMemberContainerTypeSymbol)extension).GetMembersByName(); - if (membersByNameToMerge.Count == 0 || - (membersByNameToMerge.Count == 1 && membersByNameToMerge.Values.Single() is [SynthesizedExtensionMarker])) + if (membersByNameToMerge.Count == 0) { continue; // This is an optimization } @@ -2480,64 +2491,15 @@ static ImmutableArray concatMembers(ImmutableArray existingMembe } } - internal readonly struct ExtensionGroupingKey : IEquatable + private void CheckSpecialMemberErrors(BindingDiagnosticBag diagnostics) { - public readonly NamedTypeSymbol NormalizedExtension; - - public ExtensionGroupingKey(NamedTypeSymbol extension) - { - if (extension.Arity != 0) - { - extension = extension.Construct(IndexedTypeParameterSymbol.Take(extension.Arity)); - } - - NormalizedExtension = extension; - } - - private readonly int ExtensionArity - { - get - { - return NormalizedExtension.Arity; - } - } - - private readonly TypeSymbol ReceiverType - { - get - { - if (NormalizedExtension.ExtensionParameter is { } receiverParameter) - { - return receiverParameter.Type; - } - else - { - return ErrorTypeSymbol.UnknownResultType; - } - } - } - - public bool Equals(ExtensionGroupingKey other) - { - return ExtensionArity == other.ExtensionArity && - ReceiverType.Equals(other.ReceiverType, TypeCompareKind.AllIgnoreOptions); - } - - public override bool Equals([NotNullWhen(true)] object? obj) - { - Debug.Assert(false); // Usage of this method is unexpected - return Equals((ExtensionGroupingKey)obj!); - } + var conversions = this.ContainingAssembly.CorLibrary.TypeConversions; - public override int GetHashCode() + if (this.IsExtension) { - return ReceiverType.GetHashCode(); + ((SourceNamedTypeSymbol)this).TryGetOrCreateExtensionMarker()?.AfterAddingTypeMembersChecks(conversions, diagnostics); } - } - private void CheckSpecialMemberErrors(BindingDiagnosticBag diagnostics) - { - var conversions = this.ContainingAssembly.CorLibrary.TypeConversions; foreach (var member in this.GetMembersUnordered()) { member.AfterAddingTypeMembersChecks(conversions, diagnostics); @@ -3849,10 +3811,6 @@ private void AddSynthesizedMembers(MembersAndInitializersBuilder builder, Declar } break; - case TypeKind.Extension: - AddSynthesizedExtensionMarker(builder, declaredMembersAndInitializers); - break; - default: break; } @@ -3878,20 +3836,6 @@ private void AddSynthesizedExtensionImplementationsIfNecessary(MembersAndInitial } } - private void AddSynthesizedExtensionMarker(MembersAndInitializersBuilder builder, DeclaredMembersAndInitializers declaredMembersAndInitializers) - { - var marker = CreateSynthesizedExtensionMarker(); - if (marker is not null) - { - builder.AddNonTypeMember(this, marker, declaredMembersAndInitializers); - } - } - - protected virtual MethodSymbol? CreateSynthesizedExtensionMarker() - { - throw ExceptionUtilities.Unreachable(); - } - private void AddDeclaredNontypeMembers(DeclaredMembersAndInitializersBuilder builder, BindingDiagnosticBag diagnostics) { foreach (var decl in this.declaration.Declarations) @@ -5893,6 +5837,14 @@ private void AddAccessorIfAvailable(ArrayBuilder symbols, MethodSymbol? private byte? ComputeNullableContextValue() { + if (IsExtension) + { + // PROTOTYPE: Figure out how to calculate and emit this for extensions. + // We probably should do that per grouping type. Leaving as is should be fine too, I think. + // Otherwise, marker method should be processed explicitly because it is not among members. + return null; + } + var compilation = DeclaringCompilation; if (!compilation.ShouldEmitNullableAttributes(this)) { @@ -6042,6 +5994,19 @@ public sealed override NamedTypeSymbol ConstructedFrom get { return this; } } + internal ExtensionGroupingInfo GetExtensionGroupingInfo() + { + Debug.Assert(this.declaration.ContainsExtensionDeclarations); + + if (_lazyExtensionGroupingInfo is null) + { + // PROTOTYPE: Find the right place and perform checks for conflicting declarations getting into the same group or marker, and reporting appropriate errors. + Interlocked.CompareExchange(ref _lazyExtensionGroupingInfo, new ExtensionGroupingInfo(this), null); + } + + return _lazyExtensionGroupingInfo; + } + internal class SynthesizedExplicitImplementations { public static readonly SynthesizedExplicitImplementations Empty = new SynthesizedExplicitImplementations(ImmutableArray.Empty, diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cs index 646c056f435f9..97c9e57620e07 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbol.cs @@ -231,6 +231,11 @@ SynthesizedEventAccessorSymbol or ImmutableArray.Create(new TypedConstant(compilation.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, nameof(CompilerFeatureRequiredFeatures.UserDefinedCompoundAssignmentOperators))) )); } + + if (target.GetIsNewExtensionMember()) + { + AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeExtensionMarkerNameAttribute(target, ((SourceNamedTypeSymbol)target.ContainingType).GetExtensionMarkerMetadataName())); + } } internal static bool IsInstanceIncrementDecrementOrCompoundAssignmentOperator(MethodSymbol target) diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs index fbc9121fa8658..88ae4fb41c8f0 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs @@ -1826,11 +1826,21 @@ public override string MetadataName get { return IsExtension - ? MetadataHelpers.ComposeAritySuffixedMetadataName(this.ExtensionName, Arity, associatedFileIdentifier: null) + ? GetExtensionMarkerMetadataName() : base.MetadataName; } } + internal override bool MangleName + { + get + { + return IsExtension + ? false + : base.MangleName; + } + } + protected override void AfterMembersCompletedChecks(BindingDiagnosticBag diagnostics) { base.AfterMembersCompletedChecks(diagnostics); diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol_Extension.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol_Extension.cs index a1d1dfa2808e1..90747cc25e2e5 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol_Extension.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol_Extension.cs @@ -9,7 +9,9 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.IO.Hashing; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Threading; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -27,6 +29,8 @@ private class ExtensionInfo public MethodSymbol? LazyExtensionMarker = ErrorMethodSymbol.UnknownMethod; public ParameterSymbol? LazyExtensionParameter; public ImmutableDictionary? LazyImplementationMap; + public string? LazyExtensionGroupingName; + public string? LazyExtensionMarkerName; } internal override string ExtensionName @@ -38,31 +42,7 @@ internal override string ExtensionName throw ExceptionUtilities.Unreachable(); } - MergedNamespaceOrTypeDeclaration declaration; - if (ContainingType is not null) - { - declaration = ((SourceNamedTypeSymbol)this.ContainingType).declaration; - } - else - { - declaration = ((SourceNamespaceSymbol)this.ContainingSymbol).MergedDeclaration; - } - - int index = 0; - foreach (Declaration child in declaration.Children) - { - if (child == this.declaration) - { - return GeneratedNames.MakeExtensionName(index); - } - - if (child.Kind == DeclarationKind.Extension) - { - index++; - } - } - - throw ExceptionUtilities.Unreachable(); + return GetExtensionGroupingMetadataName(); // PROTOTYPE: is this the right value to return? } } @@ -1092,13 +1072,8 @@ internal sealed override ParameterSymbol? ExtensionParameter return _lazyExtensionInfo.LazyImplementationMap.GetValueOrDefault(method); } - protected sealed override MethodSymbol? CreateSynthesizedExtensionMarker() - { - return TryGetOrCreateExtensionMarker(); - } - [MemberNotNull(nameof(_lazyExtensionInfo))] - private MethodSymbol? TryGetOrCreateExtensionMarker() + internal MethodSymbol? TryGetOrCreateExtensionMarker() { Debug.Assert(IsExtension); @@ -1132,6 +1107,67 @@ internal sealed override ParameterSymbol? ExtensionParameter } } + public string GetExtensionGroupingMetadataName() + { + Debug.Assert(IsExtension); + + if (_lazyExtensionInfo is null) + { + Interlocked.CompareExchange(ref _lazyExtensionInfo, new ExtensionInfo(), null); + } + + if (_lazyExtensionInfo.LazyExtensionGroupingName is null) + { + _lazyExtensionInfo.LazyExtensionGroupingName = WellKnownMemberNames.ExtensionMarkerMethodName + RawNameToHashString(ComputeExtensionGroupingRawName()); + } + + return _lazyExtensionInfo.LazyExtensionGroupingName; + } + + public string GetExtensionMarkerMetadataName() + { + Debug.Assert(IsExtension); + + if (_lazyExtensionInfo is null) + { + Interlocked.CompareExchange(ref _lazyExtensionInfo, new ExtensionInfo(), null); + } + + if (_lazyExtensionInfo.LazyExtensionMarkerName is null) + { + _lazyExtensionInfo.LazyExtensionMarkerName = "$" + RawNameToHashString(ComputeExtensionMarkerRawName()); // PROTOTYPE: Add a constant for this prefix. + } + + return _lazyExtensionInfo.LazyExtensionMarkerName; + } + + private static string RawNameToHashString(string rawName) + { + Span hash = stackalloc byte[16]; + + ReadOnlySpan charSpan = rawName.AsSpan(); + + // Ensure everything is always little endian, so we get the same results across all platforms. + // This will be entirely elided by the jit on a little endian machine. + if (!BitConverter.IsLittleEndian) + { + Span shortSpan = stackalloc short[charSpan.Length]; + + MemoryMarshal.Cast(charSpan).CopyTo(shortSpan); + Text.SourceText.ReverseEndianness(shortSpan); + + int bytesWritten = XxHash128.Hash(MemoryMarshal.AsBytes(shortSpan), hash); + Debug.Assert(bytesWritten == hash.Length); + } + else + { + int bytesWritten = XxHash128.Hash(MemoryMarshal.AsBytes(charSpan), hash); + Debug.Assert(bytesWritten == hash.Length); + } + + return CodeAnalysis.CodeGen.PrivateImplementationDetails.HashToHex(hash); + } + internal static Symbol? GetCompatibleSubstitutedMember(CSharpCompilation compilation, Symbol extensionMember, TypeSymbol receiverType) { Debug.Assert(extensionMember.GetIsNewExtensionMember()); diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs index e895883fcbef2..e1a8e847824a7 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs @@ -263,9 +263,14 @@ internal override void AfterAddingTypeMembersChecks(ConversionsBase conversions, ParameterHelpers.EnsureNullableAttributeExists(compilation, this, Parameters, diagnostics, modifyCompilation: true); - if (this.GetIsNewExtensionMember() && MethodKind != MethodKind.Ordinary) + if (this.GetIsNewExtensionMember()) { - ParameterHelpers.CheckUnderspecifiedGenericExtension(this, Parameters, diagnostics); + if (MethodKind != MethodKind.Ordinary) + { + ParameterHelpers.CheckUnderspecifiedGenericExtension(this, Parameters, diagnostics); + } + + compilation.EnsureExtensionMarkerNameAttributeExists(diagnostics, GetFirstLocation(), modifyCompilation: true); } Location getReturnTypeLocation() diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbolBase.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbolBase.cs index 871ad99a6f392..a8b2d6c787a31 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbolBase.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbolBase.cs @@ -1066,6 +1066,8 @@ internal override void AfterAddingTypeMembersChecks(ConversionsBase conversions, if (this.GetIsNewExtensionMember()) { ParameterHelpers.CheckUnderspecifiedGenericExtension(this, Parameters, diagnostics); + + compilation.EnsureExtensionMarkerNameAttributeExists(diagnostics, GetFirstLocation(), modifyCompilation: true); } } @@ -1425,6 +1427,11 @@ internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, r ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_RequiredMemberAttribute__ctor)); } + + if (this.GetIsNewExtensionMember()) + { + AddSynthesizedAttribute(ref attributes, moduleBuilder.SynthesizeExtensionMarkerNameAttribute(this, ((SourceNamedTypeSymbol)this.ContainingType).GetExtensionMarkerMetadataName())); + } } internal sealed override bool IsDirectlyExcludedFromCodeCoverage => diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol.cs new file mode 100644 index 0000000000000..37df0ecf5f278 --- /dev/null +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Immutable; +using System.Diagnostics; + +namespace Microsoft.CodeAnalysis.CSharp.Symbols +{ + // PROTOTYPE: Test the shape and various scenarios when the attribute should and should not be synthesized. + // PROTOTYPE: We are not declaring and not initializing the "Name" property yet. + internal sealed class SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol : SynthesizedEmbeddedAttributeSymbolBase + { + private readonly ImmutableArray _constructors; + + public SynthesizedEmbeddedExtensionMarkerNameAttributeSymbol( + string name, + NamespaceSymbol containingNamespace, + ModuleSymbol containingModule, + NamedTypeSymbol systemAttributeType, + TypeSymbol systemStringType) + : base(name, containingNamespace, containingModule, baseType: systemAttributeType) + { + _constructors = ImmutableArray.Create( + new SynthesizedEmbeddedAttributeConstructorSymbol( + this, + m => ImmutableArray.Create(SynthesizedParameterSymbol.Create(m, TypeWithAnnotations.Create(systemStringType), 0, RefKind.None, name: "name")))); + + // Ensure we never get out of sync with the description + Debug.Assert(_constructors.Length == AttributeDescription.ExtensionMarkerNameAttribute.Signatures.Length); + } + + public override ImmutableArray Constructors => _constructors; + + internal override AttributeUsageInfo GetAttributeUsageInfo() + { + return new AttributeUsageInfo( + AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | + AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, + allowMultiple: false, inherited: false); + } + } +} diff --git a/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs index af338d16da8bb..9133746546741 100644 --- a/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/TypeSymbol.cs @@ -556,7 +556,7 @@ public virtual bool IsAnonymousType internal virtual bool IsNativeIntegerWrapperType => false; #nullable enable - public bool IsExtension + public virtual bool IsExtension => TypeKind == TypeKind.Extension; /// diff --git a/src/Compilers/CSharp/Test/Emit/Emit/DynamicAnalysis/DynamicInstrumentationTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/DynamicAnalysis/DynamicInstrumentationTests.cs index 5cce98de1e34c..306ddc60a8a10 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/DynamicAnalysis/DynamicInstrumentationTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/DynamicAnalysis/DynamicInstrumentationTests.cs @@ -3644,8 +3644,8 @@ static class C "; var verifier = CompileAndVerify(source + InstrumentationHelperSource, options: TestOptions.ReleaseDll); - AssertNotInstrumented(verifier, "C.<>E__0.M1"); - AssertNotInstrumented(verifier, "C.<>E__0.M2"); + AssertNotInstrumented(verifier, "C.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M1"); + AssertNotInstrumented(verifier, "C.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M2"); AssertNotInstrumented(verifier, "C.M1"); AssertInstrumented(verifier, "C.M2"); @@ -3671,13 +3671,13 @@ static class C "; var verifier = CompileAndVerify(source + InstrumentationHelperSource, options: TestOptions.ReleaseDll); - AssertNotInstrumented(verifier, "C.<>E__0.P1.get"); - AssertNotInstrumented(verifier, "C.<>E__0.P1.set"); + AssertNotInstrumented(verifier, "C.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P1.get"); + AssertNotInstrumented(verifier, "C.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P1.set"); AssertNotInstrumented(verifier, "C.get_P1"); AssertNotInstrumented(verifier, "C.set_P1"); - AssertNotInstrumented(verifier, "C.<>E__0.P2.get"); - AssertNotInstrumented(verifier, "C.<>E__0.P2.set"); + AssertNotInstrumented(verifier, "C.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P2.get"); + AssertNotInstrumented(verifier, "C.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P2.set"); AssertInstrumented(verifier, "C.get_P2"); AssertInstrumented(verifier, "C.set_P2"); } diff --git a/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs b/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs index 0308f927e18f5..1a75493128b40 100644 --- a/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs +++ b/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs @@ -3647,35 +3647,49 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2072 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::'$' + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 '' - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x206f - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname static class C2 op_UnaryNegation ( class C2 x ) cil managed { - // Method begins at RVA 0x2071 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 30 43 + 32 30 39 30 38 33 33 46 39 34 36 30 42 36 46 31 + 38 36 45 45 43 32 31 43 45 33 42 30 00 00 + ) + // Method begins at RVA 0x206f // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_UnaryNegation - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_UnaryNegation + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static pinvokeimpl("something.dll" winapi) class C2 op_UnaryNegation ( @@ -3721,35 +3735,49 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2072 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::'$' + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 '' - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x206f - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname static class C2 op_UnaryNegation ( class C2 x ) cil managed { - // Method begins at RVA 0x2071 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 30 43 + 32 30 39 30 38 33 33 46 39 34 36 30 42 36 46 31 + 38 36 45 45 43 32 31 43 45 33 42 30 00 00 + ) + // Method begins at RVA 0x206f // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_UnaryNegation - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_UnaryNegation + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static class C2 op_UnaryNegation ( @@ -3787,35 +3815,49 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2072 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::'$' + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 '' - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x206f - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname static class C2 op_UnaryNegation ( class C2 x ) cil managed { - // Method begins at RVA 0x2071 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 30 43 + 32 30 39 30 38 33 33 46 39 34 36 30 42 36 46 31 + 38 36 45 45 43 32 31 43 45 33 42 30 00 00 + ) + // Method begins at RVA 0x206f // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_UnaryNegation - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_UnaryNegation + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static class C2 op_UnaryNegation ( @@ -3856,8 +3898,8 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - - + + """, e.GetDocumentationCommentXml()); @@ -3865,8 +3907,8 @@ public struct S1; var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(S1).operator " + op + ", S1 E.<>E__0." + opName + "(S1 x))", - "(E.extension(S1).operator " + op + "(S1), S1 E.<>E__0." + opName + "(S1 x))"], + "(E.extension(S1).operator " + op + ", S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x))", + "(E.extension(S1).operator " + op + "(S1), S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -3898,14 +3940,14 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(S1).operator " + op + "(S1), S1 E.<>E__0." + opName + "(S1 x))"], + AssertEx.Equal(["(E.extension(S1).operator " + op + "(S1), S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -3938,14 +3980,14 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(S1).operator checked -(S1), S1 E.<>E__0." + opName + "(S1 x))"], + AssertEx.Equal(["(E.extension(S1).operator checked -(S1), S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -3982,10 +4024,10 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - - - - + + + + """, e.GetDocumentationCommentXml()); @@ -3993,10 +4035,10 @@ public struct S1; var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(S1).operator true, System.Boolean E.<>E__0." + trueName + "(S1 x))", - "(E.extension(S1).operator true(S1), System.Boolean E.<>E__0." + trueName + "(S1 x))", - "(E.extension(S1).operator false, System.Boolean E.<>E__0." + falseName + "(S1 x))", - "(E.extension(S1).operator false(S1), System.Boolean E.<>E__0." + falseName + "(S1 x))"], + "(E.extension(S1).operator true, System.Boolean E.$78CFE6F93D970DBBE44B05C24FFEB91E." + trueName + "(S1 x))", + "(E.extension(S1).operator true(S1), System.Boolean E.$78CFE6F93D970DBBE44B05C24FFEB91E." + trueName + "(S1 x))", + "(E.extension(S1).operator false, System.Boolean E.$78CFE6F93D970DBBE44B05C24FFEB91E." + falseName + "(S1 x))", + "(E.extension(S1).operator false(S1), System.Boolean E.$78CFE6F93D970DBBE44B05C24FFEB91E." + falseName + "(S1 x))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -9867,23 +9909,32 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$A5B9DA57687B6EBB6576FC573B145969' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 x + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$A5B9DA57687B6EBB6576FC573B145969'::'$' + } // end of class $A5B9DA57687B6EBB6576FC573B145969 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 x - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2097 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname instance void op_DecrementAssignment () cil managed { @@ -9892,13 +9943,18 @@ 01 00 26 55 73 65 72 44 65 66 69 6e 65 64 43 6f 6d 70 6f 75 6e 64 41 73 73 69 67 6e 6d 65 6e 74 4f 70 65 72 61 74 6f 72 73 00 00 ) - // Method begins at RVA 0x2099 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 41 35 42 39 + 44 41 35 37 36 38 37 42 36 45 42 42 36 35 37 36 + 46 43 35 37 33 42 31 34 35 39 36 39 00 00 + ) + // Method begins at RVA 0x2097 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_DecrementAssignment - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_DecrementAssignment + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static pinvokeimpl("something.dll" winapi) void op_DecrementAssignment ( @@ -9946,23 +10002,32 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$A5B9DA57687B6EBB6576FC573B145969' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 x + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$A5B9DA57687B6EBB6576FC573B145969'::'$' + } // end of class $A5B9DA57687B6EBB6576FC573B145969 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 x - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2097 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname instance void op_DecrementAssignment () cil managed { @@ -9971,13 +10036,18 @@ 01 00 26 55 73 65 72 44 65 66 69 6e 65 64 43 6f 6d 70 6f 75 6e 64 41 73 73 69 67 6e 6d 65 6e 74 4f 70 65 72 61 74 6f 72 73 00 00 ) - // Method begins at RVA 0x2099 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 41 35 42 39 + 44 41 35 37 36 38 37 42 36 45 42 42 36 35 37 36 + 46 43 35 37 33 42 31 34 35 39 36 39 00 00 + ) + // Method begins at RVA 0x2097 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_DecrementAssignment - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_DecrementAssignment + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static void op_DecrementAssignment ( @@ -10017,23 +10087,32 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$A5B9DA57687B6EBB6576FC573B145969' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 x + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$A5B9DA57687B6EBB6576FC573B145969'::'$' + } // end of class $A5B9DA57687B6EBB6576FC573B145969 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 x - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2097 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname instance void op_DecrementAssignment () cil managed { @@ -10042,13 +10121,18 @@ 01 00 26 55 73 65 72 44 65 66 69 6e 65 64 43 6f 6d 70 6f 75 6e 64 41 73 73 69 67 6e 6d 65 6e 74 4f 70 65 72 61 74 6f 72 73 00 00 ) - // Method begins at RVA 0x2099 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 41 35 42 39 + 44 41 35 37 36 38 37 42 36 45 42 42 36 35 37 36 + 46 43 35 37 33 42 31 34 35 39 36 39 00 00 + ) + // Method begins at RVA 0x2097 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_DecrementAssignment - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_DecrementAssignment + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static void op_DecrementAssignment ( @@ -10089,8 +10173,8 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - - + + """, e.GetDocumentationCommentXml()); @@ -10098,8 +10182,8 @@ public struct S1; var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(S1).operator " + op + ", S1 E.<>E__0." + opName + "(S1 x))", - "(E.extension(S1).operator " + op + "(S1), S1 E.<>E__0." + opName + "(S1 x))"], + "(E.extension(S1).operator " + op + ", S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x))", + "(E.extension(S1).operator " + op + "(S1), S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -10131,14 +10215,14 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(ref S1).operator " + op + "(), void E.<>E__0." + opName + "())"], + AssertEx.Equal(["(E.extension(ref S1).operator " + op + "(), void E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "())"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -10173,8 +10257,8 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - - + + """, e.GetDocumentationCommentXml()); @@ -10182,8 +10266,8 @@ public struct S1; var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(S1).operator checked " + op + ", S1 E.<>E__0." + opName + "(S1 x))", - "(E.extension(S1).operator checked " + op + "(S1), S1 E.<>E__0." + opName + "(S1 x))"], + "(E.extension(S1).operator checked " + op + ", S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x))", + "(E.extension(S1).operator checked " + op + "(S1), S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -10217,14 +10301,14 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(ref S1).operator checked " + op + "(), void E.<>E__0." + opName + "())"], + AssertEx.Equal(["(E.extension(ref S1).operator checked " + op + "(), void E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "())"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -18383,36 +18467,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2072 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::'$' + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 '' - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x206f - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname static class C2 op_Subtraction ( class C2 x, class C2 y ) cil managed { - // Method begins at RVA 0x2071 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 30 43 + 32 30 39 30 38 33 33 46 39 34 36 30 42 36 46 31 + 38 36 45 45 43 32 31 43 45 33 42 30 00 00 + ) + // Method begins at RVA 0x206f // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_Subtraction - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_Subtraction + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static pinvokeimpl("something.dll" winapi) class C2 op_Subtraction ( @@ -18459,36 +18557,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2072 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::'$' + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 '' - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x206f - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname static class C2 op_Subtraction ( class C2 x, class C2 y ) cil managed { - // Method begins at RVA 0x2071 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 30 43 + 32 30 39 30 38 33 33 46 39 34 36 30 42 36 46 31 + 38 36 45 45 43 32 31 43 45 33 42 30 00 00 + ) + // Method begins at RVA 0x206f // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_Subtraction - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_Subtraction + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static class C2 op_Subtraction ( @@ -18527,36 +18639,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2072 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::'$' + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 '' - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x206f - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname static class C2 op_Subtraction ( class C2 x, class C2 y ) cil managed { - // Method begins at RVA 0x2071 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 30 43 + 32 30 39 30 38 33 33 46 39 34 36 30 42 36 46 31 + 38 36 45 45 43 32 31 43 45 33 42 30 00 00 + ) + // Method begins at RVA 0x206f // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_Subtraction - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_Subtraction + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static class C2 op_Subtraction ( @@ -19245,8 +19371,8 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - - + + """, e.GetDocumentationCommentXml()); @@ -19254,8 +19380,8 @@ public struct S1; var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(S1).operator " + ToCRefOp(op) + ", S1 E.<>E__0." + opName + "(S1 x, S1 y))", - "(E.extension(S1).operator " + ToCRefOp(op) + "(S1, S1), S1 E.<>E__0." + opName + "(S1 x, S1 y))"], + "(E.extension(S1).operator " + ToCRefOp(op) + ", S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x, S1 y))", + "(E.extension(S1).operator " + ToCRefOp(op) + "(S1, S1), S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x, S1 y))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -19290,8 +19416,8 @@ public struct S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - - + + """, e.GetDocumentationCommentXml()); @@ -19299,8 +19425,8 @@ public struct S1; var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(S1).operator checked " + ToCRefOp(op) + ", S1 E.<>E__0." + opName + "(S1 x, S1 y))", - "(E.extension(S1).operator checked " + ToCRefOp(op) + "(S1, S1), S1 E.<>E__0." + opName + "(S1 x, S1 y))"], + "(E.extension(S1).operator checked " + ToCRefOp(op) + ", S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x, S1 y))", + "(E.extension(S1).operator checked " + ToCRefOp(op) + "(S1, S1), S1 E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 x, S1 y))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -26467,23 +26593,32 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$A5B9DA57687B6EBB6576FC573B145969' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 x + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$A5B9DA57687B6EBB6576FC573B145969'::'$' + } // end of class $A5B9DA57687B6EBB6576FC573B145969 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 x - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2097 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname instance void op_SubtractionAssignment ( class C2 y @@ -26494,13 +26629,18 @@ 01 00 26 55 73 65 72 44 65 66 69 6e 65 64 43 6f 6d 70 6f 75 6e 64 41 73 73 69 67 6e 6d 65 6e 74 4f 70 65 72 61 74 6f 72 73 00 00 ) - // Method begins at RVA 0x2099 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 41 35 42 39 + 44 41 35 37 36 38 37 42 36 45 42 42 36 35 37 36 + 46 43 35 37 33 42 31 34 35 39 36 39 00 00 + ) + // Method begins at RVA 0x2097 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_SubtractionAssignment - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_SubtractionAssignment + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static pinvokeimpl("something.dll" winapi) void op_SubtractionAssignment ( @@ -26549,23 +26689,32 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$A5B9DA57687B6EBB6576FC573B145969' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 x + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$A5B9DA57687B6EBB6576FC573B145969'::'$' + } // end of class $A5B9DA57687B6EBB6576FC573B145969 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 x - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2097 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname instance void op_SubtractionAssignment ( class C2 y @@ -26576,13 +26725,18 @@ 01 00 26 55 73 65 72 44 65 66 69 6e 65 64 43 6f 6d 70 6f 75 6e 64 41 73 73 69 67 6e 6d 65 6e 74 4f 70 65 72 61 74 6f 72 73 00 00 ) - // Method begins at RVA 0x2099 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 41 35 42 39 + 44 41 35 37 36 38 37 42 36 45 42 42 36 35 37 36 + 46 43 35 37 33 42 31 34 35 39 36 39 00 00 + ) + // Method begins at RVA 0x2097 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_SubtractionAssignment - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_SubtractionAssignment + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static void op_SubtractionAssignment ( @@ -26623,23 +26777,32 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$3D0C2090833F9460B6F186EEC21CE3B0' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$A5B9DA57687B6EBB6576FC573B145969' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C2 x + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$A5B9DA57687B6EBB6576FC573B145969'::'$' + } // end of class $A5B9DA57687B6EBB6576FC573B145969 // Methods - .method private hidebysig specialname static - void '$' ( - class C2 x - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2097 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname instance void op_SubtractionAssignment ( class C2 y @@ -26650,13 +26813,18 @@ 01 00 26 55 73 65 72 44 65 66 69 6e 65 64 43 6f 6d 70 6f 75 6e 64 41 73 73 69 67 6e 6d 65 6e 74 4f 70 65 72 61 74 6f 72 73 00 00 ) - // Method begins at RVA 0x2099 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 41 35 42 39 + 44 41 35 37 36 38 37 42 36 45 42 42 36 35 37 36 + 46 43 35 37 33 42 31 34 35 39 36 39 00 00 + ) + // Method begins at RVA 0x2097 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::op_SubtractionAssignment - } // end of class <>E__0 + } // end of method '$3D0C2090833F9460B6F186EEC21CE3B0'::op_SubtractionAssignment + } // end of class $3D0C2090833F9460B6F186EEC21CE3B0 // Methods .method public hidebysig static void op_SubtractionAssignment ( @@ -26698,8 +26866,8 @@ public class S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - - + + """, e.GetDocumentationCommentXml()); @@ -26707,8 +26875,8 @@ public class S1; var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(S1).operator " + ToCRefOp(op) + ", void E.<>E__0." + opName + "(S1 y))", - "(E.extension(S1).operator " + ToCRefOp(op) + "(S1), void E.<>E__0." + opName + "(S1 y))"], + "(E.extension(S1).operator " + ToCRefOp(op) + ", void E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 y))", + "(E.extension(S1).operator " + ToCRefOp(op) + "(S1), void E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 y))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } @@ -26743,8 +26911,8 @@ public class S1; var e = comp.GetMember("E"); AssertEx.Equal($$$""" - - + + """, e.GetDocumentationCommentXml()); @@ -26752,8 +26920,8 @@ public class S1; var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(S1).operator checked " + ToCRefOp(op) + ", void E.<>E__0." + opName + "(S1 y))", - "(E.extension(S1).operator checked " + ToCRefOp(op) + "(S1), void E.<>E__0." + opName + "(S1 y))"], + "(E.extension(S1).operator checked " + ToCRefOp(op) + ", void E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 y))", + "(E.extension(S1).operator checked " + ToCRefOp(op) + "(S1), void E.$78CFE6F93D970DBBE44B05C24FFEB91E." + opName + "(S1 y))"], ExtensionTests.PrintXmlCrefSymbols(tree, model)); } diff --git a/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests.cs b/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests.cs index 2628ca1f35626..2b32e662454ca 100644 --- a/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests.cs +++ b/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests.cs @@ -27,6 +27,33 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics; [CompilerTrait(CompilerFeature.Extensions)] public partial class ExtensionTests : CompilingTestBase { + + internal string ExtensionMarkerNameAttributeIL = """ + +.class public auto ansi sealed beforefieldinit System.Runtime.CompilerServices.ExtensionMarkerNameAttribute + extends [mscorlib]System.Attribute +{ + .custom instance void [mscorlib]System.AttributeUsageAttribute::.ctor(valuetype [mscorlib]System.AttributeTargets) = ( + 01 00 ff 7f 00 00 01 00 54 02 09 49 6e 68 65 72 + 69 74 65 64 00 + ) + + .method public hidebysig specialname rtspecialname + instance void .ctor ( + string name + ) cil managed + { + .maxstack 8 + + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Attribute::.ctor() + IL_0006: nop + IL_0007: nop + IL_0008: ret + } +} +"""; + private static string ExpectedOutput(string output) { return ExecutionConditionUtil.IsMonoOrCoreClr ? output : null; @@ -84,7 +111,7 @@ private static void AssertExtensionDeclaration(INamedTypeSymbol symbol) Assert.Null(symbol.NativeIntegerUnderlyingType); Assert.Equal(SymbolKind.NamedType, symbol.Kind); - Assert.Equal("", symbol.Name); + AssertEx.Equal("", symbol.Name); Assert.Equal(SpecialType.None, symbol.SpecialType); Assert.True(symbol.IsDefinition); Assert.False(symbol.IsStatic); @@ -123,24 +150,32 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [netstandard]System.Object { - // Methods - .method private hidebysig specialname static - void '$' ( - object '' - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - } // end of class <>E__0 + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::'$' + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 } // end of class Extensions """); @@ -163,24 +198,24 @@ .maxstack 8 Assert.Empty(symbol.TypeArguments); Assert.Same(symbol, symbol.OriginalDefinition); Assert.Same(symbol, symbol.ConstructedFrom); - Assert.Equal("Extensions", symbol.ContainingSymbol.Name); - Assert.Equal("Extensions", symbol.ContainingType.Name); - Assert.Equal("<>E__0", symbol.MetadataName); + AssertEx.Equal("Extensions", symbol.ContainingSymbol.Name); + AssertEx.Equal("Extensions", symbol.ContainingType.Name); + AssertEx.Equal("$C43E2675C7BBF9284AF22FB8A9BF0280", symbol.MetadataName); var member = symbol.ContainingType.GetMembers().Single(); - Assert.Equal("Extensions.<>E__0", member.ToTestDisplayString()); + AssertEx.Equal("Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280", member.ToTestDisplayString()); var format = new SymbolDisplayFormat(typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces); - Assert.Equal("Extensions.extension(System.Object)", symbol.ToDisplayString(format)); + AssertEx.Equal("Extensions.extension(System.Object)", symbol.ToDisplayString(format)); format = new SymbolDisplayFormat(kindOptions: SymbolDisplayKindOptions.IncludeTypeKeyword); - Assert.Equal("extension(Object)", symbol.ToDisplayString(format)); + AssertEx.Equal("extension(Object)", symbol.ToDisplayString(format)); format = new SymbolDisplayFormat(); - Assert.Equal("extension(Object)", symbol.ToDisplayString(format)); + AssertEx.Equal("extension(Object)", symbol.ToDisplayString(format)); format = new SymbolDisplayFormat(compilerInternalOptions: SymbolDisplayCompilerInternalOptions.UseMetadataMemberNames); - Assert.Equal("<>E__0", symbol.ToDisplayString(format)); + AssertEx.Equal("$C43E2675C7BBF9284AF22FB8A9BF0280", symbol.ToDisplayString(format)); var comp5 = CreateCompilation(src); comp5.MakeMemberMissing(WellKnownMember.System_Runtime_CompilerServices_ExtensionAttribute__ctor); @@ -213,24 +248,32 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$8048A6C8BE30A622530249B904B537EB'<$T0> extends [netstandard]System.Object { - // Methods - .method private hidebysig specialname static - void '$' ( - !T '' - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' - } // end of class <>E__0`1 + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$01CE3801593377B4E240F33E20D30D50' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + !T '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$01CE3801593377B4E240F33E20D30D50'::'$' + } // end of class $01CE3801593377B4E240F33E20D30D50 + } // end of class $8048A6C8BE30A622530249B904B537EB } // end of class Extensions """); @@ -244,27 +287,27 @@ .maxstack 8 Assert.Equal(1, symbol.Arity); Assert.True(symbol.IsGenericType); Assert.False(symbol.IsUnboundGenericType); - Assert.Equal(["T"], symbol.TypeParameters.ToTestDisplayStrings()); - Assert.Equal(["T"], symbol.TypeArguments.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T"], symbol.TypeParameters.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T"], symbol.TypeArguments.ToTestDisplayStrings()); Assert.Same(symbol, symbol.OriginalDefinition); Assert.Same(symbol, symbol.ConstructedFrom); - Assert.Equal("Extensions", symbol.ContainingSymbol.Name); - Assert.Equal("Extensions", symbol.ContainingType.Name); - Assert.Equal("<>E__0`1", symbol.MetadataName); + AssertEx.Equal("Extensions", symbol.ContainingSymbol.Name); + AssertEx.Equal("Extensions", symbol.ContainingType.Name); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol.MetadataName); var member = symbol.ContainingType.GetMembers().Single(); - Assert.Equal("Extensions.<>E__0", member.ToTestDisplayString()); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", member.ToTestDisplayString()); var constructed = symbol.Construct(comp.GetSpecialType(SpecialType.System_Int32)); Assert.True(constructed.IsExtension); - Assert.Equal("Extensions.<>E__0", constructed.ToTestDisplayString()); - Assert.Equal("<>E__0`1", constructed.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", constructed.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", constructed.MetadataName); Assert.NotSame(symbol, constructed); Assert.Same(symbol, constructed.OriginalDefinition); Assert.Same(symbol, constructed.ConstructedFrom); var unbound = symbol.ConstructUnboundGenericType(); - Assert.Equal("Extensions.<>E__0<>", unbound.ToTestDisplayString()); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB<>", unbound.ToTestDisplayString()); Assert.True(unbound.IsUnboundGenericType); Assert.NotSame(symbol, unbound); Assert.Same(symbol, unbound.OriginalDefinition); @@ -293,24 +336,32 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$BCF902721DDD961E5243C324D8379E5C' extends [netstandard]System.Object { - // Methods - .method private hidebysig specialname static - void '$' ( - !T '' - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' - } // end of class <>E__0`1 + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$B865B3ED3C68CE2EBBC104FFAF3CFF93' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + !T '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$B865B3ED3C68CE2EBBC104FFAF3CFF93'::'$' + } // end of class $B865B3ED3C68CE2EBBC104FFAF3CFF93 + } // end of class $BCF902721DDD961E5243C324D8379E5C } // end of class Extensions """); @@ -322,14 +373,14 @@ .maxstack 8 Assert.Equal(1, symbol.Arity); Assert.True(symbol.IsGenericType); - Assert.Equal(["T"], symbol.TypeParameters.ToTestDisplayStrings()); - Assert.Equal(["T"], symbol.TypeArguments.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T"], symbol.TypeParameters.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T"], symbol.TypeArguments.ToTestDisplayStrings()); Assert.True(symbol.TypeParameters.Single().IsValueType); Assert.False(symbol.TypeParameters.Single().IsReferenceType); Assert.Empty(symbol.TypeParameters.Single().ConstraintTypes); var format = new SymbolDisplayFormat(genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters | SymbolDisplayGenericsOptions.IncludeTypeConstraints); - Assert.Equal("extension(T) where T : struct", symbol.ToDisplayString(format)); + AssertEx.Equal("extension(T) where T : struct", symbol.ToDisplayString(format)); } [Fact] @@ -382,8 +433,8 @@ public static class Extensions var symbol = model.GetDeclaredSymbol(extension); Assert.Equal(1, symbol.Arity); Assert.True(symbol.IsGenericType); - Assert.Equal(["out T"], symbol.TypeParameters.ToTestDisplayStrings()); - Assert.Equal(["out T"], symbol.TypeArguments.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["out T"], symbol.TypeParameters.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["out T"], symbol.TypeArguments.ToTestDisplayStrings()); } [Fact] @@ -411,8 +462,8 @@ public static class Extensions var symbol = model.GetDeclaredSymbol(extension); Assert.Equal(2, symbol.Arity); - Assert.Equal(["T", "T"], symbol.TypeParameters.ToTestDisplayStrings()); - Assert.Equal(["T", "T"], symbol.TypeArguments.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T", "T"], symbol.TypeParameters.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T", "T"], symbol.TypeArguments.ToTestDisplayStrings()); } [Fact] @@ -441,8 +492,8 @@ class C { } var symbol = model.GetDeclaredSymbol(extension); Assert.Equal(2, symbol.Arity); - Assert.Equal(["T", "T"], symbol.TypeParameters.ToTestDisplayStrings()); - Assert.Equal(["T", "T"], symbol.TypeArguments.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T", "T"], symbol.TypeParameters.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T", "T"], symbol.TypeArguments.ToTestDisplayStrings()); } [Fact] @@ -470,12 +521,12 @@ public static class Extensions var symbol = model.GetDeclaredSymbol(extension); Assert.Equal(1, symbol.Arity); - Assert.Equal(["T"], symbol.TypeParameters.ToTestDisplayStrings()); - Assert.Equal(["T"], symbol.TypeArguments.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T"], symbol.TypeParameters.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["T"], symbol.TypeArguments.ToTestDisplayStrings()); var container = symbol.ContainingType; var substitutedExtension = (INamedTypeSymbol)container.Construct(comp.GetSpecialType(SpecialType.System_Int32)).GetMembers().Single(); - Assert.Equal("Extensions.<>E__0", substitutedExtension.ToTestDisplayString()); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", substitutedExtension.ToTestDisplayString()); Assert.True(substitutedExtension.IsExtension); } @@ -500,7 +551,7 @@ public static class Extensions var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["record"], symbol.TypeParameters.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["record"], symbol.TypeParameters.ToTestDisplayStrings()); } [Fact] @@ -524,7 +575,7 @@ public static class Extensions var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["file"], symbol.TypeParameters.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["file"], symbol.TypeParameters.ToTestDisplayStrings()); } [Fact] @@ -567,27 +618,39 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$8048A6C8BE30A622530249B904B537EB'<$T0> extends [netstandard]System.Object { - .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( - 01 00 01 00 00 + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 ) - // Methods - .method private hidebysig specialname static - void '$' ( - !T '' - ) cil managed + // Nested Types + .class nested private auto ansi abstract sealed specialname '$C7A07C3975E80DE5DBC93B5392C6C922' + extends [netstandard]System.Object { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x209d - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' - } // end of class <>E__0`1 + .param type T + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( + 01 00 01 00 00 + ) + // Methods + .method private hidebysig specialname static + void '$' ( + !T '' + ) cil managed + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( + 01 00 01 00 00 + ) + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209d + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$C7A07C3975E80DE5DBC93B5392C6C922'::'$' + } // end of class $C7A07C3975E80DE5DBC93B5392C6C922 + } // end of class $8048A6C8BE30A622530249B904B537EB } // end of class Extensions """); } @@ -620,7 +683,7 @@ public static class Extensions AssertExtensionDeclaration(symbol); Assert.True(symbol.IsGenericType); var members = symbol.ContainingType.GetMembers(); - Assert.Equal(["Extensions.<>E__0", "void Extensions.M()"], members.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280", "void Extensions.M()"], members.ToTestDisplayStrings()); } [Fact] @@ -647,7 +710,7 @@ public void BadContainer_TopLevel() var symbol = model.GetDeclaredSymbol(extension); AssertExtensionDeclaration(symbol); Assert.Null(symbol.ContainingType); - Assert.Equal("<>E__0", symbol.ToTestDisplayString()); + AssertEx.Equal("$C43E2675C7BBF9284AF22FB8A9BF0280", symbol.ToTestDisplayString()); } [Fact] @@ -687,9 +750,9 @@ public static class Extensions2 var nestedExtensionSymbol = model.GetDeclaredSymbol(nestedExtension); AssertExtensionDeclaration(nestedExtensionSymbol); - Assert.Equal("Extensions.Extensions2", nestedExtensionSymbol.ContainingType.ToTestDisplayString()); + AssertEx.Equal("Extensions.Extensions2", nestedExtensionSymbol.ContainingType.ToTestDisplayString()); var members = nestedExtensionSymbol.ContainingType.GetMembers(); - Assert.Equal(["Extensions.Extensions2.<>E__0", "void Extensions.Extensions2.M()"], members.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["Extensions.Extensions2.$C43E2675C7BBF9284AF22FB8A9BF0280", "void Extensions.Extensions2.M()"], members.ToTestDisplayStrings()); } [Fact] @@ -737,8 +800,8 @@ static void Method() var nestedExtensionSymbol = model.GetDeclaredSymbol(nestedExtension); AssertExtensionDeclaration(nestedExtensionSymbol); - Assert.Equal("Extensions.<>E__0", nestedExtensionSymbol.ContainingType.ToTestDisplayString()); - Assert.Equal(["void Extensions.<>E__0.$(System.Object)", "void Extensions.<>E__0.Method()", "Extensions.<>E__0.<>E__0"], nestedExtensionSymbol.ContainingType.GetMembers().ToTestDisplayStrings()); + AssertEx.Equal("Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280", nestedExtensionSymbol.ContainingType.ToTestDisplayString()); + AssertEx.SequenceEqual(["void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Method()", "Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.$34505F560D9EACF86A87F3ED1F85E448"], nestedExtensionSymbol.ContainingType.GetMembers().ToTestDisplayStrings()); } [Fact] @@ -814,24 +877,32 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [netstandard]System.Object { - // Methods - .method private hidebysig specialname static - void '$' ( - object '' - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - } // end of class <>E__0 + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::'$' + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 } // end of class Extensions """); @@ -841,7 +912,7 @@ .maxstack 8 var symbol = model.GetDeclaredSymbol(extension); AssertExtensionDeclaration(symbol); - Assert.Equal("<>E__0", symbol.MetadataName); + AssertEx.Equal("$C43E2675C7BBF9284AF22FB8A9BF0280", symbol.MetadataName); } [Fact] @@ -868,16 +939,16 @@ public static partial class Extensions var extension1 = tree1.GetRoot().DescendantNodes().OfType().Single(); var symbol1 = model1.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0`1", symbol1.MetadataName); - Assert.Equal("Extensions.<>E__0", sourceExtension1.ToTestDisplayString()); + AssertEx.Equal("$D1693D81A12E8DED4ED68FE22D9E856F", symbol1.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", sourceExtension1.ToTestDisplayString()); var tree2 = comp.SyntaxTrees[1]; var extension2 = tree2.GetRoot().DescendantNodes().OfType().Single(); var model2 = comp.GetSemanticModel(tree2); var symbol2 = model2.GetDeclaredSymbol(extension2); var sourceExtension2 = symbol2.GetSymbol(); - Assert.Equal("<>E__1`2", symbol2.MetadataName); - Assert.Equal("Extensions.<>E__1", sourceExtension2.ToTestDisplayString()); + AssertEx.Equal("$38DD3033A2145E0D2274BCCB48D8434F", symbol2.MetadataName); + AssertEx.Equal("Extensions.$B6FEF98A1719AAFE96009C5CC65441CB", sourceExtension2.ToTestDisplayString()); } [Fact] @@ -901,13 +972,13 @@ public static partial class Extensions var model = comp.GetSemanticModel(tree); var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); - Assert.Equal("<>E__0`1", symbol1.MetadataName); - Assert.Equal("Extensions.<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol1.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", symbol1.ToTestDisplayString()); var extension2 = tree.GetRoot().DescendantNodes().OfType().Last(); var symbol2 = model.GetDeclaredSymbol(extension2); - Assert.Equal("<>E__1`2", symbol2.MetadataName); - Assert.Equal("Extensions.<>E__1", symbol2.ToTestDisplayString()); + AssertEx.Equal("$0A2F70F0BFFD1BC7F8C8E0A6CD0B0194", symbol2.MetadataName); + AssertEx.Equal("Extensions.$B6FEF98A1719AAFE96009C5CC65441CB", symbol2.ToTestDisplayString()); } [Fact] @@ -929,14 +1000,14 @@ public static class Extensions var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0`1", symbol1.MetadataName); - Assert.Equal("Extensions.<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol1.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", symbol1.ToTestDisplayString()); var extension2 = tree.GetRoot().DescendantNodes().OfType().Last(); var symbol2 = model.GetDeclaredSymbol(extension2); var sourceExtension2 = symbol2.GetSymbol(); - Assert.Equal("<>E__1`1", symbol2.MetadataName); - Assert.Equal("Extensions.<>E__1", symbol2.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol2.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", symbol2.ToTestDisplayString()); } [Fact] @@ -1110,35 +1181,49 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$CD29E70E0DCA5BBFCFAC7C2BEF3C5C99' extends [netstandard]System.Object { - // Methods - .method private hidebysig specialname static - void '$' ( - class [netstandard]System.Text.StringBuilder '' - ) cil managed + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$CD29E70E0DCA5BBFCFAC7C2BEF3C5C99' + extends [netstandard]System.Object { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20a5 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig static + // Methods + .method private hidebysig specialname static + void '$' ( + class [netstandard]System.Text.StringBuilder '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20de + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$CD29E70E0DCA5BBFCFAC7C2BEF3C5C99'::'$' + } // end of class $CD29E70E0DCA5BBFCFAC7C2BEF3C5C99 + // Methods + .method public hidebysig static class [netstandard]System.Text.StringBuilder Inspect ( class [netstandard]System.Text.StringBuilder sb - ) cil managed + ) cil managed { - // Method begins at RVA 0x20a7 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 44 32 39 + 45 37 30 45 30 44 43 41 35 42 42 46 43 46 41 43 + 37 43 32 42 45 46 33 43 35 43 39 39 00 00 + ) + // Method begins at RVA 0x20a5 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::Inspect - } // end of class <>E__0 + } // end of method '$CD29E70E0DCA5BBFCFAC7C2BEF3C5C99'::Inspect + } // end of class $CD29E70E0DCA5BBFCFAC7C2BEF3C5C99 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0' extends [netstandard]System.Object { @@ -1148,8 +1233,8 @@ 01 00 00 00 // Fields .field public class [netstandard]System.Text.StringBuilder sb // Methods - .method public hidebysig specialname rtspecialname - instance void .ctor () cil managed + .method public hidebysig specialname rtspecialname + instance void .ctor () cil managed { // Method begins at RVA 0x2079 // Code size 7 (0x7) @@ -1158,10 +1243,10 @@ .maxstack 8 IL_0001: call instance void [netstandard]System.Object::.ctor() IL_0006: ret } // end of method '<>c__DisplayClass1_0'::.ctor - .method assembly hidebysig - instance void 'b__0' () cil managed + .method assembly hidebysig + instance void 'b__0' () cil managed { - // Method begins at RVA 0x20ac + // Method begins at RVA 0x20a8 // Code size 42 (0x2a) .maxstack 2 .locals init ( @@ -1193,10 +1278,10 @@ [1] int32 } // end of method '<>c__DisplayClass1_0'::'b__0' } // end of class <>c__DisplayClass1_0 // Methods - .method public hidebysig static + .method public hidebysig static class [netstandard]System.Text.StringBuilder Inspect ( class [netstandard]System.Text.StringBuilder sb - ) cil managed + ) cil managed { // Method begins at RVA 0x2081 // Code size 35 (0x23) @@ -1220,8 +1305,8 @@ .maxstack 8 var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0", symbol1.MetadataName); - Assert.Equal("Extensions.<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$CD29E70E0DCA5BBFCFAC7C2BEF3C5C99", symbol1.MetadataName); + AssertEx.Equal("Extensions.$CD29E70E0DCA5BBFCFAC7C2BEF3C5C99", symbol1.ToTestDisplayString()); } [Fact] @@ -1274,33 +1359,47 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + int32 '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20ef + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::'$' + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods - .method private hidebysig specialname static - void '$' ( - int32 '' - ) cil managed + .method public hidebysig static + class [netstandard]System.Action DoSomething () cil managed { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 ) // Method begins at RVA 0x20bc - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig static - class [netstandard]System.Action DoSomething () cil managed - { - // Method begins at RVA 0x20be // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::DoSomething - } // end of class <>E__0 + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::DoSomething + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0' extends [netstandard]System.Object { @@ -1310,8 +1409,8 @@ 01 00 00 00 // Fields .field public int32 b // Methods - .method public hidebysig specialname rtspecialname - instance void .ctor () cil managed + .method public hidebysig specialname rtspecialname + instance void .ctor () cil managed { // Method begins at RVA 0x2073 // Code size 7 (0x7) @@ -1320,10 +1419,10 @@ .maxstack 8 IL_0001: call instance void [netstandard]System.Object::.ctor() IL_0006: ret } // end of method '<>c__DisplayClass1_0'::.ctor - .method assembly hidebysig - instance void 'b__0' () cil managed + .method assembly hidebysig + instance void 'b__0' () cil managed { - // Method begins at RVA 0x20c4 + // Method begins at RVA 0x20c0 // Code size 35 (0x23) .maxstack 3 .locals init ( @@ -1346,8 +1445,8 @@ [0] int32 } // end of method '<>c__DisplayClass1_0'::'b__0' } // end of class <>c__DisplayClass1_0 // Methods - .method public hidebysig static - class [netstandard]System.Action DoSomething () cil managed + .method public hidebysig static + class [netstandard]System.Action DoSomething () cil managed { // Method begins at RVA 0x207c // Code size 52 (0x34) @@ -1385,8 +1484,8 @@ [1] int32 var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0", symbol1.MetadataName); - Assert.Equal("IntExt.<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$BA41CFE2B5EDAEB8C1B9062F59ED4D69", symbol1.MetadataName); + AssertEx.Equal("IntExt.$BA41CFE2B5EDAEB8C1B9062F59ED4D69", symbol1.ToTestDisplayString()); } [Fact] @@ -1439,33 +1538,47 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { - // Methods - .method private hidebysig specialname static - void '$' ( - int32 '' - ) cil managed + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' + extends [netstandard]System.Object { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20ba - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' + // Methods + .method private hidebysig specialname static + void '$' ( + int32 '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20ef + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::'$' + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 + // Methods .method public hidebysig static class [netstandard]System.Action DoSomething () cil managed { - // Method begins at RVA 0x20bc + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + // Method begins at RVA 0x20ba // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::DoSomething - } // end of class <>E__0 + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::DoSomething + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0' extends [netstandard]System.Object { @@ -1547,8 +1660,8 @@ [0] int32 var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0", symbol1.MetadataName); - Assert.Equal("IntExt.<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$BA41CFE2B5EDAEB8C1B9062F59ED4D69", symbol1.MetadataName); + AssertEx.Equal("IntExt.$BA41CFE2B5EDAEB8C1B9062F59ED4D69", symbol1.ToTestDisplayString()); } [Fact] @@ -1571,14 +1684,14 @@ class C { } var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0`1", symbol1.MetadataName); - Assert.Equal("Extensions.<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol1.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", symbol1.ToTestDisplayString()); var extension2 = tree.GetRoot().DescendantNodes().OfType().Last(); var symbol2 = model.GetDeclaredSymbol(extension2); var sourceExtension2 = symbol2.GetSymbol(); - Assert.Equal("<>E__1`1", symbol2.MetadataName); - Assert.Equal("Extensions.<>E__1", symbol2.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol2.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", symbol2.ToTestDisplayString()); } [Fact] @@ -1604,14 +1717,14 @@ class C { } var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0`1", symbol1.MetadataName); - Assert.Equal("<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol1.MetadataName); + AssertEx.Equal("$8048A6C8BE30A622530249B904B537EB", symbol1.ToTestDisplayString()); var extension2 = tree.GetRoot().DescendantNodes().OfType().Last(); var symbol2 = model.GetDeclaredSymbol(extension2); var sourceExtension2 = symbol2.GetSymbol(); - Assert.Equal("<>E__1`1", symbol2.MetadataName); - Assert.Equal("<>E__1", symbol2.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol2.MetadataName); + AssertEx.Equal("$8048A6C8BE30A622530249B904B537EB", symbol2.ToTestDisplayString()); } [Fact] @@ -1633,14 +1746,14 @@ public static class Extensions var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0`1", symbol1.MetadataName); - Assert.Equal("Extensions.<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol1.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", symbol1.ToTestDisplayString()); var extension2 = tree.GetRoot().DescendantNodes().OfType().Last(); var symbol2 = model.GetDeclaredSymbol(extension2); var sourceExtension2 = symbol2.GetSymbol(); - Assert.Equal("<>E__1`2", symbol2.MetadataName); - Assert.Equal("Extensions.<>E__1", symbol2.ToTestDisplayString()); + AssertEx.Equal("$38DD3033A2145E0D2274BCCB48D8434F", symbol2.MetadataName); + AssertEx.Equal("Extensions.$B6FEF98A1719AAFE96009C5CC65441CB", symbol2.ToTestDisplayString()); } [Fact] @@ -1661,14 +1774,14 @@ public static class Extensions var extension1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(extension1); var sourceExtension1 = symbol1.GetSymbol(); - Assert.Equal("<>E__0`1", symbol1.MetadataName); - Assert.Equal("Extensions.<>E__0", symbol1.ToTestDisplayString()); + AssertEx.Equal("$01CE3801593377B4E240F33E20D30D50", symbol1.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", symbol1.ToTestDisplayString()); var extension2 = tree.GetRoot().DescendantNodes().OfType().Last(); var symbol2 = model.GetDeclaredSymbol(extension2); var sourceExtension2 = symbol2.GetSymbol(); - Assert.Equal("<>E__1`1", symbol2.MetadataName); - Assert.Equal("Extensions.<>E__1", symbol2.ToTestDisplayString()); + AssertEx.Equal("$0F0A7F439039332917C923D7DF48FA4C", symbol2.MetadataName); + AssertEx.Equal("Extensions.$BCF902721DDD961E5243C324D8379E5C", symbol2.ToTestDisplayString()); } [Fact] @@ -1700,8 +1813,8 @@ class C { } var extension = tree.GetRoot().DescendantNodes().OfType().Last(); var symbol = model.GetDeclaredSymbol(extension); var sourceExtension = symbol.GetSymbol(); - Assert.Equal("<>E__10`1", symbol.MetadataName); - Assert.Equal("Extensions.<>E__10", symbol.ToTestDisplayString()); + AssertEx.Equal("$9B08A69343790083B512FC2D1C4929FC", symbol.MetadataName); + AssertEx.Equal("Extensions.$8048A6C8BE30A622530249B904B537EB", symbol.ToTestDisplayString()); } [Fact] @@ -1729,38 +1842,52 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed + .method private hidebysig + instance void M () cil managed { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method private hidebysig - instance void M () cil managed - { // Method begins at RVA 0x2069 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method private hidebysig static + .method private hidebysig static void M ( object o - ) cil managed + ) cil managed { .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 @@ -1778,9 +1905,9 @@ .maxstack 8 var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["M"], symbol.MemberNames); - Assert.Equal(["", "M"], symbol.ContainingType.MemberNames); - Assert.Equal("void Extensions.<>E__0.M()", symbol.GetMember("M").ToTestDisplayString()); + AssertEx.SequenceEqual(["M"], symbol.MemberNames); + AssertEx.SequenceEqual(["", "M"], symbol.ContainingType.MemberNames); + AssertEx.Equal("void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", symbol.GetMember("M").ToTestDisplayString()); } [Fact] @@ -1806,7 +1933,7 @@ void M(this int i) { } var method = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(method); - Assert.Equal("void Extensions.<>E__0.M(this System.Int32 i)", symbol.ToTestDisplayString()); + AssertEx.Equal("void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.M(this System.Int32 i)", symbol.ToTestDisplayString()); Assert.True(symbol.IsExtensionMethod); } @@ -1835,36 +1962,50 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::'$' + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method private hidebysig specialname static - void '$' ( - object '' - ) cil managed + .method private hidebysig static + void M () cil managed { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method private hidebysig static - void M () cil managed - { // Method begins at RVA 0x2069 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method private hidebysig static - void M () cil managed + .method private hidebysig static + void M () cil managed { // Method begins at RVA 0x2067 // Code size 1 (0x1) @@ -1879,8 +2020,8 @@ .maxstack 8 var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["M"], symbol.MemberNames); - Assert.Equal("void Extensions.<>E__0.M()", symbol.GetMember("M").ToTestDisplayString()); + AssertEx.SequenceEqual(["M"], symbol.MemberNames); + AssertEx.Equal("void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", symbol.GetMember("M").ToTestDisplayString()); } [Fact] @@ -1959,55 +2100,79 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206b + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed + .method private hidebysig specialname + instance int32 get_Property () cil managed { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 ) - // Method begins at RVA 0x206b - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method private hidebysig specialname - instance int32 get_Property () cil managed - { // Method begins at RVA 0x206d // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_Property - .method private hidebysig specialname + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::get_Property + .method private hidebysig specialname instance void set_Property ( int32 'value' - ) cil managed + ) cil managed { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) // Method begins at RVA 0x206d // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_Property + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::set_Property // Properties .property instance int32 Property() { - .get instance int32 Extensions/'<>E__0'::get_Property() - .set instance void Extensions/'<>E__0'::set_Property(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + .get instance int32 Extensions/'$C43E2675C7BBF9284AF22FB8A9BF0280'::get_Property() + .set instance void Extensions/'$C43E2675C7BBF9284AF22FB8A9BF0280'::set_Property(int32) } - } // end of class <>E__0 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method private hidebysig static + .method private hidebysig static int32 get_Property ( object o - ) cil managed + ) cil managed { // Method begins at RVA 0x2067 // Code size 3 (0x3) @@ -2015,11 +2180,11 @@ .maxstack 8 IL_0000: ldc.i4.s 42 IL_0002: ret } // end of method Extensions::get_Property - .method private hidebysig static + .method private hidebysig static void set_Property ( object o, int32 'value' - ) cil managed + ) cil managed { // Method begins at RVA 0x206b // Code size 1 (0x1) @@ -2034,14 +2199,13 @@ .maxstack 8 var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["Property"], symbol.MemberNames); - Assert.Equal("System.Int32 Extensions.<>E__0.Property { get; set; }", symbol.GetMember("Property").ToTestDisplayString()); + AssertEx.SequenceEqual(["Property"], symbol.MemberNames); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", symbol.GetMember("Property").ToTestDisplayString()); AssertEx.Equal([ - "void Extensions.<>E__0.$(System.Object o)", - "System.Int32 Extensions.<>E__0.Property { get; set; }", - "System.Int32 Extensions.<>E__0.Property.get", - "void Extensions.<>E__0.Property.set"], + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property.get", + "void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property.set"], symbol.GetMembers().ToTestDisplayStrings()); } @@ -2068,15 +2232,14 @@ public static class Extensions var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["Property"], symbol.MemberNames); - Assert.Equal("System.Int32 Extensions.<>E__0.Property { get; set; }", symbol.GetMember("Property").ToTestDisplayString()); + AssertEx.SequenceEqual(["Property"], symbol.MemberNames); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", symbol.GetMember("Property").ToTestDisplayString()); AssertEx.Equal([ - "void Extensions.<>E__0.$(System.Object o)", - "System.Int32 Extensions.<>E__0.k__BackingField", - "System.Int32 Extensions.<>E__0.Property { get; set; }", - "System.Int32 Extensions.<>E__0.Property.get", - "void Extensions.<>E__0.Property.set"], + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.k__BackingField", + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property.get", + "void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property.set"], symbol.GetMembers().ToTestDisplayStrings()); } @@ -2128,52 +2291,76 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206b + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::'$' + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method private hidebysig specialname static - void '$' ( - object '' - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x206b - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig specialname static int32 get_Property () cil managed { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 + ) // Method begins at RVA 0x206d // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_Property + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::get_Property .method private hidebysig specialname static void set_Property ( int32 'value' ) cil managed { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 + ) // Method begins at RVA 0x206d // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_Property + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::set_Property // Properties .property int32 Property() { - .get int32 Extensions/'<>E__0'::get_Property() - .set void Extensions/'<>E__0'::set_Property(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 + ) + .get int32 Extensions/'$C43E2675C7BBF9284AF22FB8A9BF0280'::get_Property() + .set void Extensions/'$C43E2675C7BBF9284AF22FB8A9BF0280'::set_Property(int32) } - } // end of class <>E__0 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method private hidebysig static + .method private hidebysig static int32 get_Property () cil managed { // Method begins at RVA 0x2067 @@ -2182,7 +2369,7 @@ .maxstack 8 IL_0000: ldc.i4.s 42 IL_0002: ret } // end of method Extensions::get_Property - .method private hidebysig static + .method private hidebysig static void set_Property ( int32 'value' ) cil managed @@ -2200,8 +2387,8 @@ .maxstack 8 var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["Property"], symbol.MemberNames); - Assert.Equal("System.Int32 Extensions.<>E__0.Property { get; set; }", symbol.GetMember("Property").ToTestDisplayString()); + AssertEx.SequenceEqual(["Property"], symbol.MemberNames); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", symbol.GetMember("Property").ToTestDisplayString()); } [Fact] @@ -2227,16 +2414,15 @@ public static class Extensions var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["Property"], symbol.MemberNames); - AssertEx.Equal([ - "void Extensions.<>E__0.$(System.Object)", - "System.Int32 Extensions.<>E__0.k__BackingField", - "System.Int32 Extensions.<>E__0.Property { get; set; }", - "System.Int32 Extensions.<>E__0.Property.get", - "void Extensions.<>E__0.Property.set"], + AssertEx.SequenceEqual(["Property"], symbol.MemberNames); + AssertEx.SequenceEqual([ + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.k__BackingField", + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property.get", + "void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property.set"], symbol.GetMembers().ToTestDisplayStrings()); - Assert.Equal("System.Int32 Extensions.<>E__0.Property { get; set; }", symbol.GetMember("Property").ToTestDisplayString()); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", symbol.GetMember("Property").ToTestDisplayString()); } [Fact] @@ -2262,14 +2448,13 @@ public static class Extensions var extension = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(extension); - Assert.Equal(["this[]"], symbol.MemberNames); - Assert.Equal("System.Int32 Extensions.<>E__0.this[System.Int32 i] { get; set; }", symbol.GetMember("this[]").ToTestDisplayString()); + AssertEx.SequenceEqual(["this[]"], symbol.MemberNames); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.this[System.Int32 i] { get; set; }", symbol.GetMember("this[]").ToTestDisplayString()); AssertEx.Equal([ - "void Extensions.<>E__0.$(System.Object o)", - "System.Int32 Extensions.<>E__0.this[System.Int32 i] { get; set; }", - "System.Int32 Extensions.<>E__0.this[System.Int32 i].get", - "void Extensions.<>E__0.this[System.Int32 i].set"], + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.this[System.Int32 i] { get; set; }", + "System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.this[System.Int32 i].get", + "void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.this[System.Int32 i].set"], symbol.GetMembers().ToTestDisplayStrings()); var comp5 = CreateCompilation(src); @@ -2335,9 +2520,9 @@ class Nested { } var symbol = model.GetDeclaredSymbol(extension); Assert.Empty(symbol.MemberNames); - Assert.Equal(["void Extensions.<>E__0.$(System.Object)", "Extensions.<>E__0.Nested"], symbol.GetMembers().ToTestDisplayStrings()); - Assert.Equal(["Extensions.<>E__0.Nested"], symbol.GetTypeMembers().ToTestDisplayStrings()); - Assert.Equal("Extensions.<>E__0.Nested", symbol.GetTypeMember("Nested").ToTestDisplayString()); + AssertEx.SequenceEqual(["Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Nested"], symbol.GetMembers().ToTestDisplayStrings()); + AssertEx.SequenceEqual(["Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Nested"], symbol.GetTypeMembers().ToTestDisplayStrings()); + AssertEx.Equal("Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Nested", symbol.GetTypeMember("Nested").ToTestDisplayString()); } [Fact] @@ -2425,10 +2610,10 @@ public static class Extensions var symbol = model.GetDeclaredSymbol(extension); AssertExtensionDeclaration(symbol); - Assert.Equal([".ctor"], symbol.MemberNames); - Assert.Equal(["Extensions.<>E__0..ctor()"], symbol.InstanceConstructors.ToTestDisplayStrings()); + AssertEx.SequenceEqual([".ctor"], symbol.MemberNames); + AssertEx.SequenceEqual(["Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280..ctor()"], symbol.InstanceConstructors.ToTestDisplayStrings()); Assert.Empty(symbol.StaticConstructors); - Assert.Equal(["Extensions.<>E__0..ctor()"], symbol.Constructors.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280..ctor()"], symbol.Constructors.ToTestDisplayStrings()); } [Fact] @@ -2453,8 +2638,8 @@ public static class Extensions var symbol = model.GetDeclaredSymbol(extension); AssertExtensionDeclaration(symbol); - Assert.Equal(["Finalize"], symbol.MemberNames); - Assert.Equal(["void Extensions.<>E__0.$(System.Object)", "void Extensions.<>E__0.Finalize()"], symbol.GetMembers().ToTestDisplayStrings()); + AssertEx.SequenceEqual(["Finalize"], symbol.MemberNames); + AssertEx.SequenceEqual(["void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.Finalize()"], symbol.GetMembers().ToTestDisplayStrings()); } [Fact] @@ -2487,8 +2672,8 @@ public static class Extensions var symbol = model.GetDeclaredSymbol(extension); AssertExtensionDeclaration(symbol); - Assert.Equal(["field"], symbol.MemberNames); - Assert.Equal(["void Extensions.<>E__0.$(System.Object o)", "System.Int32 Extensions.<>E__0.field"], symbol.GetMembers().ToTestDisplayStrings()); + AssertEx.SequenceEqual(["field"], symbol.MemberNames); + AssertEx.SequenceEqual(["System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.field"], symbol.GetMembers().ToTestDisplayStrings()); } [Fact] @@ -2513,8 +2698,8 @@ public static class Extensions var symbol = model.GetDeclaredSymbol(extension); AssertExtensionDeclaration(symbol); - Assert.Equal(["i"], symbol.MemberNames); - Assert.Equal(["void Extensions.<>E__0.$(System.Object)", "System.Int32 Extensions.<>E__0.i"], symbol.GetMembers().ToTestDisplayStrings()); + AssertEx.SequenceEqual(["i"], symbol.MemberNames); + AssertEx.SequenceEqual(["System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.i"], symbol.GetMembers().ToTestDisplayStrings()); } [Fact] @@ -2668,7 +2853,7 @@ public static class Extensions var model = comp.GetSemanticModel(tree); var type = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(type); - Assert.Equal("System.Object", symbol.ExtensionParameter.ToTestDisplayString()); + AssertEx.Equal("System.Object", symbol.ExtensionParameter.ToTestDisplayString()); } [Fact] @@ -2690,10 +2875,10 @@ public static class Extensions var model = comp.GetSemanticModel(tree); var type = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(type); - Assert.Equal("System.Object o", symbol.ExtensionParameter.ToTestDisplayString()); + AssertEx.Equal("System.Object o", symbol.ExtensionParameter.ToTestDisplayString()); var returnStatement = GetSyntax(tree, "return o;"); - Assert.Equal("System.Object o", model.GetSymbolInfo(returnStatement.Expression).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Object o", model.GetSymbolInfo(returnStatement.Expression).Symbol.ToTestDisplayString()); } [Fact] @@ -2721,17 +2906,17 @@ class C { } var symbol = model.GetDeclaredSymbol(type); var extensionParameter = symbol.ExtensionParameter; - Assert.Equal("System.Int32 i", extensionParameter.ToTestDisplayString()); + AssertEx.Equal("System.Int32 i", extensionParameter.ToTestDisplayString()); Assert.True(extensionParameter.Equals(extensionParameter)); var parameterSyntaxes = tree.GetRoot().DescendantNodes().OfType().ToArray(); - Assert.Equal("System.Int32 i", model.GetDeclaredSymbol(parameterSyntaxes[0]).ToTestDisplayString()); + AssertEx.Equal("System.Int32 i", model.GetDeclaredSymbol(parameterSyntaxes[0]).ToTestDisplayString()); Assert.Same(extensionParameter, model.GetDeclaredSymbol(parameterSyntaxes[0])); - Assert.Equal("System.Int32", model.GetTypeInfo(parameterSyntaxes[1].Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(parameterSyntaxes[1].Type).Type.ToTestDisplayString()); Assert.Null(model.GetDeclaredSymbol(parameterSyntaxes[1])); - Assert.Equal("C", model.GetTypeInfo(parameterSyntaxes[2].Type).Type.ToTestDisplayString()); + AssertEx.Equal("C", model.GetTypeInfo(parameterSyntaxes[2].Type).Type.ToTestDisplayString()); Assert.Null(model.GetDeclaredSymbol(parameterSyntaxes[2])); } @@ -2768,7 +2953,7 @@ public static class Extensions var type = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(type); var extensionParameter = symbol.ExtensionParameter; - Assert.Equal("T", extensionParameter.ToTestDisplayString()); + AssertEx.Equal("T", extensionParameter.ToTestDisplayString()); Assert.Same(extensionParameter.Type, symbol.TypeParameters[0]); } @@ -2792,7 +2977,7 @@ public static class Extensions var type = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(type); var extensionParameter = symbol.ExtensionParameter; - Assert.Equal("T", extensionParameter.ToTestDisplayString()); + AssertEx.Equal("T", extensionParameter.ToTestDisplayString()); Assert.Same(extensionParameter.Type, symbol.ContainingType.TypeParameters[0]); } @@ -2818,7 +3003,7 @@ public static class Extensions var type = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(type); var parameter = symbol.ExtensionParameter; - Assert.Equal("T", parameter.ToTestDisplayString()); + AssertEx.Equal("T", parameter.ToTestDisplayString()); Assert.True(parameter.Type.IsErrorType()); } @@ -3157,7 +3342,7 @@ public static class Extensions var type1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(type1); var parameter = symbol1.ExtensionParameter; - Assert.Equal("System.Int32[] i", parameter.ToTestDisplayString()); + AssertEx.Equal("System.Int32[] i", parameter.ToTestDisplayString()); Assert.False(parameter.IsParams); } @@ -3218,7 +3403,7 @@ public class C where T : struct { } var model = comp.GetSemanticModel(tree); var type1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(type1); - Assert.Equal("C", symbol1.ExtensionParameter.ToTestDisplayString()); + AssertEx.Equal("C", symbol1.ExtensionParameter.ToTestDisplayString()); } [Fact] @@ -3403,7 +3588,7 @@ public class MyAttribute : System.Attribute { } var model = comp.GetSemanticModel(tree); var parameter = tree.GetRoot().DescendantNodes().OfType().Single(); var parameterSymbol = model.GetDeclaredSymbol(parameter); - Assert.Equal("System.Int32 x", parameterSymbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 x", parameterSymbol.ToTestDisplayString()); AssertEx.SetEqual(["MyAttribute"], parameterSymbol.GetAttributes().Select(a => a.ToString())); var type = tree.GetRoot().DescendantNodes().OfType().Single(); @@ -3532,7 +3717,7 @@ static void M(this out int i) { } var type1 = tree.GetRoot().DescendantNodes().OfType().First(); var symbol1 = model.GetDeclaredSymbol(type1); var parameter = symbol1.ExtensionParameter; - Assert.Equal("out System.Int32 i", parameter.ToTestDisplayString()); + AssertEx.Equal("out System.Int32 i", parameter.ToTestDisplayString()); Assert.Equal(RefKind.Out, parameter.RefKind); } @@ -3700,7 +3885,7 @@ static void M2(this ref readonly int i) { } CompileAndVerify(comp, symbolValidator: (m) => { - Assert.Equal(RefKind.RefReadOnlyParameter, m.GlobalNamespace.GetMember("Extensions.<>E__0.$").Parameters[0].RefKind); + Assert.Equal(RefKind.RefReadOnlyParameter, m.GlobalNamespace.GetTypeMember("Extensions").GetTypeMembers().Single().ExtensionParameter.RefKind); }, expectedOutput: "42").VerifyDiagnostics(); } @@ -4081,7 +4266,7 @@ public static class Extensions var model = comp.GetSemanticModel(tree); var type = tree.GetRoot().DescendantNodes().OfType().Single(); var symbol = model.GetDeclaredSymbol(type); - Assert.Equal("?", symbol.ExtensionParameter.ToTestDisplayString()); + AssertEx.Equal("?", symbol.ExtensionParameter.ToTestDisplayString()); } [Fact] @@ -4130,7 +4315,7 @@ static class Extensions CompileAndVerify(comp, expectedOutput: "42", symbolValidator: (m) => { - AssertEx.Equal(ScopedKind.ScopedRef, m.GlobalNamespace.GetMember("Extensions.<>E__0.$").Parameters[0].EffectiveScope); + AssertEx.Equal(ScopedKind.ScopedRef, m.GlobalNamespace.GetTypeMember("Extensions").GetTypeMembers().Single().ExtensionParameter.EffectiveScope); }).VerifyDiagnostics(); } @@ -4177,15 +4362,16 @@ static class Extensions CompileAndVerify(comp, symbolValidator: (m) => { - AssertEx.Equal("System.String?", m.GlobalNamespace.GetMember("Extensions.<>E__0.$").Parameters[0].TypeWithAnnotations.ToTestDisplayString()); - AssertEx.Equal("System.String?", m.GlobalNamespace.GetMember("Extensions.<>E__1.$").Parameters[0].TypeWithAnnotations.ToTestDisplayString()); + var extensions = m.GlobalNamespace.GetTypeMember("Extensions").GetTypeMembers(); + AssertEx.Equal("System.String?", extensions[0].ExtensionParameter.TypeWithAnnotations.ToTestDisplayString()); + AssertEx.Equal("System.String?", extensions[1].ExtensionParameter.TypeWithAnnotations.ToTestDisplayString()); }).VerifyDiagnostics(); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var parameters = tree.GetRoot().DescendantNodes().OfType().ToArray(); - Assert.Equal("System.String? receiver", model.GetDeclaredSymbol(parameters[0]).ToTestDisplayString(includeNonNullable: true)); - Assert.Equal("System.String?", model.GetDeclaredSymbol(parameters[1]).ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.String? receiver", model.GetDeclaredSymbol(parameters[0]).ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.String?", model.GetDeclaredSymbol(parameters[1]).ToTestDisplayString(includeNonNullable: true)); } [Fact] @@ -4209,8 +4395,9 @@ static class Extensions CompileAndVerify(comp, symbolValidator: (m) => { - Assert.True(m.GlobalNamespace.GetMember("Extensions.<>E__0.$").Parameters[0].Type.IsNativeIntegerType); - Assert.True(m.GlobalNamespace.GetMember("Extensions.<>E__1.$").Parameters[0].Type.IsNativeIntegerType); + var extensions = m.GlobalNamespace.GetTypeMember("Extensions").GetTypeMembers(); + Assert.True(extensions[0].ExtensionParameter.Type.IsNativeIntegerType); + Assert.True(extensions[1].ExtensionParameter.Type.IsNativeIntegerType); }).VerifyDiagnostics(); } @@ -4605,7 +4792,7 @@ public static class Extensions comp.VerifyEmitDiagnostics(); var verifier = CompileAndVerify(comp); - verifier.VerifyIL("Extensions.<>E__0.M()", """ + verifier.VerifyIL("Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", """ { // Code size 2 (0x2) .maxstack 1 @@ -4712,7 +4899,7 @@ public int M() Diagnostic(ErrorCode.ERR_NoImplicitConv, @"""""").WithArguments("string", "int").WithLocation(7, 20) ); - Assert.Equal("[System.Object o = null]", model.GetDeclaredSymbol(ext.ParameterList.Parameters[0]).ToTestDisplayString()); + AssertEx.Equal("[System.Object o = null]", model.GetDeclaredSymbol(ext.ParameterList.Parameters[0]).ToTestDisplayString()); } [Fact] @@ -4899,41 +5086,55 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x207a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2077 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method private hidebysig + .method private hidebysig instance void M ( string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x2079 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + // Method begins at RVA 0x2077 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method private hidebysig static + .method private hidebysig static void M ( object o, string s - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 @@ -4957,7 +5158,7 @@ .maxstack 8 emitOptions: EmitOptions.Default.WithEmitMetadataOnly(true).WithIncludePrivateMembers(false), symbolValidator: (m) => { - AssertEx.Equal("void Extensions.<>E__0.$(System.Object o)", m.GlobalNamespace.GetMember("Extensions.<>E__0.$").ToTestDisplayString()); + AssertEx.Equal("System.Object o", m.GlobalNamespace.GetTypeMember("Extensions").GetTypeMembers().Single().ExtensionParameter.ToTestDisplayString()); } ).VerifyDiagnostics(); } @@ -5018,41 +5219,55 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x207e + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x207b - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig + .method public hidebysig instance string M ( string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x207d + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + // Method begins at RVA 0x207b // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method public hidebysig static + .method public hidebysig static string M ( object o, string s - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 @@ -5141,7 +5356,7 @@ .maxstack 2 verifier2.VerifyIL("Program.Test", testIL); verifier2.VerifyIL("Extensions.M2", m2IL); - comp2 = CreateCompilationWithIL(src2, expectedTypeIL, options: TestOptions.DebugExe); + comp2 = CreateCompilationWithIL(src2, expectedTypeIL + ExtensionMarkerNameAttributeIL, options: TestOptions.DebugExe); CompileAndVerify(comp2, expectedOutput: "1234").VerifyDiagnostics(); var remove = """ @@ -5150,7 +5365,7 @@ 01 00 00 00 ) """; - comp2 = CreateCompilationWithIL(src2, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length)); + comp2 = CreateCompilationWithIL(src2, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length) + ExtensionMarkerNameAttributeIL); comp2.VerifyDiagnostics( // (11,18): error CS1061: 'object' does not contain a definition for 'M' and no accessible extension method 'M' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) // return o.M("2"); @@ -5387,35 +5602,49 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20ae + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20ab - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig instance string M ( string s ) cil managed { - // Method begins at RVA 0x20ad + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + // Method begins at RVA 0x20ab // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0' extends [mscorlib]System.ValueType { @@ -5567,35 +5796,49 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20b6 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x208c - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig + .method public hidebysig instance string M ( string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x208e + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + // Method begins at RVA 0x208c // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0' extends [mscorlib]System.Object { @@ -5606,20 +5849,20 @@ 01 00 00 00 .field public object o .field public string s // Methods - .method public hidebysig specialname rtspecialname - instance void .ctor () cil managed + .method public hidebysig specialname rtspecialname + instance void .ctor () cil managed { - // Method begins at RVA 0x2091 + // Method begins at RVA 0x208f // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method '<>c__DisplayClass1_0'::.ctor - .method assembly hidebysig - instance string 'b__0' () cil managed + .method assembly hidebysig + instance string 'b__0' () cil managed { - // Method begins at RVA 0x2099 + // Method begins at RVA 0x2097 // Code size 30 (0x1e) .maxstack 8 IL_0000: ldarg.0 @@ -5637,11 +5880,11 @@ .maxstack 8 } // end of method '<>c__DisplayClass1_0'::'b__0' } // end of class <>c__DisplayClass1_0 // Methods - .method public hidebysig static + .method public hidebysig static string M ( object o, string s - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 @@ -5755,35 +5998,49 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2167 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x207e - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig + .method public hidebysig instance class [mscorlib]System.Collections.Generic.IEnumerable`1 M ( string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x2080 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + // Method begins at RVA 0x207e // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi sealed beforefieldinit 'd__1' extends [mscorlib]System.Object implements class [mscorlib]System.Collections.Generic.IEnumerable`1, @@ -5816,15 +6073,15 @@ .field public object '<>3__o' .field private string s .field public string '<>3__s' // Methods - .method public hidebysig specialname rtspecialname + .method public hidebysig specialname rtspecialname instance void .ctor ( int32 '<>1__state' - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) - // Method begins at RVA 0x2083 + // Method begins at RVA 0x2081 // Code size 25 (0x19) .maxstack 8 IL_0000: ldarg.0 @@ -5837,14 +6094,14 @@ .maxstack 8 IL_0013: stfld int32 Extensions/'d__1'::'<>l__initialThreadId' IL_0018: ret } // end of method 'd__1'::.ctor - .method private final hidebysig newslot virtual - instance void System.IDisposable.Dispose () cil managed + .method private final hidebysig newslot virtual + instance void System.IDisposable.Dispose () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) .override method instance void [mscorlib]System.IDisposable::Dispose() - // Method begins at RVA 0x209d + // Method begins at RVA 0x209b // Code size 9 (0x9) .maxstack 8 IL_0000: ldarg.0 @@ -5852,8 +6109,8 @@ .maxstack 8 IL_0003: stfld int32 Extensions/'d__1'::'<>1__state' IL_0008: ret } // end of method 'd__1'::System.IDisposable.Dispose - .method private final hidebysig newslot virtual - instance bool MoveNext () cil managed + .method private final hidebysig newslot virtual + instance bool MoveNext () cil managed { .override method instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() // Method begins at RVA 0x20a8 @@ -5899,8 +6156,8 @@ [0] int32 IL_004a: ldc.i4.0 IL_004b: ret } // end of method 'd__1'::MoveNext - .method private final hidebysig specialname newslot virtual - instance string 'System.Collections.Generic.IEnumerator.get_Current' () cil managed + .method private final hidebysig specialname newslot virtual + instance string 'System.Collections.Generic.IEnumerator.get_Current' () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -5913,8 +6170,8 @@ .maxstack 8 IL_0001: ldfld string Extensions/'d__1'::'<>2__current' IL_0006: ret } // end of method 'd__1'::'System.Collections.Generic.IEnumerator.get_Current' - .method private final hidebysig newslot virtual - instance void System.Collections.IEnumerator.Reset () cil managed + .method private final hidebysig newslot virtual + instance void System.Collections.IEnumerator.Reset () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -5926,8 +6183,8 @@ .maxstack 8 IL_0000: newobj instance void [mscorlib]System.NotSupportedException::.ctor() IL_0005: throw } // end of method 'd__1'::System.Collections.IEnumerator.Reset - .method private final hidebysig specialname newslot virtual - instance object System.Collections.IEnumerator.get_Current () cil managed + .method private final hidebysig specialname newslot virtual + instance object System.Collections.IEnumerator.get_Current () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -5940,8 +6197,8 @@ .maxstack 8 IL_0001: ldfld string Extensions/'d__1'::'<>2__current' IL_0006: ret } // end of method 'd__1'::System.Collections.IEnumerator.get_Current - .method private final hidebysig newslot virtual - instance class [mscorlib]System.Collections.Generic.IEnumerator`1 'System.Collections.Generic.IEnumerable.GetEnumerator' () cil managed + .method private final hidebysig newslot virtual + instance class [mscorlib]System.Collections.Generic.IEnumerator`1 'System.Collections.Generic.IEnumerable.GetEnumerator' () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -5981,8 +6238,8 @@ [0] class Extensions/'d__1' IL_0041: ldloc.0 IL_0042: ret } // end of method 'd__1'::'System.Collections.Generic.IEnumerable.GetEnumerator' - .method private final hidebysig newslot virtual - instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () cil managed + .method private final hidebysig newslot virtual + instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -6006,11 +6263,11 @@ .property instance object System.Collections.IEnumerator.Current() } } // end of class d__1 // Methods - .method public hidebysig static + .method public hidebysig static class [mscorlib]System.Collections.Generic.IEnumerable`1 M ( object o, string s - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.IteratorStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 12 45 78 74 65 6e 73 69 6f 6e 73 2b 3c 4d @@ -6156,35 +6413,49 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2196 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20b3 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig + .method public hidebysig instance class [mscorlib]System.Threading.Tasks.Task`1 M ( string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x20b5 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + // Method begins at RVA 0x20b3 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi sealed beforefieldinit 'd__1' extends [mscorlib]System.ValueType implements [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine @@ -6199,8 +6470,8 @@ .field public object o .field public string s .field private valuetype [mscorlib]System.Runtime.CompilerServices.YieldAwaitable/YieldAwaiter '<>u__1' // Methods - .method private final hidebysig newslot virtual - instance void MoveNext () cil managed + .method private final hidebysig newslot virtual + instance void MoveNext () cil managed { .override method instance void [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext() // Method begins at RVA 0x20b8 @@ -6290,10 +6561,10 @@ [4] class [mscorlib]System.Exception IL_00ac: call instance void valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) IL_00b1: ret } // end of method 'd__1'::MoveNext - .method private final hidebysig newslot virtual + .method private final hidebysig newslot virtual instance void SetStateMachine ( class [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine stateMachine - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -6310,11 +6581,11 @@ .maxstack 8 } // end of method 'd__1'::SetStateMachine } // end of class d__1 // Methods - .method public hidebysig static + .method public hidebysig static class [mscorlib]System.Threading.Tasks.Task`1 M ( object o, string s - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 12 45 78 74 65 6e 73 69 6f 6e 73 2b 3c 4d @@ -6456,43 +6727,57 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$4A1E373BE5A70EE56E2FA5F469AC30F9'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D884D1E13988E83801B7574694E1C2C5' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C`1 o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20a8 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D884D1E13988E83801B7574694E1C2C5'::'$' + } // end of class $D884D1E13988E83801B7574694E1C2C5 // Methods - .method private hidebysig specialname static - void '$' ( - class C`1 o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20a5 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' - .method public hidebysig + .method public hidebysig instance string M ( - !T t, + !$T0 t, !!U u - ) cil managed + ) cil managed { - // Method begins at RVA 0x20a7 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 38 38 34 + 44 31 45 31 33 39 38 38 45 38 33 38 30 31 42 37 + 35 37 34 36 39 34 45 31 43 32 43 35 00 00 + ) + // Method begins at RVA 0x20a5 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M - } // end of class <>E__0`1 + } // end of method '$4A1E373BE5A70EE56E2FA5F469AC30F9'::M + } // end of class $4A1E373BE5A70EE56E2FA5F469AC30F9 // Methods - .method public hidebysig static + .method public hidebysig static string M ( class C`1 o, !!T t, !!U u - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 @@ -6697,36 +6982,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$4A1E373BE5A70EE56E2FA5F469AC30F9'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D884D1E13988E83801B7574694E1C2C5' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C`1 o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2170 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D884D1E13988E83801B7574694E1C2C5'::'$' + } // end of class $D884D1E13988E83801B7574694E1C2C5 // Methods - .method private hidebysig specialname static - void '$' ( - class C`1 o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x216d - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' .method public hidebysig instance class C`1 M ( - !T t1, + !$T0 t1, !!U u1 ) cil managed { - // Method begins at RVA 0x216f + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 38 38 34 + 44 31 45 31 33 39 38 38 45 38 33 38 30 31 42 37 + 35 37 34 36 39 34 45 31 43 32 43 35 00 00 + ) + // Method begins at RVA 0x216d // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M - } // end of class <>E__0`1 + } // end of method '$4A1E373BE5A70EE56E2FA5F469AC30F9'::M + } // end of class $4A1E373BE5A70EE56E2FA5F469AC30F9 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0`2' extends [mscorlib]System.ValueType { @@ -6972,36 +7271,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$4A1E373BE5A70EE56E2FA5F469AC30F9'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D884D1E13988E83801B7574694E1C2C5' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C`1 o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2143 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D884D1E13988E83801B7574694E1C2C5'::'$' + } // end of class $D884D1E13988E83801B7574694E1C2C5 // Methods - .method private hidebysig specialname static - void '$' ( - class C`1 o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20c4 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' - .method public hidebysig + .method public hidebysig instance class C`1 M ( - !T t1, + !$T0 t1, !!U u1 - ) cil managed + ) cil managed { - // Method begins at RVA 0x20c6 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 38 38 34 + 44 31 45 31 33 39 38 38 45 38 33 38 30 31 42 37 + 35 37 34 36 39 34 45 31 43 32 43 35 00 00 + ) + // Method begins at RVA 0x20c4 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M - } // end of class <>E__0`1 + } // end of method '$4A1E373BE5A70EE56E2FA5F469AC30F9'::M + } // end of class $4A1E373BE5A70EE56E2FA5F469AC30F9 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0`2' extends [mscorlib]System.Object { @@ -7013,23 +7326,23 @@ .field public class C`1 o .field public !U u1 .field public !T t1 // Methods - .method public hidebysig specialname rtspecialname - instance void .ctor () cil managed + .method public hidebysig specialname rtspecialname + instance void .ctor () cil managed { - // Method begins at RVA 0x20c9 + // Method begins at RVA 0x20c7 // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method '<>c__DisplayClass1_0`2'::.ctor - .method assembly hidebysig + .method assembly hidebysig instance class C`1 'b__0' ( !T t2, !U u2 - ) cil managed + ) cil managed { - // Method begins at RVA 0x20d4 + // Method begins at RVA 0x20d0 // Code size 103 (0x67) .maxstack 4 IL_0000: ldc.i4.5 @@ -7072,12 +7385,12 @@ .maxstack 4 } // end of method '<>c__DisplayClass1_0`2'::'b__0' } // end of class <>c__DisplayClass1_0`2 // Methods - .method public hidebysig static + .method public hidebysig static class C`1 M ( class C`1 o, !!T t1, !!U u1 - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 @@ -7231,36 +7544,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$4A1E373BE5A70EE56E2FA5F469AC30F9'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D884D1E13988E83801B7574694E1C2C5' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C`1 o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x21a3 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D884D1E13988E83801B7574694E1C2C5'::'$' + } // end of class $D884D1E13988E83801B7574694E1C2C5 // Methods - .method private hidebysig specialname static - void '$' ( - class C`1 o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x209c - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' - .method public hidebysig + .method public hidebysig instance class [mscorlib]System.Collections.Generic.IEnumerable`1 M ( - !T t1, + !$T0 t1, !!U u1 - ) cil managed + ) cil managed { - // Method begins at RVA 0x209e + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 38 38 34 + 44 31 45 31 33 39 38 38 45 38 33 38 30 31 42 37 + 35 37 34 36 39 34 45 31 43 32 43 35 00 00 + ) + // Method begins at RVA 0x209c // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M - } // end of class <>E__0`1 + } // end of method '$4A1E373BE5A70EE56E2FA5F469AC30F9'::M + } // end of class $4A1E373BE5A70EE56E2FA5F469AC30F9 .class nested private auto ansi sealed beforefieldinit 'd__1`2' extends [mscorlib]System.Object implements class [mscorlib]System.Collections.Generic.IEnumerable`1, @@ -7295,15 +7622,15 @@ .field public !U '<>3__u1' .field private !T t1 .field public !T '<>3__t1' // Methods - .method public hidebysig specialname rtspecialname + .method public hidebysig specialname rtspecialname instance void .ctor ( int32 '<>1__state' - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) - // Method begins at RVA 0x20a1 + // Method begins at RVA 0x209f // Code size 25 (0x19) .maxstack 8 IL_0000: ldarg.0 @@ -7316,14 +7643,14 @@ .maxstack 8 IL_0013: stfld int32 class Extensions/'d__1`2'::'<>l__initialThreadId' IL_0018: ret } // end of method 'd__1`2'::.ctor - .method private final hidebysig newslot virtual - instance void System.IDisposable.Dispose () cil managed + .method private final hidebysig newslot virtual + instance void System.IDisposable.Dispose () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) .override method instance void [mscorlib]System.IDisposable::Dispose() - // Method begins at RVA 0x20bb + // Method begins at RVA 0x20b9 // Code size 9 (0x9) .maxstack 8 IL_0000: ldarg.0 @@ -7331,11 +7658,11 @@ .maxstack 8 IL_0003: stfld int32 class Extensions/'d__1`2'::'<>1__state' IL_0008: ret } // end of method 'd__1`2'::System.IDisposable.Dispose - .method private final hidebysig newslot virtual - instance bool MoveNext () cil managed + .method private final hidebysig newslot virtual + instance bool MoveNext () cil managed { .override method instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() - // Method begins at RVA 0x20c8 + // Method begins at RVA 0x20c4 // Code size 97 (0x61) .maxstack 4 .locals init ( @@ -7379,55 +7706,55 @@ [0] int32 IL_005f: ldc.i4.0 IL_0060: ret } // end of method 'd__1`2'::MoveNext - .method private final hidebysig specialname newslot virtual - instance string 'System.Collections.Generic.IEnumerator.get_Current' () cil managed + .method private final hidebysig specialname newslot virtual + instance string 'System.Collections.Generic.IEnumerator.get_Current' () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) .override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() - // Method begins at RVA 0x2135 + // Method begins at RVA 0x2131 // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldfld string class Extensions/'d__1`2'::'<>2__current' IL_0006: ret } // end of method 'd__1`2'::'System.Collections.Generic.IEnumerator.get_Current' - .method private final hidebysig newslot virtual - instance void System.Collections.IEnumerator.Reset () cil managed + .method private final hidebysig newslot virtual + instance void System.Collections.IEnumerator.Reset () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) .override method instance void [mscorlib]System.Collections.IEnumerator::Reset() - // Method begins at RVA 0x213d + // Method begins at RVA 0x2139 // Code size 6 (0x6) .maxstack 8 IL_0000: newobj instance void [mscorlib]System.NotSupportedException::.ctor() IL_0005: throw } // end of method 'd__1`2'::System.Collections.IEnumerator.Reset - .method private final hidebysig specialname newslot virtual - instance object System.Collections.IEnumerator.get_Current () cil managed + .method private final hidebysig specialname newslot virtual + instance object System.Collections.IEnumerator.get_Current () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) .override method instance object [mscorlib]System.Collections.IEnumerator::get_Current() - // Method begins at RVA 0x2135 + // Method begins at RVA 0x2131 // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldfld string class Extensions/'d__1`2'::'<>2__current' IL_0006: ret } // end of method 'd__1`2'::System.Collections.IEnumerator.get_Current - .method private final hidebysig newslot virtual - instance class [mscorlib]System.Collections.Generic.IEnumerator`1 'System.Collections.Generic.IEnumerable.GetEnumerator' () cil managed + .method private final hidebysig newslot virtual + instance class [mscorlib]System.Collections.Generic.IEnumerator`1 'System.Collections.Generic.IEnumerable.GetEnumerator' () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) .override method instance class [mscorlib]System.Collections.Generic.IEnumerator`1 class [mscorlib]System.Collections.Generic.IEnumerable`1::GetEnumerator() - // Method begins at RVA 0x2144 + // Method begins at RVA 0x2140 // Code size 79 (0x4f) .maxstack 2 .locals init ( @@ -7465,14 +7792,14 @@ .locals init ( IL_004d: ldloc.0 IL_004e: ret } // end of method 'd__1`2'::'System.Collections.Generic.IEnumerable.GetEnumerator' - .method private final hidebysig newslot virtual - instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () cil managed + .method private final hidebysig newslot virtual + instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) .override method instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() - // Method begins at RVA 0x219f + // Method begins at RVA 0x219b // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 @@ -7490,12 +7817,12 @@ .property instance object System.Collections.IEnumerator.Current() } } // end of class d__1`2 // Methods - .method public hidebysig static + .method public hidebysig static class [mscorlib]System.Collections.Generic.IEnumerable`1 M ( class C`1 o, !!T t1, !!U u1 - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.IteratorStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 14 45 78 74 65 6e 73 69 6f 6e 73 2b 3c 4d @@ -7620,36 +7947,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$4A1E373BE5A70EE56E2FA5F469AC30F9'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D884D1E13988E83801B7574694E1C2C5' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + class C`1 o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x21ce + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D884D1E13988E83801B7574694E1C2C5'::'$' + } // end of class $D884D1E13988E83801B7574694E1C2C5 // Methods - .method private hidebysig specialname static - void '$' ( - class C`1 o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20d2 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' - .method public hidebysig + .method public hidebysig instance class [mscorlib]System.Threading.Tasks.Task`1 M ( - !T t1, + !$T0 t1, !!U u1 - ) cil managed + ) cil managed { - // Method begins at RVA 0x20d4 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 38 38 34 + 44 31 45 31 33 39 38 38 45 38 33 38 30 31 42 37 + 35 37 34 36 39 34 45 31 43 32 43 35 00 00 + ) + // Method begins at RVA 0x20d2 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M - } // end of class <>E__0`1 + } // end of method '$4A1E373BE5A70EE56E2FA5F469AC30F9'::M + } // end of class $4A1E373BE5A70EE56E2FA5F469AC30F9 .class nested private auto ansi sealed beforefieldinit 'd__1`2' extends [mscorlib]System.ValueType implements [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine @@ -7665,8 +8006,8 @@ .field public !U u1 .field public !T t1 .field private valuetype [mscorlib]System.Runtime.CompilerServices.YieldAwaitable/YieldAwaiter '<>u__1' // Methods - .method private final hidebysig newslot virtual - instance void MoveNext () cil managed + .method private final hidebysig newslot virtual + instance void MoveNext () cil managed { .override method instance void [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext() // Method begins at RVA 0x20d8 @@ -7757,10 +8098,10 @@ [4] class [mscorlib]System.Exception IL_00c4: call instance void valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) IL_00c9: ret } // end of method 'd__1`2'::MoveNext - .method private final hidebysig newslot virtual + .method private final hidebysig newslot virtual instance void SetStateMachine ( class [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine stateMachine - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -7777,12 +8118,12 @@ .maxstack 8 } // end of method 'd__1`2'::SetStateMachine } // end of class d__1`2 // Methods - .method public hidebysig static + .method public hidebysig static class [mscorlib]System.Threading.Tasks.Task`1 M ( class C`1 o, !!T t1, !!U u1 - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 14 45 78 74 65 6e 73 69 6f 6e 73 2b 3c 4d @@ -7937,42 +8278,56 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D34838CB2C73A4E406AE3905787D97D' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object _ + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x207e + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D34838CB2C73A4E406AE3905787D97D'::'$' + } // end of class $3D34838CB2C73A4E406AE3905787D97D // Methods - .method private hidebysig specialname static - void '$' ( - object _ - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x207b - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig static + .method public hidebysig static string M ( object o, string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x207d + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 33 34 + 38 33 38 43 42 32 43 37 33 41 34 45 34 30 36 41 + 45 33 39 30 35 37 38 37 44 39 37 44 00 00 + ) + // Method begins at RVA 0x207b // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method public hidebysig static + .method public hidebysig static string M ( object o, string s - ) cil managed + ) cil managed { // Method begins at RVA 0x2067 // Code size 19 (0x13) @@ -8062,7 +8417,7 @@ .maxstack 2 verifier2.VerifyIL("Program.Test", testIL); verifier2.VerifyIL("Extensions.M2", m2IL); - comp2 = CreateCompilationWithIL(src2, expectedTypeIL, options: TestOptions.DebugExe); + comp2 = CreateCompilationWithIL(src2, expectedTypeIL + ExtensionMarkerNameAttributeIL, options: TestOptions.DebugExe); CompileAndVerify(comp2, expectedOutput: "1234").VerifyDiagnostics(); var remove = """ @@ -8071,7 +8426,7 @@ 01 00 00 00 ) """; - comp2 = CreateCompilationWithIL(src2, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length)); + comp2 = CreateCompilationWithIL(src2, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length) + ExtensionMarkerNameAttributeIL); comp2.VerifyDiagnostics( // (11,23): error CS0117: 'object' does not contain a definition for 'M' // return object.M(o, "2"); @@ -8418,36 +8773,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D34838CB2C73A4E406AE3905787D97D' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object _ + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20ae + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D34838CB2C73A4E406AE3905787D97D'::'$' + } // end of class $3D34838CB2C73A4E406AE3905787D97D // Methods - .method private hidebysig specialname static - void '$' ( - object _ - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20ab - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig static string M ( object o, string s ) cil managed { - // Method begins at RVA 0x20ad + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 33 34 + 38 33 38 43 42 32 43 37 33 41 34 45 34 30 36 41 + 45 33 39 30 35 37 38 37 44 39 37 44 00 00 + ) + // Method begins at RVA 0x20ab // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0' extends [mscorlib]System.ValueType { @@ -8513,7 +8882,7 @@ public static class Extensions { extension(object _) { - static string M(object o, string s) + public static string M(object o, string s) { string local() => o + s; return local(); @@ -8522,7 +8891,7 @@ static string M(object o, string s) extension(object) { - static string M(object o, string s, int x) + public static string M(object o, string s, int x) { string local() => o + s; return local(); @@ -8531,7 +8900,227 @@ static string M(object o, string s, int x) } """; var comp2 = CreateCompilation(src2); - CompileAndVerify(comp2).VerifyDiagnostics(); + CompileAndVerify(comp2, symbolValidator: (m) => + { + var container = m.GlobalNamespace.GetTypeMember("Extensions"); + var extensions = container.GetTypeMembers(); + + AssertEx.Equal("System.Object _", extensions[0].ExtensionParameter.ToTestDisplayString()); + AssertEx.Equal("$3D34838CB2C73A4E406AE3905787D97D", extensions[0].MetadataName); + Symbol m1 = extensions[0].GetMembers().Single(); + AssertEx.Equal("Extensions.extension(object).M(object, string)", m1.ToDisplayString()); + AssertEx.Equal(@"System.Runtime.CompilerServices.ExtensionMarkerNameAttribute(""$3D34838CB2C73A4E406AE3905787D97D"")", m1.GetAttributes().Single().ToString()); + + AssertEx.Equal("System.Object value", extensions[1].ExtensionParameter.ToTestDisplayString()); + AssertEx.Equal("$C43E2675C7BBF9284AF22FB8A9BF0280", extensions[1].MetadataName); + Symbol m2 = extensions[1].GetMembers().Single(); + AssertEx.Equal("Extensions.extension(object).M(object, string, int)", m2.ToDisplayString()); + AssertEx.Equal(@"System.Runtime.CompilerServices.ExtensionMarkerNameAttribute(""$C43E2675C7BBF9284AF22FB8A9BF0280"")", m2.GetAttributes().Single().ToString()); + }).VerifyDiagnostics(). + VerifyTypeIL("Extensions", """ +.class public auto ansi abstract sealed beforefieldinit Extensions + extends [mscorlib]System.Object +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D34838CB2C73A4E406AE3905787D97D' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object _ + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20f1 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D34838CB2C73A4E406AE3905787D97D'::'$' + } // end of class $3D34838CB2C73A4E406AE3905787D97D + .class nested private auto ansi abstract sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20f1 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::'$' + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 + // Methods + .method public hidebysig static + string M ( + object o, + string s + ) cil managed + { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 33 34 + 38 33 38 43 42 32 43 37 33 41 34 45 34 30 36 41 + 45 33 39 30 35 37 38 37 44 39 37 44 00 00 + ) + // Method begins at RVA 0x20ee + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + .method public hidebysig static + string M ( + object o, + string s, + int32 x + ) cil managed + { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 + ) + // Method begins at RVA 0x20ee + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 + .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0' + extends [mscorlib]System.ValueType + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Fields + .field public object o + .field public string s + } // end of class <>c__DisplayClass1_0 + .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass3_0' + extends [mscorlib]System.ValueType + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Fields + .field public object o + .field public string s + } // end of class <>c__DisplayClass3_0 + // Methods + .method public hidebysig static + string M ( + object o, + string s + ) cil managed + { + // Method begins at RVA 0x2068 + // Code size 24 (0x18) + .maxstack 2 + .locals init ( + [0] valuetype Extensions/'<>c__DisplayClass1_0' + ) + IL_0000: ldloca.s 0 + IL_0002: ldarg.0 + IL_0003: stfld object Extensions/'<>c__DisplayClass1_0'::o + IL_0008: ldloca.s 0 + IL_000a: ldarg.1 + IL_000b: stfld string Extensions/'<>c__DisplayClass1_0'::s + IL_0010: ldloca.s 0 + IL_0012: call string Extensions::'g__local|1_0'(valuetype Extensions/'<>c__DisplayClass1_0'&) + IL_0017: ret + } // end of method Extensions::M + .method public hidebysig static + string M ( + object o, + string s, + int32 x + ) cil managed + { + // Method begins at RVA 0x208c + // Code size 24 (0x18) + .maxstack 2 + .locals init ( + [0] valuetype Extensions/'<>c__DisplayClass3_0' + ) + IL_0000: ldloca.s 0 + IL_0002: ldarg.0 + IL_0003: stfld object Extensions/'<>c__DisplayClass3_0'::o + IL_0008: ldloca.s 0 + IL_000a: ldarg.1 + IL_000b: stfld string Extensions/'<>c__DisplayClass3_0'::s + IL_0010: ldloca.s 0 + IL_0012: call string Extensions::'g__local|3_0'(valuetype Extensions/'<>c__DisplayClass3_0'&) + IL_0017: ret + } // end of method Extensions::M + .method assembly hidebysig static + string 'g__local|1_0' ( + valuetype Extensions/'<>c__DisplayClass1_0'& '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20b0 + // Code size 30 (0x1e) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld object Extensions/'<>c__DisplayClass1_0'::o + IL_0006: dup + IL_0007: brtrue.s IL_000d + IL_0009: pop + IL_000a: ldnull + IL_000b: br.s IL_0012 + IL_000d: callvirt instance string [mscorlib]System.Object::ToString() + IL_0012: ldarg.0 + IL_0013: ldfld string Extensions/'<>c__DisplayClass1_0'::s + IL_0018: call string [mscorlib]System.String::Concat(string, string) + IL_001d: ret + } // end of method Extensions::'g__local|1_0' + .method assembly hidebysig static + string 'g__local|3_0' ( + valuetype Extensions/'<>c__DisplayClass3_0'& '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20cf + // Code size 30 (0x1e) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld object Extensions/'<>c__DisplayClass3_0'::o + IL_0006: dup + IL_0007: brtrue.s IL_000d + IL_0009: pop + IL_000a: ldnull + IL_000b: br.s IL_0012 + IL_000d: callvirt instance string [mscorlib]System.Object::ToString() + IL_0012: ldarg.0 + IL_0013: ldfld string Extensions/'<>c__DisplayClass3_0'::s + IL_0018: call string [mscorlib]System.String::Concat(string, string) + IL_001d: ret + } // end of method Extensions::'g__local|3_0' +} // end of class Extensions +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); var src3 = """ class Program @@ -8596,36 +9185,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D34838CB2C73A4E406AE3905787D97D' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object _ + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20b6 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D34838CB2C73A4E406AE3905787D97D'::'$' + } // end of class $3D34838CB2C73A4E406AE3905787D97D // Methods - .method private hidebysig specialname static - void '$' ( - object _ - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x208c - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig static + .method public hidebysig static string M ( object o, string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x208e + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 33 34 + 38 33 38 43 42 32 43 37 33 41 34 45 34 30 36 41 + 45 33 39 30 35 37 38 37 44 39 37 44 00 00 + ) + // Method begins at RVA 0x208c // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass1_0' extends [mscorlib]System.Object { @@ -8636,20 +9239,20 @@ 01 00 00 00 .field public object o .field public string s // Methods - .method public hidebysig specialname rtspecialname - instance void .ctor () cil managed + .method public hidebysig specialname rtspecialname + instance void .ctor () cil managed { - // Method begins at RVA 0x2091 + // Method begins at RVA 0x208f // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method '<>c__DisplayClass1_0'::.ctor - .method assembly hidebysig - instance string 'b__0' () cil managed + .method assembly hidebysig + instance string 'b__0' () cil managed { - // Method begins at RVA 0x2099 + // Method begins at RVA 0x2097 // Code size 30 (0x1e) .maxstack 8 IL_0000: ldarg.0 @@ -8667,11 +9270,11 @@ .maxstack 8 } // end of method '<>c__DisplayClass1_0'::'b__0' } // end of class <>c__DisplayClass1_0 // Methods - .method public hidebysig static + .method public hidebysig static string M ( object o, string s - ) cil managed + ) cil managed { // Method begins at RVA 0x2067 // Code size 36 (0x24) @@ -8782,36 +9385,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D34838CB2C73A4E406AE3905787D97D' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object _ + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2167 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D34838CB2C73A4E406AE3905787D97D'::'$' + } // end of class $3D34838CB2C73A4E406AE3905787D97D // Methods - .method private hidebysig specialname static - void '$' ( - object _ - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x207e - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig static + .method public hidebysig static class [mscorlib]System.Collections.Generic.IEnumerable`1 M ( object o, string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x2080 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 33 34 + 38 33 38 43 42 32 43 37 33 41 34 45 34 30 36 41 + 45 33 39 30 35 37 38 37 44 39 37 44 00 00 + ) + // Method begins at RVA 0x207e // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi sealed beforefieldinit 'd__1' extends [mscorlib]System.Object implements class [mscorlib]System.Collections.Generic.IEnumerable`1, @@ -8844,15 +9461,15 @@ .field public object '<>3__o' .field private string s .field public string '<>3__s' // Methods - .method public hidebysig specialname rtspecialname + .method public hidebysig specialname rtspecialname instance void .ctor ( int32 '<>1__state' - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) - // Method begins at RVA 0x2083 + // Method begins at RVA 0x2081 // Code size 25 (0x19) .maxstack 8 IL_0000: ldarg.0 @@ -8865,14 +9482,14 @@ .maxstack 8 IL_0013: stfld int32 Extensions/'d__1'::'<>l__initialThreadId' IL_0018: ret } // end of method 'd__1'::.ctor - .method private final hidebysig newslot virtual - instance void System.IDisposable.Dispose () cil managed + .method private final hidebysig newslot virtual + instance void System.IDisposable.Dispose () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 ) .override method instance void [mscorlib]System.IDisposable::Dispose() - // Method begins at RVA 0x209d + // Method begins at RVA 0x209b // Code size 9 (0x9) .maxstack 8 IL_0000: ldarg.0 @@ -8880,8 +9497,8 @@ .maxstack 8 IL_0003: stfld int32 Extensions/'d__1'::'<>1__state' IL_0008: ret } // end of method 'd__1'::System.IDisposable.Dispose - .method private final hidebysig newslot virtual - instance bool MoveNext () cil managed + .method private final hidebysig newslot virtual + instance bool MoveNext () cil managed { .override method instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() // Method begins at RVA 0x20a8 @@ -8927,8 +9544,8 @@ [0] int32 IL_004a: ldc.i4.0 IL_004b: ret } // end of method 'd__1'::MoveNext - .method private final hidebysig specialname newslot virtual - instance string 'System.Collections.Generic.IEnumerator.get_Current' () cil managed + .method private final hidebysig specialname newslot virtual + instance string 'System.Collections.Generic.IEnumerator.get_Current' () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -8941,8 +9558,8 @@ .maxstack 8 IL_0001: ldfld string Extensions/'d__1'::'<>2__current' IL_0006: ret } // end of method 'd__1'::'System.Collections.Generic.IEnumerator.get_Current' - .method private final hidebysig newslot virtual - instance void System.Collections.IEnumerator.Reset () cil managed + .method private final hidebysig newslot virtual + instance void System.Collections.IEnumerator.Reset () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -8954,8 +9571,8 @@ .maxstack 8 IL_0000: newobj instance void [mscorlib]System.NotSupportedException::.ctor() IL_0005: throw } // end of method 'd__1'::System.Collections.IEnumerator.Reset - .method private final hidebysig specialname newslot virtual - instance object System.Collections.IEnumerator.get_Current () cil managed + .method private final hidebysig specialname newslot virtual + instance object System.Collections.IEnumerator.get_Current () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -8968,8 +9585,8 @@ .maxstack 8 IL_0001: ldfld string Extensions/'d__1'::'<>2__current' IL_0006: ret } // end of method 'd__1'::System.Collections.IEnumerator.get_Current - .method private final hidebysig newslot virtual - instance class [mscorlib]System.Collections.Generic.IEnumerator`1 'System.Collections.Generic.IEnumerable.GetEnumerator' () cil managed + .method private final hidebysig newslot virtual + instance class [mscorlib]System.Collections.Generic.IEnumerator`1 'System.Collections.Generic.IEnumerable.GetEnumerator' () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -9009,8 +9626,8 @@ [0] class Extensions/'d__1' IL_0041: ldloc.0 IL_0042: ret } // end of method 'd__1'::'System.Collections.Generic.IEnumerable.GetEnumerator' - .method private final hidebysig newslot virtual - instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () cil managed + .method private final hidebysig newslot virtual + instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -9034,11 +9651,11 @@ .property instance object System.Collections.IEnumerator.Current() } } // end of class d__1 // Methods - .method public hidebysig static + .method public hidebysig static class [mscorlib]System.Collections.Generic.IEnumerable`1 M ( object o, string s - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.IteratorStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 12 45 78 74 65 6e 73 69 6f 6e 73 2b 3c 4d @@ -9147,36 +9764,50 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$3D34838CB2C73A4E406AE3905787D97D' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object _ + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2196 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$3D34838CB2C73A4E406AE3905787D97D'::'$' + } // end of class $3D34838CB2C73A4E406AE3905787D97D // Methods - .method private hidebysig specialname static - void '$' ( - object _ - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20b3 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig static + .method public hidebysig static class [mscorlib]System.Threading.Tasks.Task`1 M ( object o, string s - ) cil managed + ) cil managed { - // Method begins at RVA 0x20b5 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 33 44 33 34 + 38 33 38 43 42 32 43 37 33 41 34 45 34 30 36 41 + 45 33 39 30 35 37 38 37 44 39 37 44 00 00 + ) + // Method begins at RVA 0x20b3 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi sealed beforefieldinit 'd__1' extends [mscorlib]System.ValueType implements [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine @@ -9191,8 +9822,8 @@ .field public object o .field public string s .field private valuetype [mscorlib]System.Runtime.CompilerServices.YieldAwaitable/YieldAwaiter '<>u__1' // Methods - .method private final hidebysig newslot virtual - instance void MoveNext () cil managed + .method private final hidebysig newslot virtual + instance void MoveNext () cil managed { .override method instance void [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext() // Method begins at RVA 0x20b8 @@ -9282,10 +9913,10 @@ [4] class [mscorlib]System.Exception IL_00ac: call instance void valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) IL_00b1: ret } // end of method 'd__1'::MoveNext - .method private final hidebysig newslot virtual + .method private final hidebysig newslot virtual instance void SetStateMachine ( class [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine stateMachine - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 @@ -9302,11 +9933,11 @@ .maxstack 8 } // end of method 'd__1'::SetStateMachine } // end of class d__1 // Methods - .method public hidebysig static + .method public hidebysig static class [mscorlib]System.Threading.Tasks.Task`1 M ( object o, string s - ) cil managed + ) cil managed { .custom instance void [mscorlib]System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 12 45 78 74 65 6e 73 69 6f 6e 73 2b 3c 4d @@ -9437,43 +10068,62 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2072 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed + .method public hidebysig specialname + instance string get_P () cil managed { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 ) // Method begins at RVA 0x206f - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig specialname - instance string get_P () cil managed - { - // Method begins at RVA 0x2071 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::get_P // Properties .property instance string P() { - .get instance string Extensions/'<>E__0'::get_P() + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + .get instance string Extensions/'$C43E2675C7BBF9284AF22FB8A9BF0280'::get_P() } - } // end of class <>E__0 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method public hidebysig static + .method public hidebysig static string get_P ( object o - ) cil managed + ) cil managed { // Method begins at RVA 0x2067 // Code size 7 (0x7) @@ -9551,7 +10201,7 @@ .maxstack 1 verifier3.VerifyIL("Program.Test", testIL); verifier3.VerifyIL("Extensions.get_P2(object)", m2IL); - comp3 = CreateCompilationWithIL(src3, expectedTypeIL, options: TestOptions.DebugExe); + comp3 = CreateCompilationWithIL(src3, expectedTypeIL + ExtensionMarkerNameAttributeIL, options: TestOptions.DebugExe); CompileAndVerify(comp3, expectedOutput: "12").VerifyDiagnostics(); var remove = """ @@ -9560,7 +10210,7 @@ 01 00 00 00 ) """; - comp3 = CreateCompilationWithIL(src3, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length)); + comp3 = CreateCompilationWithIL(src3, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length) + ExtensionMarkerNameAttributeIL); comp3.VerifyDiagnostics( // (11,18): error CS1061: 'object' does not contain a definition for 'P' and no accessible extension method 'P' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) // return o.P; @@ -9726,41 +10376,60 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2071 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::'$' + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method private hidebysig specialname static - void '$' ( - object '' - ) cil managed + .method public hidebysig specialname static + string get_P () cil managed { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 ) // Method begins at RVA 0x206e - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' - .method public hidebysig specialname static - string get_P () cil managed - { - // Method begins at RVA 0x2070 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::get_P // Properties .property string P() { - .get string Extensions/'<>E__0'::get_P() + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 + ) + .get string Extensions/'$C43E2675C7BBF9284AF22FB8A9BF0280'::get_P() } - } // end of class <>E__0 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method public hidebysig static - string get_P () cil managed + .method public hidebysig static + string get_P () cil managed { // Method begins at RVA 0x2067 // Code size 6 (0x6) @@ -9835,7 +10504,7 @@ .maxstack 1 verifier3.VerifyIL("Program.Test", testIL); verifier3.VerifyIL("Extensions.get_P2()", m2IL); - comp3 = CreateCompilationWithIL(src3, expectedTypeIL, options: TestOptions.DebugExe); + comp3 = CreateCompilationWithIL(src3, expectedTypeIL + ExtensionMarkerNameAttributeIL, options: TestOptions.DebugExe); CompileAndVerify(comp3, expectedOutput: "PP").VerifyDiagnostics(); var remove = """ @@ -9844,7 +10513,7 @@ 01 00 00 00 ) """; - comp3 = CreateCompilationWithIL(src3, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length)); + comp3 = CreateCompilationWithIL(src3, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length) + ExtensionMarkerNameAttributeIL); comp3.VerifyDiagnostics( // (11,23): error CS0117: 'object' does not contain a definition for 'P' // return object.P; @@ -9937,40 +10606,59 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2072 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x206f - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method public hidebysig specialname instance string get_P () cil managed { - // Method begins at RVA 0x2071 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + // Method begins at RVA 0x206f // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::get_P // Properties .property instance string P() { - .get instance string Extensions/'<>E__0'::get_P() + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + .get instance string Extensions/'$C43E2675C7BBF9284AF22FB8A9BF0280'::get_P() } - } // end of class <>E__0 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 // Methods - .method public hidebysig static + .method public hidebysig static string get_P ( object o ) cil managed @@ -10086,33 +10774,47 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$8048A6C8BE30A622530249B904B537EB'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D3EAC011D93395A3E50DF069CE627102' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + !T o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20ea + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D3EAC011D93395A3E50DF069CE627102'::'$' + } // end of class $D3EAC011D93395A3E50DF069CE627102 // Methods - .method private hidebysig specialname static - void '$' ( - !T o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20e7 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' .method public hidebysig instance void M2 () cil managed { - // Method begins at RVA 0x20e9 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 33 45 41 + 43 30 31 31 44 39 33 33 39 35 41 33 45 35 30 44 + 46 30 36 39 43 45 36 32 37 31 30 32 00 00 + ) + // Method begins at RVA 0x20e7 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M2 - } // end of class <>E__0`1 + } // end of method '$8048A6C8BE30A622530249B904B537EB'::M2 + } // end of class $8048A6C8BE30A622530249B904B537EB .class nested private auto ansi abstract sealed beforefieldinit 'O__1_0`3' extends [mscorlib]System.Object { @@ -10237,33 +10939,47 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$8048A6C8BE30A622530249B904B537EB'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D3EAC011D93395A3E50DF069CE627102' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + !T o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20b5 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D3EAC011D93395A3E50DF069CE627102'::'$' + } // end of class $D3EAC011D93395A3E50DF069CE627102 // Methods - .method private hidebysig specialname static - void '$' ( - !T o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x20b2 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' .method public hidebysig instance void M2 () cil managed { - // Method begins at RVA 0x20b4 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 33 45 41 + 43 30 31 31 44 39 33 33 39 35 41 33 45 35 30 44 + 46 30 36 39 43 45 36 32 37 31 30 32 00 00 + ) + // Method begins at RVA 0x20b2 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M2 - } // end of class <>E__0`1 + } // end of method '$8048A6C8BE30A622530249B904B537EB'::M2 + } // end of class $8048A6C8BE30A622530249B904B537EB .class nested private auto ansi abstract sealed beforefieldinit '<>O__1_0`1' extends [mscorlib]System.Object { @@ -10384,33 +11100,47 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig instance void M2 () cil managed { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) // Method begins at RVA 0x208e // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M2 - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M2 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi abstract sealed beforefieldinit '<>O' extends [mscorlib]System.Object { @@ -10524,33 +11254,47 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$8048A6C8BE30A622530249B904B537EB'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D3EAC011D93395A3E50DF069CE627102' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + !T o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2099 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D3EAC011D93395A3E50DF069CE627102'::'$' + } // end of class $D3EAC011D93395A3E50DF069CE627102 // Methods - .method private hidebysig specialname static - void '$' ( - !T o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2096 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' .method private hidebysig instance class [mscorlib]System.Action M2 () cil managed { - // Method begins at RVA 0x2098 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 33 45 41 + 43 30 31 31 44 39 33 33 39 35 41 33 45 35 30 44 + 46 30 36 39 43 45 36 32 37 31 30 32 00 00 + ) + // Method begins at RVA 0x2096 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M2 - } // end of class <>E__0`1 + } // end of method '$8048A6C8BE30A622530249B904B537EB'::M2 + } // end of class $8048A6C8BE30A622530249B904B537EB .class nested private auto ansi abstract sealed beforefieldinit '<>O__1_0`1' extends [mscorlib]System.Object { @@ -10666,33 +11410,47 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2099 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2096 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig instance class [mscorlib]System.Action M2 () cil managed { - // Method begins at RVA 0x2098 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) + // Method begins at RVA 0x2096 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M2 - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M2 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi abstract sealed beforefieldinit '<>O' extends [mscorlib]System.Object { @@ -10815,33 +11573,47 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$8048A6C8BE30A622530249B904B537EB'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D3EAC011D93395A3E50DF069CE627102' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + !T o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2155 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D3EAC011D93395A3E50DF069CE627102'::'$' + } // end of class $D3EAC011D93395A3E50DF069CE627102 // Methods - .method private hidebysig specialname static - void '$' ( - !T o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2152 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' .method public hidebysig instance void M2 () cil managed { - // Method begins at RVA 0x2154 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 33 45 41 + 43 30 31 31 44 39 33 33 39 35 41 33 45 35 30 44 + 46 30 36 39 43 45 36 32 37 31 30 32 00 00 + ) + // Method begins at RVA 0x2152 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M2 - } // end of class <>E__0`1 + } // end of method '$8048A6C8BE30A622530249B904B537EB'::M2 + } // end of class $8048A6C8BE30A622530249B904B537EB .class nested private auto ansi abstract sealed beforefieldinit '<>o__0|1`3' extends [mscorlib]System.Object { @@ -11008,33 +11780,47 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0`1' + .class nested public auto ansi sealed specialname '$8048A6C8BE30A622530249B904B537EB'<$T0> extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D3EAC011D93395A3E50DF069CE627102' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + !T o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D3EAC011D93395A3E50DF069CE627102'::'$' + } // end of class $D3EAC011D93395A3E50DF069CE627102 // Methods - .method private hidebysig specialname static - void '$' ( - !T o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0`1'::'$' .method private hidebysig instance void M2 () cil managed { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 44 33 45 41 + 43 30 31 31 44 39 33 33 39 35 41 33 45 35 30 44 + 46 30 36 39 43 45 36 32 37 31 30 32 00 00 + ) // Method begins at RVA 0x20d4 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0`1'::M2 - } // end of class <>E__0`1 + } // end of method '$8048A6C8BE30A622530249B904B537EB'::M2 + } // end of class $8048A6C8BE30A622530249B904B537EB .class nested private auto ansi abstract sealed beforefieldinit '<>o__1`1' extends [mscorlib]System.Object { @@ -11171,33 +11957,47 @@ extends [mscorlib]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' extends [mscorlib]System.Object { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 // Methods - .method private hidebysig specialname static - void '$' ( - object o - ) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig instance void M2 () cil managed { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 31 31 39 41 + 41 32 38 31 43 31 34 33 35 34 37 35 36 33 32 35 + 30 43 41 46 38 39 42 34 38 41 37 36 00 00 + ) // Method begins at RVA 0x20c9 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M2 - } // end of class <>E__0 + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M2 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 .class nested private auto ansi abstract sealed beforefieldinit '<>o__1' extends [mscorlib]System.Object { @@ -11317,7 +12117,7 @@ public static class Extensions var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new object().M()"); - Assert.Equal("void Extensions.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); } [Fact] @@ -11349,8 +12149,8 @@ void M() { } var memberAccess = GetSyntax(tree, "new object().M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void Extensions.<>E__0.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void Extensions.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); src = """ new object().M(); @@ -11374,8 +12174,8 @@ private static void M(this object o) { } memberAccess = GetSyntax(tree, "new object().M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void System.Object.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void System.Object.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void System.Object.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void System.Object.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -11405,12 +12205,12 @@ public void M() { } var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new object().M()"); - Assert.Equal("void E2.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(invocation).ToTestDisplayStrings()); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E2.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); src = """ new object().M(); @@ -11430,12 +12230,12 @@ public static void M(this object o) { } tree = comp.SyntaxTrees[0]; model = comp.GetSemanticModel(tree); invocation = GetSyntax(tree, "new object().M()"); - Assert.Equal("void System.Object.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void System.Object.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(invocation).ToTestDisplayStrings()); memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void System.Object.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void System.Object.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void System.Object.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void System.Object.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -11458,10 +12258,10 @@ public static class Extensions var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new object().M()"); - Assert.Equal("void Extensions.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void Extensions.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal(["void Extensions.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void Extensions.$8048A6C8BE30A622530249B904B537EB.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -11496,13 +12296,13 @@ public static void M2(this T t) where T : struct { } Assert.Null(model.GetSymbolInfo(invocation).Symbol); invocation = GetSyntax(tree, "int.M()"); - Assert.Equal("void Extensions.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void Extensions.$BCF902721DDD961E5243C324D8379E5C.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); var memberAccess = GetSyntax(tree, "object.M"); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); memberAccess = GetSyntax(tree, "int.M"); - Assert.Equal(["void Extensions.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void Extensions.$BCF902721DDD961E5243C324D8379E5C.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -11529,11 +12329,11 @@ public static class E var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.P"); - Assert.Equal("System.Int32 E.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$BCF902721DDD961E5243C324D8379E5C.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access memberAccess = GetSyntax(tree, "int.P"); - Assert.Equal("System.Int32 E.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$BCF902721DDD961E5243C324D8379E5C.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -11708,7 +12508,7 @@ static class E {{eSrc}} """; - verify(src1, "N2.E.<>E__0"); + verify(src1, "N2.E.$C43E2675C7BBF9284AF22FB8A9BF0280"); var src2 = $$""" using N2; @@ -11741,7 +12541,7 @@ namespace N4 {{eSrc}} } """; - verify(src3, "N3.N2.E.<>E__0"); + verify(src3, "N3.N2.E.$C43E2675C7BBF9284AF22FB8A9BF0280"); void verify(string src, string extensionName) { @@ -11752,8 +12552,8 @@ void verify(string src, string extensionName) var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new object().Method"); - Assert.Equal($$"""void {{extensionName}}.Method()""", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); - Assert.Equal([$$"""void {{extensionName}}.Method()"""], model.GetMemberGroup(invocation).ToTestDisplayStrings()); + AssertEx.Equal($$"""void {{extensionName}}.Method()""", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal([$$"""void {{extensionName}}.Method()"""], model.GetMemberGroup(invocation).ToTestDisplayStrings()); } } @@ -11792,8 +12592,8 @@ public static class E var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new object().Method"); - Assert.Equal("void N.E.<>E__0.Method()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); - Assert.Equal(["void N.E.<>E__0.Method()"], model.GetMemberGroup(invocation).ToTestDisplayStrings()); + AssertEx.Equal("void N.E.$C43E2675C7BBF9284AF22FB8A9BF0280.Method()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void N.E.$C43E2675C7BBF9284AF22FB8A9BF0280.Method()"], model.GetMemberGroup(invocation).ToTestDisplayStrings()); src = """ using N; @@ -11898,18 +12698,18 @@ static class E2 var model = comp.GetSemanticModel(tree); var invocation1 = GetSyntax(tree, "new object().Method(42)"); - Assert.Equal("void E1.<>E__0.Method(System.Int32 i)", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation1)); var invocation2 = GetSyntax(tree, """new object().Method("hello")"""); - Assert.Equal("void E2.<>E__0.Method(System.String s)", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation2)); var memberAccess1 = GetSyntaxes(tree, "new object().Method").First(); - Assert.Equal(["void E1.<>E__0.Method(System.Int32 i)", "void E2.<>E__0.Method(System.String s)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", "void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); var memberAccess2 = GetSyntaxes(tree, "new object().Method").Last(); - Assert.Equal(["void E1.<>E__0.Method(System.Int32 i)", "void E2.<>E__0.Method(System.String s)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", "void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); } [Fact] @@ -11954,18 +12754,18 @@ public static void Main() var model = comp.GetSemanticModel(tree); var invocation1 = GetSyntax(tree, "new object().Method(42)"); - Assert.Equal("void N1.E1.<>E__0.Method(System.Int32 i)", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N1.E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation1)); var invocation2 = GetSyntax(tree, """new object().Method("hello")"""); - Assert.Equal("void N1.N2.E2.<>E__0.Method(System.String s)", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N1.N2.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation2)); var memberAccess1 = GetSyntaxes(tree, "new object().Method").First(); - Assert.Equal(["void N1.N2.E2.<>E__0.Method(System.String s)", "void N1.E1.<>E__0.Method(System.Int32 i)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void N1.N2.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)", "void N1.E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); var memberAccess2 = GetSyntaxes(tree, "new object().Method").Last(); - Assert.Equal(["void N1.N2.E2.<>E__0.Method(System.String s)", "void N1.E1.<>E__0.Method(System.Int32 i)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void N1.N2.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)", "void N1.E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); } [Fact] @@ -12004,19 +12804,19 @@ static class E2 var model = comp.GetSemanticModel(tree); var invocation1 = GetSyntax(tree, "new object().Method(42)"); - Assert.Equal("void E1.<>E__0.Method(System.Int32 i)", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation1)); - Assert.Equal(["void E1.<>E__0.Method(System.Int32 i)", "void N2.E2.<>E__0.Method(System.String s)"], model.GetMemberGroup(invocation1.Expression).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", "void N2.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)"], model.GetMemberGroup(invocation1.Expression).ToTestDisplayStrings()); var invocation2 = GetSyntax(tree, """new object().Method("hello")"""); - Assert.Equal("void N2.E2.<>E__0.Method(System.String s)", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N2.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation2)); - Assert.Equal(["void E1.<>E__0.Method(System.Int32 i)", "void N2.E2.<>E__0.Method(System.String s)"], model.GetMemberGroup(invocation2.Expression).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", "void N2.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)"], model.GetMemberGroup(invocation2.Expression).ToTestDisplayStrings()); var invocation3 = GetSyntax(tree, "new object().Method(default)"); - Assert.Equal("void E1.<>E__0.Method(System.Int32 i)", model.GetSymbolInfo(invocation3).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", model.GetSymbolInfo(invocation3).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation3)); - Assert.Equal(["void E1.<>E__0.Method(System.Int32 i)", "void N2.E2.<>E__0.Method(System.String s)"], model.GetMemberGroup(invocation3.Expression).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", "void N2.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String s)"], model.GetMemberGroup(invocation3.Expression).ToTestDisplayStrings()); } [Fact] @@ -12042,12 +12842,12 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new Derived().M()"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation)); var memberAccess = GetSyntax(tree, "new Derived().M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12073,12 +12873,12 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new C().M()"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$3EADBD08A82F6ABA9495623CB335729C.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation)); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$3EADBD08A82F6ABA9495623CB335729C.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$3EADBD08A82F6ABA9495623CB335729C.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12105,12 +12905,12 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new C().M()"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$3EADBD08A82F6ABA9495623CB335729C.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation)); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$3EADBD08A82F6ABA9495623CB335729C.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$3EADBD08A82F6ABA9495623CB335729C.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12141,11 +12941,11 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "t.M()"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$3EADBD08A82F6ABA9495623CB335729C.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); var memberAccess = GetSyntax(tree, "t.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$3EADBD08A82F6ABA9495623CB335729C.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$3EADBD08A82F6ABA9495623CB335729C.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12212,10 +13012,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "t.M2()"); - Assert.Equal("void E.<>E__0.M2()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$4A1E373BE5A70EE56E2FA5F469AC30F9.M2()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); var memberAccess = GetSyntax(tree, "t.M2"); - Assert.Equal(["void E.<>E__0.M2()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$4A1E373BE5A70EE56E2FA5F469AC30F9.M2()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12254,10 +13054,10 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "t.M2()"); - Assert.Equal("void E2.<>E__0.M2()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$66F77D1E46F965A5B22D4932892FA78B.M2()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); var memberAccess = GetSyntax(tree, "t.M2"); - Assert.Equal(["void E2.<>E__0.M2()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E2.$66F77D1E46F965A5B22D4932892FA78B.M2()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12315,9 +13115,9 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new C().M()"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$4A1E373BE5A70EE56E2FA5F469AC30F9.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$4A1E373BE5A70EE56E2FA5F469AC30F9.M()"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); } [Fact] @@ -12349,7 +13149,7 @@ static class E Assert.Equal([], model.GetMemberGroup(invocation).ToTestDisplayStrings()); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$4A1E373BE5A70EE56E2FA5F469AC30F9.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12375,10 +13175,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "new C().M()"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$4A1E373BE5A70EE56E2FA5F469AC30F9.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(invocation).ToTestDisplayStrings()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$4A1E373BE5A70EE56E2FA5F469AC30F9.M()"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); } [Fact] @@ -12412,7 +13212,7 @@ static class E Assert.Null(model.GetSymbolInfo(invocation).Symbol); Assert.Equal([], model.GetMemberGroup(invocation).ToTestDisplayStrings()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$4A1E373BE5A70EE56E2FA5F469AC30F9.M()"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); } [Fact] @@ -12533,7 +13333,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "o.Method"); - Assert.Equal("void E.extension(System.Object?).Method()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("void E.extension(System.Object?).Method()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString(includeNonNullable: true)); } [Fact] @@ -12560,7 +13360,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new Alias().M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -12593,7 +13393,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal(["void E.<>E__0.M(System.Object o1)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Object o1)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12621,8 +13421,8 @@ public void M() var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$BCD00C90E683E728071BA88912DD74BD.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$BCD00C90E683E728071BA88912DD74BD.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12651,8 +13451,8 @@ public void M() var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new D().M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$BCD00C90E683E728071BA88912DD74BD.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$BCD00C90E683E728071BA88912DD74BD.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12681,7 +13481,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new D().M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$2B406085AC5EBECC11B16BCD2A24DF4E.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12708,13 +13508,13 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C<(int a, int b)>().M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$F9AFEE2D1546C3A2A4599051616A8F6D.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); memberAccess = GetSyntax(tree, "new C<(int, int)>().M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$F9AFEE2D1546C3A2A4599051616A8F6D.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); memberAccess = GetSyntax(tree, "new C<(int other, int)>().M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$F9AFEE2D1546C3A2A4599051616A8F6D.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); src = """ new C<(int a, int b)>().M(); @@ -12806,7 +13606,7 @@ public void M() { } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "o.M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12829,7 +13629,7 @@ public void M() { } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "E.M"); - Assert.Equal(["void E.M(this System.Object o)", "void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.M(this System.Object o)", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12857,7 +13657,7 @@ public void M(int i) { } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "o.M"); - Assert.Equal(["void E.<>E__0.M()", "void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12946,8 +13746,8 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.Method"); - Assert.Equal("void E.<>E__0.Method()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.Method()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.Method()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.Method()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -12979,8 +13779,8 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.Method"); - Assert.Equal("void E.<>E__0.Method()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.Method()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.Method()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.Method()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13316,8 +14116,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M()", "void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void C.M()", "void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13360,8 +14160,8 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void N.E2.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M()", "void E1.<>E__0.M(System.String s)", "void N.E2.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void N.E2.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void C.M()", "void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s)", "void N.E2.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13398,7 +14198,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void C.M()", "void E1.<>E__0.M(System.Int32 i)", "void C.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void C.M()", "void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", "void C.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13435,7 +14235,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void C.M()", "void E.<>E__0.M(System.Int32 i)", "void C.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void C.M()", "void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", "void C.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13471,8 +14271,8 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void C.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M()", "void E1.<>E__0.M(System.String s)", "void E1.<>E__0.M(System.Char c1)", "void C.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void C.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void C.M()", "void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s)", "void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Char c1)", "void C.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13510,7 +14310,7 @@ static class E var invocation = GetSyntax(tree, "M(42)"); Assert.Null(model.GetSymbolInfo(invocation).Symbol); Assert.Empty(model.GetMemberGroup(invocation)); - Assert.Equal(["void C.M()"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void C.M()"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); } [Fact] @@ -13540,8 +14340,8 @@ static class E1 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E1.<>E__0.M(System.Int32 b)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M(System.Int32 a)", "void E1.<>E__0.M(System.Int32 b)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 b)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void C.M(System.Int32 a)", "void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 b)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13578,9 +14378,9 @@ public static void M(this C self, int c) var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void C.M(System.Int32 c)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void C.M(System.Int32 c)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M(System.Int32 a)", "void E1.<>E__0.M(System.Int32 b)", "void C.M(System.Int32 c)"], + AssertEx.SequenceEqual(["void C.M(System.Int32 a)", "void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 b)", "void C.M(System.Int32 c)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } @@ -13604,7 +14404,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void E.<>E__0.M(System.Int32 b, System.Int32 c)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 b, System.Int32 c)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -13656,7 +14456,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void E.<>E__0.M(ref System.Int32 b, out System.Int32 c)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(ref System.Int32 b, out System.Int32 c)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -13691,8 +14491,8 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("System.Int32 E2.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["System.Int32 E1.<>E__0.M(System.Int32 i)", "System.Int32 E2.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("System.Int32 E2.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["System.Int32 E1.$76A32DFFBBF61DFEA0C27B13F12F6EFB.M(System.Int32 i)", "System.Int32 E2.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); source = """ System.Console.Write(new C().M(42)); @@ -13741,8 +14541,8 @@ public void M(int i) var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13773,8 +14573,8 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)", "void E.<>E__0.M(System.Int32 i)"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)", "void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", "void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", "void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13803,8 +14603,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M<>"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13833,8 +14633,8 @@ public void M(T t) var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E.<>E__0.M(System.Int32 t)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(T t)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 t)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(T t)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -13864,7 +14664,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); source = """ C.Method(); @@ -13910,7 +14710,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -14020,7 +14820,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.M1"); - Assert.Equal("void E.<>E__0.M1(S1 x, [System.Int32 y = 0])", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$2404CFB602D7DEE90BDDEF217EC37C58.M1(S1 x, [System.Int32 y = 0])", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14062,7 +14862,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.M1"); - Assert.Equal("void Color.M1(S1 x, [System.Int32 y = 0])", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void Color.M1(S1 x, [System.Int32 y = 0])", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14134,7 +14934,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().Member"); - Assert.Equal("void N.E2.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14201,7 +15001,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C<(string, string)>.Nested<(int, int)>().M"); - Assert.Equal("System.String E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$FD79C355D693194B747A629F6876929C.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14235,7 +15035,7 @@ unsafe static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C.Nested().M"); - Assert.Equal("System.String E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C781704B647A2CCC8FD47AE9790BA08B.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14313,7 +15113,7 @@ unsafe static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C[]>.Nested[]>().M"); - Assert.Equal("System.String E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$5F3142482E98DE8C6B0C70A682DD0496.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14340,7 +15140,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("System.String E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$74EBC78B2187AB07A25EEFC1322000B0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14368,7 +15168,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("System.String E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$5D7EC0FD2C9001515B0ADE0CEE121AB0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14395,7 +15195,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("System.String E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$414BE9969A3DFDFF167B842681736663.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -14457,8 +15257,8 @@ static class E1 var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E2.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -14542,11 +15342,11 @@ static class E2 Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); if (e1BeforeE2) { - Assert.Equal(["System.String E1.<>E__0.M()", "System.String E2.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "System.String E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } else { - Assert.Equal(["System.String E2.<>E__0.M()", "System.String E1.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "System.String E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } } @@ -14654,14 +15454,14 @@ public interface I { } var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "i.M"); - Assert.Equal("void I.M(out System.Object t)", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("void I.M(out System.Object t)", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess1).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void I.M(out System.String t)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void I.M(out System.String t)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); var memberAccess2 = GetSyntax(tree, "i.M2"); - Assert.Equal("void E2.<>E__0.M2(out System.Object t)", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$74EBC78B2187AB07A25EEFC1322000B0.M2(out System.Object t)", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess2).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void E2.<>E__0.M2(out System.String t)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E2.$74EBC78B2187AB07A25EEFC1322000B0.M2(out System.String t)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); } [Fact] @@ -14690,11 +15490,11 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "i.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$977919F21861BE18BA139544085CA0BD.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$977919F21861BE18BA139544085CA0BD.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); memberAccess = GetSyntax(tree, "i.P"); - Assert.Equal("System.Int32 E.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$977919F21861BE18BA139544085CA0BD.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); src = """ using System.Collections.Generic; @@ -14747,8 +15547,8 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "string.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -14774,8 +15574,8 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -15078,7 +15878,7 @@ public static void M() { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "I.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$B135BA58FDFC6D88E9886008265BE41B.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -15104,7 +15904,7 @@ public static void M() { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "I.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$B135BA58FDFC6D88E9886008265BE41B.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -15246,7 +16046,7 @@ public static void M() { } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Container.M"); - Assert.Equal("void N.E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N.E2.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); src = """ @@ -15296,7 +16096,7 @@ static class E2 tree = comp.SyntaxTrees.Single(); model = comp.GetSemanticModel(tree); memberAccess = GetSyntax(tree, "Container.M"); - Assert.Equal("void N.E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N.E2.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); src = """ @@ -15382,7 +16182,7 @@ public static class Extensions var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().P"); - Assert.Equal("System.Int32 Extensions.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -15409,7 +16209,7 @@ public static class Extensions var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().P"); - Assert.Equal("System.Int32 Extensions.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -15439,7 +16239,7 @@ public static class Extensions Assert.Null(model.GetSymbolInfo(invocation).Symbol); Assert.Equal([], model.GetSymbolInfo(invocation).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["System.Int32 Extensions.<>E__0.P { get; }"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }"], model.GetMemberGroup(invocation.Expression).ToTestDisplayStrings()); } [Fact] @@ -15462,7 +16262,7 @@ public static class Extensions var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().P"); - Assert.Equal("System.Action Extensions.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Action Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -15487,7 +16287,7 @@ public static class Extensions var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "object.M()"); - Assert.Equal("System.Int32 Extensions.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(invocation).CandidateSymbols.ToTestDisplayStrings()); } @@ -15514,8 +16314,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Theory, CombinatorialData] @@ -15587,7 +16387,7 @@ public static class Extensions var tree = comp.SyntaxTrees[0]; var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().P"); - Assert.Equal("System.Int32 Extensions.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -15618,8 +16418,8 @@ public static void M() { } Assert.Null(model.GetSymbolInfo(memberAccess[0]).Symbol); Assert.Null(model.GetSymbolInfo(memberAccess[1]).Symbol); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess[0]).ToTestDisplayStrings()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess[1]).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess[0]).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess[1]).ToTestDisplayStrings()); } [Fact] @@ -15644,8 +16444,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.StaticProperty").ToArray(); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); } [Fact] @@ -15671,10 +16471,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.StaticProperty"); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess).Type.ToTestDisplayString()); - Assert.Equal("System.Int64", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess).Type.ToTestDisplayString()); + AssertEx.Equal("System.Int64", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); } [Fact] @@ -15699,14 +16499,14 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.StaticProperty").ToArray(); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess[0]).Type.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess[0]).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess[0]).Type.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess[0]).ConvertedType.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess[1]).Type.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess[1]).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess[1]).Type.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess[1]).ConvertedType.ToTestDisplayString()); } [Fact] @@ -15802,10 +16602,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.StaticProperty"); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess).Type.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess).Type.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); } [Fact] @@ -15920,10 +16720,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess).Type.ToTestDisplayString()); - Assert.Equal("System.Int32", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess).Type.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); } [Fact] @@ -15947,8 +16747,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.StaticProperty").ToArray(); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); } [Fact] @@ -15972,7 +16772,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.StaticProperty"); - Assert.Equal("System.Int32 E.<>E__0.StaticProperty { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.StaticProperty { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -15996,7 +16796,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("(System.Int32, System.Int32) E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("(System.Int32, System.Int32) E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16021,7 +16821,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("(System.Int32, System.Int32) E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("(System.Int32, System.Int32) E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16044,8 +16844,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.M").ToArray(); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); } [Fact] @@ -16069,7 +16869,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16306,7 +17106,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16336,9 +17136,9 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E.<>E__0.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.OverloadResolutionFailure, model.GetSymbolInfo(memberAccess).CandidateReason); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -16367,7 +17167,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16390,7 +17190,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.String E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16414,7 +17214,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberBinding = GetSyntax(tree, ".M"); - Assert.Equal("System.String E.<>E__0.M { get; }", model.GetSymbolInfo(memberBinding).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberBinding).Symbol.ToTestDisplayString()); } [Fact] @@ -16439,7 +17239,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberBinding = GetSyntax(tree, ".M"); - Assert.Equal("System.String E.<>E__0.M()", model.GetSymbolInfo(memberBinding).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberBinding).Symbol.ToTestDisplayString()); } [Fact] @@ -16463,7 +17263,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; set; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; set; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16488,7 +17288,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16517,11 +17317,11 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.M").ToArray(); - Assert.Equal("C E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); - Assert.Equal("C E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); + AssertEx.Equal("C E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); + AssertEx.Equal("C E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); var binaryOp = GetSyntax(tree, "object.M + object.M"); - Assert.Equal("System.Int32 C.op_Addition(C c1, C c2)", model.GetSymbolInfo(binaryOp).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 C.op_Addition(C c1, C c2)", model.GetSymbolInfo(binaryOp).Symbol.ToTestDisplayString()); } [Fact] @@ -16550,8 +17350,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.M").ToArray(); - Assert.Equal("C E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); - Assert.Equal("C E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); + AssertEx.Equal("C E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess[0]).Symbol.ToTestDisplayString()); + AssertEx.Equal("C E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess[1]).Symbol.ToTestDisplayString()); var binaryOp = GetSyntax(tree, "object.M + object.M"); Assert.Null(model.GetSymbolInfo(binaryOp).Symbol); @@ -16579,10 +17379,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; set; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; set; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); var unaryOp = GetSyntax(tree, "object.M++"); - Assert.Equal("System.Int32 System.Int32.op_Increment(System.Int32 value)", model.GetSymbolInfo(unaryOp).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 System.Int32.op_Increment(System.Int32 value)", model.GetSymbolInfo(unaryOp).Symbol.ToTestDisplayString()); } [Fact] @@ -16607,10 +17407,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.Boolean E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Boolean E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); var unaryOp = GetSyntax(tree, "!object.M"); - Assert.Equal("System.Boolean System.Boolean.op_LogicalNot(System.Boolean value)", + AssertEx.Equal("System.Boolean System.Boolean.op_LogicalNot(System.Boolean value)", model.GetSymbolInfo(unaryOp).Symbol.ToTestDisplayString()); } @@ -16636,10 +17436,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.String E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntax(tree, "object.M2"); - Assert.Equal("System.String E.<>E__0.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -16663,10 +17463,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.String E.<>E__0.M { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntax(tree, "object.M2"); - Assert.Equal("System.String E.<>E__0.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -16696,7 +17496,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.String E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -16806,10 +17606,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.Object[] E.M", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Object[] E.M", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntax(tree, "object.M2"); - Assert.Equal("System.Object[] E.M2", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Object[] E.M2", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -16841,10 +17641,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntax(tree, "object.M2"); - Assert.Equal("System.Int32 E.<>E__0.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -16868,7 +17668,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); } [Fact] @@ -16904,10 +17704,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntax(tree, "object.M2"); - Assert.Equal("System.Int32 E.<>E__0.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -16952,10 +17752,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntax(tree, "object.M2"); - Assert.Equal("System.Int32 E.<>E__0.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M2 { get; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -16985,7 +17785,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.Exception E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Exception E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); } [Fact] @@ -17013,7 +17813,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.String E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); } [Fact] @@ -17041,7 +17841,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.M").First(); - Assert.Equal("System.String E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -17069,7 +17869,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.M").First(); - Assert.Equal("System.String E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -17097,7 +17897,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.M").First(); - Assert.Equal("System.String E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -17125,7 +17925,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.ToString").First(); - Assert.Equal("System.String E.<>E__0.ToString(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.ToString(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -17164,7 +17964,7 @@ public static class E2 var memberAccess = GetSyntax(tree, "o.Member"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); - Assert.Equal(["System.String E1.<>E__0.Member { get; }", "void E2.Member(this System.Object o)"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Member { get; }", "void E2.Member(this System.Object o)"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } [Fact] @@ -17192,7 +17992,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal("System.String E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); } [Fact] @@ -17268,7 +18068,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.f").First(); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.String E1.<>E__0.f { get; }", "void E2.<>E__0.f()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String E1.$C43E2675C7BBF9284AF22FB8A9BF0280.f { get; }", "void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.f()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } [Fact] @@ -17321,7 +18121,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().Member"); - Assert.Equal("void E.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -17409,11 +18209,11 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "object.f").First(); - Assert.Equal("System.String E.<>E__0.f { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.f { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); var defaultExpr = GetSyntax(tree, "default"); - Assert.Equal("System.String", model.GetTypeInfo(defaultExpr).Type.ToTestDisplayString()); - Assert.Equal("System.String", model.GetTypeInfo(defaultExpr).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("System.String", model.GetTypeInfo(defaultExpr).Type.ToTestDisplayString()); + AssertEx.Equal("System.String", model.GetTypeInfo(defaultExpr).ConvertedType.ToTestDisplayString()); } [Fact] @@ -17449,7 +18249,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s1.f"); - Assert.Equal("ref System.String E.<>E__0.f { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("ref System.String E.$34505F560D9EACF86A87F3ED1F85E448.f { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -17476,7 +18276,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.ToString"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.String System.Object.ToString()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String System.Object.ToString()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -17540,7 +18340,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("System.Action E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Action E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -17578,7 +18378,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("System.Action E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Action E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -17617,8 +18417,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void System.Object.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void System.Object.M(System.Int32 i)", "System.Action E.<>E__0.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void System.Object.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void System.Object.M(System.Int32 i)", "System.Action E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -17659,7 +18459,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void System.Object.M(System.Int32 i)", "System.Int32 E.<>E__0.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void System.Object.M(System.Int32 i)", "System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -17700,7 +18500,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void System.Object.M(System.Int32 i)", "System.Int32 E.<>E__0.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void System.Object.M(System.Int32 i)", "System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -17744,7 +18544,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void N.E1.<>E__0.M(System.Int32 i)", "System.Int32 E2.<>E__0.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void N.E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)", "System.Int32 E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -17788,7 +18588,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void N.E1.<>E__0.M(System.Int32 i)", "System.Int32 E2.<>E__0.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void N.E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)", "System.Int32 E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -17826,7 +18626,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("System.Int32 E.<>E__0.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -17865,8 +18665,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void System.Object.M(System.Int32 i)", "void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void System.Object.M(System.Int32 i)", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -17904,8 +18704,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -17989,10 +18789,10 @@ .maxstack 2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Null(model.GetTypeInfo(memberAccess).Type); - Assert.Equal("D", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("D", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); Assert.Equal(ConversionKind.MethodGroup, model.GetConversion(memberAccess).Kind); } @@ -18021,10 +18821,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Null(model.GetTypeInfo(memberAccess).Type); - Assert.Equal("D", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("D", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); Assert.Equal(ConversionKind.MethodGroup, model.GetConversion(memberAccess).Kind); } @@ -18053,10 +18853,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C().M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Null(model.GetTypeInfo(memberAccess).Type); - Assert.Equal("D", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("D", model.GetTypeInfo(memberAccess).ConvertedType.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); Assert.Equal(ConversionKind.MethodGroup, model.GetConversion(memberAccess).Kind); } @@ -18103,8 +18903,8 @@ .maxstack 2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new C(42).M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M()", "void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void C.M()", "void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); Assert.Equal(ConversionKind.MethodGroup, model.GetConversion(memberAccess).Kind); } @@ -18137,8 +18937,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "C.M").First(); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)", "void E.<>E__0.M(System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", "void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18169,8 +18969,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "new C().M").First(); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)", "void E.<>E__0.M(System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", "void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18207,8 +19007,8 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "C.M").First(); - Assert.Equal("void E1.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E1.<>E__0.M(System.Int32 i)", "void E2.<>E__0.M(System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", "void E2.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18245,8 +19045,8 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "new C().M").First(); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E.<>E__0.M(System.String s)"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void E.<>E__0.M(System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s)"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18277,8 +19077,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.Method"); - Assert.Equal("void E.<>E__0.Method(System.String t)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.Method(System.Int32 i)", "void E.<>E__0.Method(T t)", "void E.<>E__0.Method(T1 t1, T2 t2)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String t)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.Int32 i)", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(T t)", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(T1 t1, T2 t2)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18327,8 +19127,8 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "new C().M").First(); - Assert.Equal("void N.E1.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M(System.Char c)", "void E2.<>E__0.M(System.String s)", "void N.E1.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void N.E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void C.M(System.Char c)", "void E2.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s)", "void N.E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18374,8 +19174,8 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); - Assert.Equal("void E1.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E1.<>E__0.M(System.Int32 i)", "void N.E2.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E1.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)", "void N.E2.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18402,8 +19202,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18459,8 +19259,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("void E.<>E__0.M(System.Int32 u)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 u)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 u)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 u)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18486,8 +19286,8 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("void E.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18520,7 +19320,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E.<>E__0.M([System.Int32 i = 0])"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M([System.Int32 i = 0])"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); source = """ static class E @@ -18565,7 +19365,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal(["ref System.Int32 E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["ref System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18593,7 +19393,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal(["System.String E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18627,10 +19427,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal(["void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); var memberAccess2 = GetSyntax(tree, "object.M2"); - Assert.Equal(["void E.<>E__0.M2(System.Int64 l)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M2(System.Int64 l)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); } [Fact] @@ -18657,7 +19457,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -18772,7 +19572,7 @@ public static void M() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -19002,7 +19802,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var property = GetSyntax(tree, "C.Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { set; }", model.GetSymbolInfo(property).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$9794DAFCCB9E752B29BFD6350ADA77F2.Property { set; }", model.GetSymbolInfo(property).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(property)); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -19034,7 +19834,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var property = GetSyntax(tree, "C.Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { set; }", model.GetSymbolInfo(property).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$9794DAFCCB9E752B29BFD6350ADA77F2.Property { set; }", model.GetSymbolInfo(property).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(property)); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -19059,7 +19859,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, """(b ? "" : null).Property"""); - Assert.Equal("System.Int32 E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19247,7 +20047,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var assignment = GetSyntax(tree, "Property = 1"); - Assert.Equal("System.Int32 E.<>E__0.Property { init; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { init; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString()); } [Fact] @@ -19314,7 +20114,7 @@ public static void M1(T x) where T : unmanaged var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.M1"); - Assert.Equal("void E.<>E__0.M1(S1 x, [System.Int32 y = 0])", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$2404CFB602D7DEE90BDDEF217EC37C58.M1(S1 x, [System.Int32 y = 0])", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19356,7 +20156,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.P1"); - Assert.Equal("System.Int32 E1.<>E__0.P1 { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E1.$2404CFB602D7DEE90BDDEF217EC37C58.P1 { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19404,7 +20204,7 @@ public static void M1(T x) where T : unmanaged var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.M1"); - Assert.Equal("void Color.M1(S1 x, [System.Int32 y = 0])", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void Color.M1(S1 x, [System.Int32 y = 0])", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19449,7 +20249,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("System.Action E1.<>E__0.Member { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Action E1.$2404CFB602D7DEE90BDDEF217EC37C58.Member { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19486,7 +20286,7 @@ public static void Member(this Color c) { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void Color.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void Color.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19534,7 +20334,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E1.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19582,7 +20382,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E1.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19632,7 +20432,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E1.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19682,7 +20482,7 @@ public static void Member(int i) { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E1.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19736,7 +20536,7 @@ public static void Member() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void N.E1.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N.E1.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19790,7 +20590,7 @@ public void Member() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E2.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19844,7 +20644,7 @@ public void Member() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E2.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19892,7 +20692,7 @@ public static void Member() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E2.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19940,7 +20740,7 @@ public void Member() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E2.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -19980,7 +20780,7 @@ public static void Member() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("void E.<>E__0.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$2404CFB602D7DEE90BDDEF217EC37C58.Member()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -20020,7 +20820,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("System.Action E.<>E__0.Member { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Action E.$2404CFB602D7DEE90BDDEF217EC37C58.Member { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -20103,7 +20903,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.Member"); - Assert.Equal("System.Action E.<>E__0.Member { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Action E.$2404CFB602D7DEE90BDDEF217EC37C58.Member { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -20340,9 +21140,9 @@ public static void M() { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E.<>E__0.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.NotAVariable, model.GetSymbolInfo(memberAccess).CandidateReason); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -20394,7 +21194,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.Method"); - Assert.Equal(["void E.<>E__0.Method()"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Method()"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); var memberAccess2 = GetSyntax(tree, "object.Property"); Assert.Equal([], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access @@ -20650,7 +21450,7 @@ .locals init (string V_0) IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: '"1".M($""); ... ("2", $"");') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: '"1".M($"");') Expression: - IInvocationOperation ( void E.<>E__0.M(InterpolationHandler h)) (OperationKind.Invocation, Type: System.Void) (Syntax: '"1".M($"")') + IInvocationOperation ( void E.$34505F560D9EACF86A87F3ED1F85E448.M(InterpolationHandler h)) (OperationKind.Invocation, Type: System.Void) (Syntax: '"1".M($"")') Instance Receiver: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: "1") (Syntax: '"1"') Arguments(1): @@ -20813,7 +21613,7 @@ public void M(string s2, [System.Runtime.CompilerServices.InterpolatedStringHand IBlockOperation (2 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: '"1".M("2", ... "4", $"");') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: '"1".M("2", $"");') Expression: - IInvocationOperation ( void E.<>E__0.M(System.String s2, InterpolationHandler h)) (OperationKind.Invocation, Type: System.Void) (Syntax: '"1".M("2", $"")') + IInvocationOperation ( void E.$34505F560D9EACF86A87F3ED1F85E448.M(System.String s2, InterpolationHandler h)) (OperationKind.Invocation, Type: System.Void) (Syntax: '"1".M("2", $"")') Instance Receiver: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: "1") (Syntax: '"1"') Arguments(2): @@ -22237,7 +23037,7 @@ public void M() {} Assert.True(implM.Parameters[0].InterpolatedStringHandlerArgumentIndexes.IsEmpty); } - [Theory, WorkItem("https://github.com/dotnet/roslyn/issues/78137")] + [Theory(Skip = "IL should be fixed up"), WorkItem("https://github.com/dotnet/roslyn/issues/78137")] // PROTOTYPE: follow up [InlineData("01 00 01 69 00 00")] // "i" [InlineData("01 00 00 00 00")] // "" [InlineData("01 00 0b 6e 6f 6e 65 78 69 73 74 65 6e 74 00 00")] // "nonexistent" @@ -22631,7 +23431,8 @@ public static void StaticMethod([System.Runtime.CompilerServices.InterpolatedStr ); } - [Theory, WorkItem("https://github.com/dotnet/roslyn/issues/78137")] + [Theory(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust + [WorkItem("https://github.com/dotnet/roslyn/issues/78137")] [InlineData("01 00 01 69 00 00")] // "i" [InlineData("01 00 00 00 00")] // "" public void InterpolationHandler_StaticExtensionMethod_ReferencesExtensionParameter_FromMetadata(string argument) @@ -22748,7 +23549,7 @@ .param [1] ); } - [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78137")] + [Fact(Skip = "IL needs an adjustment"), WorkItem("https://github.com/dotnet/roslyn/issues/78137")] // PROTOTYPE: Follow up public void InterpolationHandler_InstanceExtensionMethod_ReferencesInstanceParameter_FromMetadata() { // Equivalent to: @@ -22939,7 +23740,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Enum.Zero.Property"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Int32 E.<>E__0.Property { set; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Int32 E.$5BDAAC939B0896D4F1349316F7C8CE0F.Property { set; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.NotAVariable, model.GetSymbolInfo(memberAccess).CandidateReason); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -22972,12 +23773,12 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "1.Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$E8CA98ACBCAEE63BB261A3FD4AF31675.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess1).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.None, model.GetSymbolInfo(memberAccess1).CandidateReason); var memberAccess2 = GetSyntax(tree, "2.Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$E8CA98ACBCAEE63BB261A3FD4AF31675.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess2).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.None, model.GetSymbolInfo(memberAccess2).CandidateReason); } @@ -23003,10 +23804,10 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntaxes(tree, "\"\".Property").First(); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntaxes(tree, "\"\".Property").Last(); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -23031,10 +23832,10 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntaxes(tree, """(b switch { true => "", _ => "" }).Property""").First(); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntaxes(tree, """(b switch { true => "", _ => "" }).Property""").Last(); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -23059,10 +23860,10 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntaxes(tree, """(b ? "" : null).Property""").First(); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); var memberAccess2 = GetSyntaxes(tree, """(b ? "" : null).Property""").Last(); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); } [Fact] @@ -23085,7 +23886,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "1.Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -23113,7 +23914,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "1.Property"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Int32 E.<>E__0.Property { set; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Int32 E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.Property { set; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.NotAVariable, model.GetSymbolInfo(memberAccess).CandidateReason); } @@ -23181,12 +23982,12 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntaxes(tree, "default.Property").First(); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess1).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.None, model.GetSymbolInfo(memberAccess1).CandidateReason); var memberAccess2 = GetSyntaxes(tree, "default.Property").Last(); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess2).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.None, model.GetSymbolInfo(memberAccess2).CandidateReason); } @@ -23211,7 +24012,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "(1, 2).Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$49AAF2D3C1326E88AED3848611C299DA.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -23239,7 +24040,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "(1, 2).Property"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Int32 E.<>E__0.Property { set; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Int32 E.$49AAF2D3C1326E88AED3848611C299DA.Property { set; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.NotAVariable, model.GetSymbolInfo(memberAccess).CandidateReason); } @@ -23314,12 +24115,12 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "(1, 1).Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$8477960720B8106C28CEADF5CDF3A674.Property { get; set; }", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess1).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.None, model.GetSymbolInfo(memberAccess1).CandidateReason); var memberAccess2 = GetSyntax(tree, "(2, 2).Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$8477960720B8106C28CEADF5CDF3A674.Property { get; set; }", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess2).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal(CandidateReason.None, model.GetSymbolInfo(memberAccess2).CandidateReason); } @@ -23356,7 +24157,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.String E1.<>E__0.M()", "System.String E2.<>E__0.M { get; }"], + AssertEx.SequenceEqual(["System.String E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "System.String E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Empty(model.GetMemberGroup(memberAccess)); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : public API, consider handling BoundBadExpression better } @@ -23395,7 +24196,7 @@ static class E2 Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : public API, consider handling BoundBadExpression better - Assert.Equal(["System.String E1.<>E__0.M()", "System.String E2.<>E__0.M { get; }"], + AssertEx.SequenceEqual(["System.String E1.$8048A6C8BE30A622530249B904B537EB.M()", "System.String E2.$8048A6C8BE30A622530249B904B537EB.M { get; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Empty(model.GetMemberGroup(memberAccess)); } @@ -23428,9 +24229,9 @@ static class E2 var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("System.String E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["System.String E1.<>E__0.M()", "System.String E2.<>E__0.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "System.String E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -23879,7 +24680,7 @@ public IEnumerator GetEnumerator() var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var loop = tree.GetRoot().DescendantNodes().OfType().Single(); - Assert.Equal("System.Collections.Generic.IEnumerator E.<>E__0.GetEnumerator()", + AssertEx.Equal("System.Collections.Generic.IEnumerator E.$8048A6C8BE30A622530249B904B537EB.GetEnumerator()", model.GetForEachStatementInfo(loop).GetEnumeratorMethod.ToTestDisplayString()); } @@ -23911,7 +24712,7 @@ public async IAsyncEnumerator GetAsyncEnumerator() var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var loop = tree.GetRoot().DescendantNodes().OfType().Single(); - Assert.Equal("System.Collections.Generic.IAsyncEnumerator E.<>E__0.GetAsyncEnumerator()", + AssertEx.Equal("System.Collections.Generic.IAsyncEnumerator E.$8048A6C8BE30A622530249B904B537EB.GetAsyncEnumerator()", model.GetForEachStatementInfo(loop).GetEnumeratorMethod.ToTestDisplayString()); } @@ -23939,7 +24740,7 @@ static class E var model = comp.GetSemanticModel(tree); var deconstruction = tree.GetRoot().DescendantNodes().OfType().First(); - Assert.Equal("void E.<>E__0.Deconstruct(out System.Int32 i, out System.Int32 j)", + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.Deconstruct(out System.Int32 i, out System.Int32 j)", model.GetDeconstructionInfo(deconstruction).Method.ToTestDisplayString()); } @@ -24073,7 +24874,7 @@ static class E var model = comp.GetSemanticModel(tree); var deconstruction = tree.GetRoot().DescendantNodes().OfType().First(); - Assert.Equal("void E.<>E__0.Deconstruct(out System.Int32 i, out System.Int32 j)", + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.Deconstruct(out System.Int32 i, out System.Int32 j)", model.GetDeconstructionInfo(deconstruction).Method.ToTestDisplayString()); } @@ -24108,7 +24909,7 @@ public static class E2 var model = comp.GetSemanticModel(tree); var deconstruction = tree.GetRoot().DescendantNodes().OfType().First(); - Assert.Equal("void E2.Deconstruct(this C c, out System.Int32 i, out System.Int32 j)", + AssertEx.Equal("void E2.Deconstruct(this C c, out System.Int32 i, out System.Int32 j)", model.GetDeconstructionInfo(deconstruction).Method.ToTestDisplayString()); } @@ -24259,7 +25060,7 @@ static class E var model = comp.GetSemanticModel(tree); var deconstruction = tree.GetRoot().DescendantNodes().OfType().First(); - Assert.Equal("void E.<>E__0.Deconstruct(out System.Int32 i, out System.Int32 j)", + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.Deconstruct(out System.Int32 i, out System.Int32 j)", model.GetDeconstructionInfo(deconstruction).Method.ToTestDisplayString()); } @@ -25909,7 +26710,7 @@ public int Property var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var nameColon = GetSyntax(tree, "Property:"); - Assert.Equal("System.Int32 E.<>E__0.Property { get; }", model.GetSymbolInfo(nameColon.Name).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$9794DAFCCB9E752B29BFD6350ADA77F2.Property { get; }", model.GetSymbolInfo(nameColon.Name).Symbol.ToTestDisplayString()); comp = CreateCompilation(src, references: [libRef], parseOptions: TestOptions.Regular13); comp.VerifyEmitDiagnostics( @@ -26353,7 +27154,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var expressionColon = GetSyntax(tree, "Property.Property2:"); - Assert.Equal("System.Int32 E2.<>E__0.Property2 { get; }", model.GetSymbolInfo(expressionColon.Expression).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E2.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.Property2 { get; }", model.GetSymbolInfo(expressionColon.Expression).Symbol.ToTestDisplayString()); } [Fact] @@ -26476,7 +27277,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var assignment = GetSyntax(tree, "Property = 42"); - Assert.Equal("System.Int32 E.<>E__0.Property { set; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$9794DAFCCB9E752B29BFD6350ADA77F2.Property { set; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString()); comp = CreateCompilation(src, references: [libRef], parseOptions: TestOptions.Regular13); comp.VerifyEmitDiagnostics( @@ -26630,7 +27431,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var assignment = GetSyntax(tree, "Property = 42"); - Assert.Equal("System.Int32 E.<>E__0.Property { set; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$3B24C9A1A6673CA92CA71905DDEE0A6C.Property { set; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString()); comp = CreateCompilation(src, references: [libRef], parseOptions: TestOptions.Regular13); comp.VerifyEmitDiagnostics( @@ -26681,7 +27482,7 @@ static class E Initializer: IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ 42 }') Initializers(1): - IInvocationOperation ( void E.<>E__0.Add(System.Int32 i)) (OperationKind.Invocation, Type: System.Void, IsImplicit) (Syntax: '42') + IInvocationOperation ( void E.$9794DAFCCB9E752B29BFD6350ADA77F2.Add(System.Int32 i)) (OperationKind.Invocation, Type: System.Void, IsImplicit) (Syntax: '42') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'C') Arguments(1): @@ -26734,7 +27535,7 @@ static class E Initializer: IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ 42 }') Initializers(1): - IInvocationOperation ( void E.<>E__0.Add(System.Int32 i)) (OperationKind.Invocation, Type: System.Void, IsImplicit) (Syntax: '42') + IInvocationOperation ( void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Add(System.Int32 i)) (OperationKind.Invocation, Type: System.Void, IsImplicit) (Syntax: '42') Instance Receiver: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'C') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -26797,7 +27598,7 @@ static class E Initializer: IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ 42 }') Initializers(1): - IInvocationOperation ( void E.<>E__0.Add(System.Int32 i)) (OperationKind.Invocation, Type: System.Void, IsImplicit) (Syntax: '42') + IInvocationOperation ( void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Add(System.Int32 i)) (OperationKind.Invocation, Type: System.Void, IsImplicit) (Syntax: '42') Instance Receiver: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'C') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -26830,7 +27631,7 @@ static class E Arguments(0) Initializer: null - IInvocationOperation ( void E.<>E__0.Add(System.Int32 i)) (OperationKind.Invocation, Type: System.Void, IsImplicit) (Syntax: '42') + IInvocationOperation ( void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Add(System.Int32 i)) (OperationKind.Invocation, Type: System.Void, IsImplicit) (Syntax: '42') Instance Receiver: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'C') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) @@ -27031,7 +27832,7 @@ static class E IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= from x in ... () select x') ITranslatedQueryOperation (OperationKind.TranslatedQuery, Type: System.String) (Syntax: 'from x in n ... () select x') Expression: - IInvocationOperation ( System.String E.<>E__0.Select(System.Func selector)) (OperationKind.Invocation, Type: System.String, IsImplicit) (Syntax: 'select x') + IInvocationOperation ( System.String E.$9794DAFCCB9E752B29BFD6350ADA77F2.Select(System.Func selector)) (OperationKind.Invocation, Type: System.String, IsImplicit) (Syntax: 'select x') Instance Receiver: IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C()') Arguments(0) @@ -27108,7 +27909,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, """object.Method("")"""); - Assert.Equal("void E.<>E__0.Method(System.String t)", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.Method(System.String t)", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Empty(model.GetMemberGroup(invocation)); // Tracked by https://github.com/dotnet/roslyn/issues/76130 : need to fix the semantic model } @@ -27144,7 +27945,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.P"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Int32 E1.<>E__0.P { get; }", "void E2.<>E__0.P()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Int32 E1.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }", "void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.P()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } [Fact] @@ -27179,7 +27980,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.P"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E2.<>E__0.P()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.P()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } [Fact] @@ -27207,8 +28008,8 @@ public static void M() { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E1.<>E__0.M()", "void E1.<>E__0.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void E1.<>E__0.M()", "void E1.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -27258,7 +28059,7 @@ .locals init (delegate* V_0, //ptr var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); - Assert.Equal("void E.<>E__0.M(System.String s, System.Object o)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s, System.Object o)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -27332,7 +28133,7 @@ public static void M(object o, string s) {} var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E.<>E__0.M(System.String s, System.Object o)", "void E.<>E__0.M(System.Object o, System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.String s, System.Object o)", "void E.$9794DAFCCB9E752B29BFD6350ADA77F2.M(System.Object o, System.String s)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -27427,7 +28228,7 @@ static class E2 var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.String E1.<>E__0.M()", "System.Func E2.<>E__0.M { get; }"], + AssertEx.SequenceEqual(["System.String E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "System.Func E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Empty(model.GetMemberGroup(memberAccess)); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : public API, consider handling BoundBadExpression better @@ -27459,7 +28260,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.Method"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.String E.<>E__0.Method()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String E.$9794DAFCCB9E752B29BFD6350ADA77F2.Method()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -27516,7 +28317,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.Property"); - Assert.Equal("System.String E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$9794DAFCCB9E752B29BFD6350ADA77F2.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -27545,7 +28346,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.Method"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.String E.<>E__0.Method()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.String E.$9794DAFCCB9E752B29BFD6350ADA77F2.Method()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -27574,7 +28375,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "c.Property"); - Assert.Equal("System.String E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$9794DAFCCB9E752B29BFD6350ADA77F2.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -27625,7 +28426,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "i.Property"); - Assert.Equal("System.String E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -27654,7 +28455,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.Property"); - Assert.Equal("System.String E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$74EBC78B2187AB07A25EEFC1322000B0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -27683,7 +28484,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.Property"); - Assert.Equal("System.String E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$74EBC78B2187AB07A25EEFC1322000B0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -27711,7 +28512,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "I.Property"); - Assert.Equal("System.String E.<>E__0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.String E.$74EBC78B2187AB07A25EEFC1322000B0.Property { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -27768,8 +28569,8 @@ public static void M() { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E1.<>E__0.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void E1.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$66F77D1E46F965A5B22D4932892FA78B.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$66F77D1E46F965A5B22D4932892FA78B.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -27947,7 +28748,115 @@ public static partial class C } """; var comp = CreateCompilation(source); - CompileAndVerify(comp, expectedOutput: "ran ran2").VerifyDiagnostics(); + CompileAndVerify(comp, expectedOutput: "ran ran2", symbolValidator: (m) => + { + var container = m.GlobalNamespace.GetTypeMember("C"); + var extension = container.GetTypeMembers().Single(); + + AssertEx.Equal("System.Object value", extension.ExtensionParameter.ToTestDisplayString()); + AssertEx.Equal("$C43E2675C7BBF9284AF22FB8A9BF0280", extension.MetadataName); + + var methods = extension.GetMembers(); + AssertEx.Equal("C.extension(object).M()", methods[0].ToDisplayString()); + AssertEx.Equal(@"System.Runtime.CompilerServices.ExtensionMarkerNameAttribute(""$C43E2675C7BBF9284AF22FB8A9BF0280"")", methods[0].GetAttributes().Single().ToString()); + + AssertEx.Equal("C.extension(object).M2()", methods[1].ToDisplayString()); + AssertEx.Equal(@"System.Runtime.CompilerServices.ExtensionMarkerNameAttribute(""$C43E2675C7BBF9284AF22FB8A9BF0280"")", methods[1].GetAttributes().Single().ToString()); + }). + VerifyDiagnostics(). + VerifyTypeIL("C", """ +.class public auto ansi abstract sealed beforefieldinit C + extends [mscorlib]System.Object +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2096 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::'$' + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 + // Methods + .method public hidebysig static + void M () cil managed + { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 + ) + // Method begins at RVA 0x2093 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + .method public hidebysig static + void M2 () cil managed + { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 43 34 33 45 + 32 36 37 35 43 37 42 42 46 39 32 38 34 41 46 32 + 32 46 42 38 41 39 42 46 30 32 38 30 00 00 + ) + // Method begins at RVA 0x2093 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M2 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 + // Methods + .method public hidebysig static + void M () cil managed + { + // Method begins at RVA 0x207b + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr "ran " + IL_0005: call void [mscorlib]System.Console::Write(string) + IL_000a: ret + } // end of method C::M + .method public hidebysig static + void M2 () cil managed + { + // Method begins at RVA 0x2087 + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr "ran2" + IL_0005: call void [mscorlib]System.Console::Write(string) + IL_000a: ret + } // end of method C::M2 +} // end of class C +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); + + var source2 = """ +object.M(); +object.M2(); +"""; + var comp2 = CreateCompilation(source2, references: [comp.EmitToImageReference()]); + CompileAndVerify(comp2, expectedOutput: "ran ran2"); } [Fact] @@ -28091,7 +29000,7 @@ static class E var symbol = model.GetDeclaredSymbol(extension); var format = new SymbolDisplayFormat(genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters | SymbolDisplayGenericsOptions.IncludeTypeConstraints); - Assert.Equal("extension(T) where T : struct", symbol.ToDisplayString(format)); + AssertEx.Equal("extension(T) where T : struct", symbol.ToDisplayString(format)); } [Fact] @@ -28114,7 +29023,7 @@ static class E var symbol = model.GetDeclaredSymbol(extension); var format = new SymbolDisplayFormat(parameterOptions: SymbolDisplayParameterOptions.IncludeType | SymbolDisplayParameterOptions.IncludeModifiers); - Assert.Equal("extension(ref readonly Int32)", symbol.ToDisplayString(format)); + AssertEx.Equal("extension(ref readonly Int32)", symbol.ToDisplayString(format)); } [Fact] @@ -31291,9 +32200,6 @@ void M1(int a) {} var comp = CreateCompilation(src); comp.VerifyDiagnostics( - // (17,14): error CS0111: Type 'Extensions' already defines a member called 'M1' with the same parameter types - // void M1(U y) {} - Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "M1").WithArguments("M1", "Extensions").WithLocation(17, 14), // (19,21): error CS0111: Type 'Extensions' already defines a member called 'M2' with the same parameter types // static void M2(U x) {} Diagnostic(ErrorCode.ERR_MemberAlreadyExists, "M2").WithArguments("M2", "Extensions").WithLocation(19, 21) @@ -31731,7 +32637,7 @@ public static void M(this object o) { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal(["void E1.<>E__0.M()", "void System.Object.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void System.Object.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -31758,7 +32664,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void E1.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -31785,7 +32691,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "new object().M"); - Assert.Equal("void System.Object.M(System.String s)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void System.Object.M(System.String s)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -31812,7 +32718,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -31839,7 +32745,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void System.Int32.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void System.Int32.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -31886,7 +32792,7 @@ static class E1 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void E1.<>E__0.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -31916,7 +32822,7 @@ public static class E1 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void E1.<>E__1.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); var libComp = CreateCompilation([libSrc, OverloadResolutionPriorityAttributeDefinition]); var comp2 = CreateCompilation(source, references: [libComp.EmitToImageReference()]); @@ -31956,7 +32862,7 @@ static class E1 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void System.Int32.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void System.Int32.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -31981,7 +32887,7 @@ static class E1 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void E1.<>E__0.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32012,7 +32918,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void E1.<>E__0.M(System.Int32 j)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M(System.Int32 j)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32040,7 +32946,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void System.Int32.M(System.Int32 j)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void System.Int32.M(System.Int32 j)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32069,7 +32975,7 @@ static class E1 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32148,7 +33054,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.M"); - Assert.Equal("void E.<>E__1.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M(System.Int64 l)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); var libComp = CreateCompilation([libSrc, OverloadResolutionPriorityAttributeDefinition]); var comp2 = CreateCompilation(source, references: [libComp.EmitToImageReference()]); @@ -32191,7 +33097,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.P"); - Assert.Equal("System.Int32 E.<>E__1.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32222,7 +33128,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.P"); - Assert.Equal("System.Int32 E.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); var libComp = CreateCompilation([libSrc, OverloadResolutionPriorityAttributeDefinition]); var comp2 = CreateCompilation([source], references: [libComp.EmitToImageReference()]); @@ -32258,7 +33164,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.P"); - Assert.Equal("System.Int32 E2.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E2.$34505F560D9EACF86A87F3ED1F85E448.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32316,7 +33222,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "E.get_P"); - Assert.Equal("System.Int32 E.get_P(System.Object o)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.get_P(System.Object o)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); var libComp = CreateCompilation([libSrc, OverloadResolutionPriorityAttributeDefinition]); var comp2 = CreateCompilation([source], references: [libComp.EmitToImageReference()]); @@ -32326,10 +33232,10 @@ static void verify(ModuleSymbol m) { var implementations = m.ContainingAssembly.GetTypeByMetadataName("E").GetMembers().OfType().ToArray(); - Assert.Equal("System.Int32 E.get_P(System.Object o)", implementations[0].ToTestDisplayString()); - Assert.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(1)", implementations[0].GetAttributes().Single().ToString()); + AssertEx.Equal("System.Int32 E.get_P(System.Object o)", implementations[0].ToTestDisplayString()); + AssertEx.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(1)", implementations[0].GetAttributes().Single().ToString()); - Assert.Equal("System.Int64 E.get_P(System.String s)", implementations[1].ToTestDisplayString()); + AssertEx.Equal("System.Int64 E.get_P(System.String s)", implementations[1].ToTestDisplayString()); Assert.Empty(implementations[1].GetAttributes()); } } @@ -32362,7 +33268,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "E.set_P"); - Assert.Equal("void E.set_P(System.Object o, System.Int32 value)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.set_P(System.Object o, System.Int32 value)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); var libComp = CreateCompilation([libSrc, OverloadResolutionPriorityAttributeDefinition]); var comp2 = CreateCompilation([source], references: [libComp.EmitToImageReference()]); @@ -32372,11 +33278,11 @@ static void verify(ModuleSymbol m) { var implementations = m.ContainingAssembly.GetTypeByMetadataName("E").GetMembers().OfType().ToArray(); - Assert.Equal("void E.set_P(System.Object o, System.Int32 value)", implementations[0].ToTestDisplayString()); - Assert.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(1)", implementations[0].GetAttributes().Single().ToString()); + AssertEx.Equal("void E.set_P(System.Object o, System.Int32 value)", implementations[0].ToTestDisplayString()); + AssertEx.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(1)", implementations[0].GetAttributes().Single().ToString()); - Assert.Equal("void E.set_P(System.String s, System.Int32 value)", implementations[1].ToTestDisplayString()); - Assert.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(0)", implementations[1].GetAttributes().Single().ToString()); + AssertEx.Equal("void E.set_P(System.String s, System.Int32 value)", implementations[1].ToTestDisplayString()); + AssertEx.Equal("System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute(0)", implementations[1].GetAttributes().Single().ToString()); } } @@ -32497,7 +33403,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void N.E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32537,7 +33443,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32573,7 +33479,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.M"); - Assert.Equal("void N.E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void N.E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32622,7 +33528,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$2404CFB602D7DEE90BDDEF217EC37C58.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal(SymbolKind.NamedType, model.GetSymbolInfo(memberAccess.Expression).Symbol.Kind); } @@ -32671,7 +33577,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$2404CFB602D7DEE90BDDEF217EC37C58.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal(SymbolKind.Parameter, model.GetSymbolInfo(memberAccess.Expression).Symbol.Kind); } @@ -32760,7 +33666,7 @@ class C2 : C1 { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "i.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$04E653405309F31558CF576D60A83155.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32793,7 +33699,7 @@ class C2 : C1 { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "I.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$04E653405309F31558CF576D60A83155.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32823,7 +33729,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32854,7 +33760,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.M"); - Assert.Equal("void E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32884,7 +33790,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32914,7 +33820,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.M"); - Assert.Equal("void E1.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -32975,7 +33881,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.M"); - Assert.Equal("void E2.<>E__0.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 i)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -33313,8 +34219,8 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var literal = GetSyntax(tree, "42"); - Assert.Equal("System.Int32", model.GetTypeInfo(literal).Type.ToTestDisplayString()); - Assert.Equal("System.Object", model.GetTypeInfo(literal).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(literal).Type.ToTestDisplayString()); + AssertEx.Equal("System.Object", model.GetTypeInfo(literal).ConvertedType.ToTestDisplayString()); } [Fact] @@ -33347,8 +34253,8 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var color = GetSyntax(tree, "Color.M").Expression; - Assert.Equal("Color", model.GetTypeInfo(color).Type.ToTestDisplayString()); - Assert.Equal("Base", model.GetTypeInfo(color).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("Color", model.GetTypeInfo(color).Type.ToTestDisplayString()); + AssertEx.Equal("Base", model.GetTypeInfo(color).ConvertedType.ToTestDisplayString()); } [Fact] @@ -33371,8 +34277,8 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var literal = GetSyntax(tree, "42"); - Assert.Equal("System.Int32", model.GetTypeInfo(literal).Type.ToTestDisplayString()); - Assert.Equal("System.Object", model.GetTypeInfo(literal).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("System.Int32", model.GetTypeInfo(literal).Type.ToTestDisplayString()); + AssertEx.Equal("System.Object", model.GetTypeInfo(literal).ConvertedType.ToTestDisplayString()); } [Fact] @@ -33425,8 +34331,8 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var color = GetSyntax(tree, "Color.P").Expression; - Assert.Equal("Color", model.GetTypeInfo(color).Type.ToTestDisplayString()); - Assert.Equal("Base", model.GetTypeInfo(color).ConvertedType.ToTestDisplayString()); + AssertEx.Equal("Color", model.GetTypeInfo(color).Type.ToTestDisplayString()); + AssertEx.Equal("Base", model.GetTypeInfo(color).ConvertedType.ToTestDisplayString()); } [Fact] @@ -33615,7 +34521,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.P"); - Assert.Equal("System.Int32 E1.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -33645,7 +34551,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.P"); - Assert.Equal("System.Int32 E2.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E2.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -33686,7 +34592,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.P"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Int32 E1.<>E__0.P { get; }", "System.Int32 E2.<>E__0.P { get; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Int32 E1.$2404CFB602D7DEE90BDDEF217EC37C58.P { get; }", "System.Int32 E2.$2404CFB602D7DEE90BDDEF217EC37C58.P { get; }"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } [Fact] @@ -33717,8 +34623,8 @@ static class E1 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.P"); - Assert.Equal("System.Int32 E1.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal("Color Color", model.GetSymbolInfo(memberAccess.Expression).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E1.$2404CFB602D7DEE90BDDEF217EC37C58.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("Color Color", model.GetSymbolInfo(memberAccess.Expression).Symbol.ToTestDisplayString()); Assert.Equal(SymbolKind.Parameter, model.GetSymbolInfo(memberAccess.Expression).Symbol.Kind); } @@ -33750,8 +34656,8 @@ static class E1 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "Color.P"); - Assert.Equal("System.Int32 E1.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal("Color", model.GetSymbolInfo(memberAccess.Expression).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E1.$2404CFB602D7DEE90BDDEF217EC37C58.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("Color", model.GetSymbolInfo(memberAccess.Expression).Symbol.ToTestDisplayString()); Assert.Equal(SymbolKind.NamedType, model.GetSymbolInfo(memberAccess.Expression).Symbol.Kind); } @@ -33998,7 +34904,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -34024,7 +34930,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.M"); - Assert.Equal("void E.<>E__0.M(System.String? t2)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M(System.String? t2)", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); } [Fact] @@ -34111,7 +35017,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.P"); - Assert.Equal("System.Int32 E.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$34505F560D9EACF86A87F3ED1F85E448.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -34142,7 +35048,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "string.P"); - Assert.Equal("System.Int32 E1.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E1.$34505F560D9EACF86A87F3ED1F85E448.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -34173,7 +35079,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "i.P"); - Assert.Equal("E.extension(I).P", model.GetSymbolInfo(memberAccess).Symbol.ToDisplayString()); + AssertEx.Equal("E.extension(I).P", model.GetSymbolInfo(memberAccess).Symbol.ToDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -34204,7 +35110,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "i.P"); - Assert.Equal("E.extension(I).P", model.GetSymbolInfo(memberAccess).Symbol.ToDisplayString()); + AssertEx.Equal("E.extension(I).P", model.GetSymbolInfo(memberAccess).Symbol.ToDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -34235,7 +35141,7 @@ static class E2 var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "42.P"); - Assert.Equal("System.Int32 E1.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -34267,7 +35173,7 @@ static class E2 var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.P"); - Assert.Equal("System.Int32 E1.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -34299,7 +35205,7 @@ static class E2 var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "int.P"); - Assert.Equal("System.Int32 E1.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E1.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } @@ -34332,7 +35238,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Action E.<>E__0.M { get; }", "System.String E.<>E__1.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Action E.$34505F560D9EACF86A87F3ED1F85E448.M { get; }", "System.String E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } [Fact] @@ -34363,7 +35269,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "string.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Action E.<>E__0.M { get; }", "System.String E.<>E__1.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Action E.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", "System.String E.$34505F560D9EACF86A87F3ED1F85E448.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } [Fact] @@ -34397,7 +35303,7 @@ static class E var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "i.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Action E.<>E__0.M { get; }", "System.String E.<>E__1.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Action E.$B5F2BFAFBDD4469288FE06B785D143CD.M { get; }", "System.String E.$2B406085AC5EBECC11B16BCD2A24DF4E.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); } [Fact] @@ -34435,7 +35341,7 @@ static class E2 var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "i.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["System.Action E1.<>E__0.M { get; }", "System.String E2.<>E__0.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Action E1.$2B406085AC5EBECC11B16BCD2A24DF4E.M { get; }", "System.String E2.$B5F2BFAFBDD4469288FE06B785D143CD.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Empty(model.GetMemberGroup(memberAccess)); } @@ -34573,8 +35479,8 @@ static class E var memberAccess = GetSyntax(tree, "d.P"); var dynamicType = model.GetTypeInfo(memberAccess.Expression).Type; Assert.True(dynamicType.IsDynamic()); - AssertEqualAndNoDuplicates(["System.Int32 E.<>E__0.P { get; }"], model.LookupSymbols(position: 0, dynamicType, name: "P", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["System.Int32 E.<>E__0.P { get; }"], model.LookupSymbols(position: 0, dynamicType, name: null, includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }"], model.LookupSymbols(position: 0, dynamicType, name: "P", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }"], model.LookupSymbols(position: 0, dynamicType, name: null, includeReducedExtensionMethods: true).ToTestDisplayStrings()); } [Fact] @@ -34896,7 +35802,7 @@ static class E Diagnostic(ErrorCode.ERR_ExtensionDisallowsMember, "Const").WithLocation(7, 26)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void ParamsReceiver_01() { // extension(params int[] i) @@ -34967,7 +35873,7 @@ .param [1] Diagnostic(ErrorCode.ERR_BadArgCount, "M").WithArguments("M", "1").WithLocation(2, 3)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void ParamsReceiver_02() { // extension(params int[] i) @@ -35060,11 +35966,11 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "s.M()"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetMemberGroup(invocation).ToTestDisplayStrings()); var memberAccess = GetSyntax(tree, "s.M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -35149,7 +36055,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.M"); - Assert.Equal(["void E.<>E__0.M()", "void E.<>E__1.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M()", "void E.$34505F560D9EACF86A87F3ED1F85E448.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -35176,7 +36082,7 @@ public void M() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "s.M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -35203,7 +36109,7 @@ public static void M() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$373395272A45479DE48E8BB1CCB2C42B.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -35226,10 +36132,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "string.M(42)"); - Assert.Equal("void E.<>E__0.M(System.Int64 u)", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int64 u)", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); var memberAccess = GetSyntax(tree, "string.M"); - Assert.Equal(["void E.<>E__0.M(System.Int64 u)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int64 u)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -35328,7 +36234,7 @@ static class E var symbol = model.GetDeclaredSymbol(extensionParameter); Assert.Equal(SymbolKind.Parameter, symbol.Kind); - Assert.Equal("System.Int32 i", symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 i", symbol.ToTestDisplayString()); } readonly string[] _objectMembers = [ @@ -35362,17 +36268,17 @@ public static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "object.M()"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); var property = GetSyntax(tree, "object.Property"); - Assert.Equal("System.Int32 E.<>E__0.Property { get; }", model.GetSymbolInfo(property).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; }", model.GetSymbolInfo(property).Symbol.ToTestDisplayString()); var e = ((Compilation)comp).GlobalNamespace.GetTypeMember("E"); AssertEqualAndNoDuplicates(["void E.M()"], model.LookupSymbols(position: 0, e, name: "M").ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.M()", "void E.<>E__0.M()"], model.LookupSymbols(position: 0, e, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["void E.M()", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.LookupSymbols(position: 0, e, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); AssertEqualAndNoDuplicates([], model.LookupSymbols(position: 0, e, name: "Property").ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["System.Int32 E.<>E__0.Property { get; }"], model.LookupSymbols(position: 0, e, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; }"], model.LookupSymbols(position: 0, e, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); AssertEqualAndNoDuplicates(["System.Int32 E.get_Property()"], model.LookupSymbols(position: 0, e, name: "get_Property").ToTestDisplayStrings()); @@ -35381,12 +36287,12 @@ public static class E var o = ((Compilation)comp).GetSpecialType(SpecialType.System_Object); AssertEqualAndNoDuplicates([], model.LookupSymbols(position: 0, o, name: "M").ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.<>E__0.M()"], model.LookupSymbols(position: 0, o, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.LookupSymbols(position: 0, o, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); AssertEqualAndNoDuplicates([], model.LookupSymbols(position: 0, o, name: "Property").ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["System.Int32 E.<>E__0.Property { get; }"], model.LookupSymbols(position: 0, o, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; }"], model.LookupSymbols(position: 0, o, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.<>E__0.M()", "System.Int32 E.<>E__0.Property { get; }", .. _objectMembers], + AssertEqualAndNoDuplicates(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; }", .. _objectMembers], model.LookupSymbols(position: 0, o, name: null, includeReducedExtensionMethods: true).ToTestDisplayStrings()); Assert.Equal([ @@ -35461,20 +36367,20 @@ public static class E var o = ((Compilation)comp).GetSpecialType(SpecialType.System_Object); AssertEqualAndNoDuplicates([], model.LookupSymbols(position: 0, o, name: "M").ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.<>E__0.M()"], model.LookupSymbols(position: 0, o, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["void E.$8048A6C8BE30A622530249B904B537EB.M()"], model.LookupSymbols(position: 0, o, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); AssertEqualAndNoDuplicates([], model.LookupSymbols(position: 0, o, name: "Property").ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["System.Int32 E.<>E__0.Property { get; }"], model.LookupSymbols(position: 0, o, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["System.Int32 E.$8048A6C8BE30A622530249B904B537EB.Property { get; }"], model.LookupSymbols(position: 0, o, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.<>E__0.M()", "System.Int32 E.<>E__0.Property { get; }", .. _objectMembers], + AssertEqualAndNoDuplicates(["void E.$8048A6C8BE30A622530249B904B537EB.M()", "System.Int32 E.$8048A6C8BE30A622530249B904B537EB.Property { get; }", .. _objectMembers], model.LookupSymbols(position: 0, o, name: null, includeReducedExtensionMethods: true).ToTestDisplayStrings()); var s = ((Compilation)comp).GetSpecialType(SpecialType.System_String); AssertEqualAndNoDuplicates([], model.LookupSymbols(position: 0, s, name: "M").ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.<>E__0.M()"], model.LookupSymbols(position: 0, s, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["void E.$8048A6C8BE30A622530249B904B537EB.M()"], model.LookupSymbols(position: 0, s, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); AssertEqualAndNoDuplicates([], model.LookupSymbols(position: 0, s, name: "Property").ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["System.Int32 E.<>E__0.Property { get; }"], model.LookupSymbols(position: 0, s, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["System.Int32 E.$8048A6C8BE30A622530249B904B537EB.Property { get; }"], model.LookupSymbols(position: 0, s, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); } [Fact] @@ -35499,7 +36405,7 @@ public static class E var model = comp.GetSemanticModel(tree); var s = ((Compilation)comp).GetSpecialType(SpecialType.System_String); - AssertEqualAndNoDuplicates(["void E.<>E__0.M(U u)"], model.LookupSymbols(position: 0, s, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["void E.$8048A6C8BE30A622530249B904B537EB.M(U u)"], model.LookupSymbols(position: 0, s, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); } [Fact] @@ -35531,17 +36437,17 @@ public static class E2 var model = comp.GetSemanticModel(tree); var o = ((Compilation)comp).GetSpecialType(SpecialType.System_Object); - AssertEqualAndNoDuplicates(["void E1.<>E__0.M()", "void E2.<>E__0.M()"], + AssertEqualAndNoDuplicates(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.LookupSymbols(position: 0, o, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["System.Int32 E1.<>E__0.Property { get; }", "System.Int32 E2.<>E__0.Property { get; }"], + AssertEqualAndNoDuplicates(["System.Int32 E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; }", "System.Int32 E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; }"], model.LookupSymbols(position: 0, o, name: "Property", includeReducedExtensionMethods: true).ToTestDisplayStrings()); AssertEqualAndNoDuplicates([ - "void E1.<>E__0.M()", - "System.Int32 E1.<>E__0.Property { get; }", - "void E2.<>E__0.M()", - "System.Int32 E2.<>E__0.Property { get; }", + "void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", + "System.Int32 E1.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; }", + "void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", + "System.Int32 E2.$C43E2675C7BBF9284AF22FB8A9BF0280.Property { get; }", .. _objectMembers], model.LookupSymbols(position: 0, o, name: null, includeReducedExtensionMethods: true).ToTestDisplayStrings()); } @@ -35572,10 +36478,10 @@ public static class E2 var model = comp.GetSemanticModel(tree); var o = ((Compilation)comp).GetSpecialType(SpecialType.System_Object); - AssertEqualAndNoDuplicates(["void E1.<>E__0.MP()", "System.Int32 E2.<>E__0.MP { get; }"], + AssertEqualAndNoDuplicates(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.MP()", "System.Int32 E2.$C43E2675C7BBF9284AF22FB8A9BF0280.MP { get; }"], model.LookupSymbols(position: 0, o, name: "MP", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E1.<>E__0.MP()", "System.Int32 E2.<>E__0.MP { get; }", .. _objectMembers], + AssertEqualAndNoDuplicates(["void E1.$C43E2675C7BBF9284AF22FB8A9BF0280.MP()", "System.Int32 E2.$C43E2675C7BBF9284AF22FB8A9BF0280.MP { get; }", .. _objectMembers], model.LookupSymbols(position: 0, o, name: null, includeReducedExtensionMethods: true).ToTestDisplayStrings()); } @@ -35603,10 +36509,10 @@ public static void M(this object o, int i) { } var model = comp.GetSemanticModel(tree); var o = ((Compilation)comp).GetSpecialType(SpecialType.System_Object); - AssertEqualAndNoDuplicates(["void E.<>E__0.M()", "void E.<>E__0.M(System.String s)", "void System.Object.M(System.Int32 i)"], + AssertEqualAndNoDuplicates(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.String s)", "void System.Object.M(System.Int32 i)"], model.LookupSymbols(position: 0, o, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.<>E__0.M()", "void E.<>E__0.M(System.String s)", "void System.Object.M(System.Int32 i)", .. _objectMembers], + AssertEqualAndNoDuplicates(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.String s)", "void System.Object.M(System.Int32 i)", .. _objectMembers], model.LookupSymbols(position: 0, o, name: null, includeReducedExtensionMethods: true).ToTestDisplayStrings()); } @@ -35734,10 +36640,10 @@ public static void M2(this object o, U u) where U : class { } var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "object.M"); - Assert.Equal(["void E.<>E__0.M(U u)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(U u)"], model.GetMemberGroup(memberAccess1).ToTestDisplayStrings()); var memberAccess2 = GetSyntax(tree, "new object().M2"); - Assert.Equal(["void System.Object.M2(U u)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void System.Object.M2(U u)"], model.GetMemberGroup(memberAccess2).ToTestDisplayStrings()); } [Fact] @@ -35834,7 +36740,7 @@ public static void M(int i) { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal(["void E.<>E__0.M()", "void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -35889,7 +36795,7 @@ public static void M() { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal(["System.Int32 E1.<>E__0.M { get; }", "void E2.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["System.Int32 E1.$C43E2675C7BBF9284AF22FB8A9BF0280.M { get; }", "void E2.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -35919,11 +36825,11 @@ public static void M() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "string.M"); - Assert.Equal("void E2.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["System.Int32 E1.<>E__0.M { get; }", "void E2.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E2.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["System.Int32 E1.$8048A6C8BE30A622530249B904B537EB.M { get; }", "void E2.$8048A6C8BE30A622530249B904B537EB.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); var invocation = GetSyntax(tree, "string.M()"); - Assert.Equal("void E2.<>E__0.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E2.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); } [Fact] @@ -35957,8 +36863,8 @@ public static void M() { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "string.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void E1.<>E__0.M()", "void E2.<>E__0.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void E1.<>E__0.M()", "void E2.<>E__0.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$8048A6C8BE30A622530249B904B537EB.M()", "void E2.$8048A6C8BE30A622530249B904B537EB.M()"], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E1.$8048A6C8BE30A622530249B904B537EB.M()", "void E2.$8048A6C8BE30A622530249B904B537EB.M()"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -35982,8 +36888,8 @@ public static void M(int i) { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()", "void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()", "void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -36007,9 +36913,9 @@ public static void M(int i) { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void E.<>E__0.M()", "void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M()", "void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -36033,12 +36939,12 @@ public static void M(int i) { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void E.<>E__0.M()", "void E.<>E__0.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M()", "void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 i)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); var cast = GetSyntax(tree, "(System.Action)object.M"); - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(cast).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(cast).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(cast).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal([], model.GetMemberGroup(cast).ToTestDisplayStrings()); } @@ -36088,12 +36994,12 @@ static void F() { } var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntaxes(tree, "a.F").ToArray(); Assert.Null(model.GetSymbolInfo(memberAccess[0]).Symbol); - Assert.Equal(["void A.F()"], model.GetSymbolInfo(memberAccess[0]).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void A.F()", "void E2.<>E__0.F()", "void A.F()"], model.GetMemberGroup(memberAccess[0]).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void A.F()"], model.GetSymbolInfo(memberAccess[0]).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void A.F()", "void E2.$8048A6C8BE30A622530249B904B537EB.F()", "void A.F()"], model.GetMemberGroup(memberAccess[0]).ToTestDisplayStrings()); Assert.Null(model.GetSymbolInfo(memberAccess[1]).Symbol); - Assert.Equal(["void A.F()", "void E2.<>E__0.F()", "void A.F()"], model.GetSymbolInfo(memberAccess[1]).CandidateSymbols.ToTestDisplayStrings()); - Assert.Equal(["void A.F()", "void E2.<>E__0.F()", "void A.F()"], model.GetMemberGroup(memberAccess[1]).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void A.F()", "void E2.$8048A6C8BE30A622530249B904B537EB.F()", "void A.F()"], model.GetSymbolInfo(memberAccess[1]).CandidateSymbols.ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void A.F()", "void E2.$8048A6C8BE30A622530249B904B537EB.F()", "void A.F()"], model.GetMemberGroup(memberAccess[1]).ToTestDisplayStrings()); } [Fact] @@ -36125,7 +37031,7 @@ static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "object.P"); - Assert.Equal("System.Int32 E2.<>E__0.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); + AssertEx.Equal("System.Int32 E2.$66F77D1E46F965A5B22D4932892FA78B.P { get; }", model.GetSymbolInfo(memberAccess).Symbol.ToTestDisplayString()); Assert.Equal([], model.GetSymbolInfo(memberAccess).CandidateSymbols.ToTestDisplayStrings()); Assert.Equal([], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); // Tracked by https://github.com/dotnet/roslyn/issues/78957 : handle GetMemberGroup on a property access } @@ -36154,8 +37060,8 @@ public void Test() var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var genericName = GetSyntax(tree, "M"); - Assert.Equal("void C.M(System.Int32 x)", model.GetSymbolInfo(genericName).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M(System.Int32 x)"], model.GetMemberGroup(genericName).ToTestDisplayStrings()); + AssertEx.Equal("void C.M(System.Int32 x)", model.GetSymbolInfo(genericName).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void C.M(System.Int32 x)"], model.GetMemberGroup(genericName).ToTestDisplayStrings()); } [Fact] @@ -36215,7 +37121,7 @@ public void Test() var model = comp.GetSemanticModel(tree); var memberAccess = GetSyntax(tree, "C.M"); Assert.Null(model.GetSymbolInfo(memberAccess).Symbol); - Assert.Equal(["void C.M(T2 x)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); + AssertEx.SequenceEqual(["void C.M(T2 x)"], model.GetMemberGroup(memberAccess).ToTestDisplayStrings()); } [Fact] @@ -36236,8 +37142,8 @@ private static void M() var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var genericName = GetSyntax(tree, "M()").Expression; - Assert.Equal("void C.M()", model.GetSymbolInfo(genericName).Symbol.ToTestDisplayString()); - Assert.Equal(["void C.M()"], model.GetMemberGroup(genericName).ToTestDisplayStrings()); + AssertEx.Equal("void C.M()", model.GetSymbolInfo(genericName).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void C.M()"], model.GetMemberGroup(genericName).ToTestDisplayStrings()); } [Fact] @@ -36277,8 +37183,8 @@ static void M() Assert.Equal([], model.GetMemberGroup(expr).ToTestDisplayStrings()); expr = GetSyntax(tree, "E.M()").Expression; - Assert.Equal("void E.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void E.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); } [Fact] @@ -36303,12 +37209,12 @@ void M() var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var expr = GetSyntax(tree, "t.M()").Expression; - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); expr = GetSyntax(tree, "t.M()").Expression; - Assert.Equal("void E.<>E__0.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); } [Fact] @@ -36338,26 +37244,26 @@ void M(U u) var extensionParameterSyntax = tree.GetRoot().DescendantNodes().OfType().First(); IParameterSymbol extensionParameter = model.GetDeclaredSymbol(extensionParameterSyntax); - Assert.Equal("T t", extensionParameter.ToTestDisplayString()); + AssertEx.Equal("T t", extensionParameter.ToTestDisplayString()); var t = extensionParameter.Type; var expr = GetSyntax(tree, "t.M(u)").Expression; - Assert.Equal("void E.<>E__0.M(U u)", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(U u)"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M(U u)", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M(U u)"], model.GetMemberGroup(expr).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.<>E__0.M(U u)"], model.LookupSymbols(position: expr.SpanStart, t, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["void E.$8048A6C8BE30A622530249B904B537EB.M(U u)"], model.LookupSymbols(position: expr.SpanStart, t, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); expr = GetSyntax(tree, "t.M(u)").Expression; - Assert.Equal("void E.<>E__0.M(U u)", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(U u)"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M(U u)", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M(U u)"], model.GetMemberGroup(expr).ToTestDisplayStrings()); expr = GetSyntax(tree, "t.M(42)").Expression; - Assert.Equal("void E.<>E__0.M(System.Int32 u)", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(U u)"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 u)", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M(U u)"], model.GetMemberGroup(expr).ToTestDisplayStrings()); expr = GetSyntax(tree, "42.M(u)").Expression; - Assert.Equal("void E.<>E__0.M(U u)", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void E.<>E__0.M(U u)"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void E.$8048A6C8BE30A622530249B904B537EB.M(U u)", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void E.$8048A6C8BE30A622530249B904B537EB.M(U u)"], model.GetMemberGroup(expr).ToTestDisplayStrings()); } [Fact] @@ -36381,18 +37287,18 @@ public static void M(this T t) var extensionParameterSyntax = tree.GetRoot().DescendantNodes().OfType().First(); IParameterSymbol extensionParameter = model.GetDeclaredSymbol(extensionParameterSyntax); - Assert.Equal("T t", extensionParameter.ToTestDisplayString()); + AssertEx.Equal("T t", extensionParameter.ToTestDisplayString()); var t = extensionParameter.Type; var expr = GetSyntax(tree, "t.M()").Expression; - Assert.Equal("void T.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void T.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void T.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void T.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); AssertEqualAndNoDuplicates(["void T.M()"], model.LookupSymbols(position: expr.SpanStart, t, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); expr = GetSyntax(tree, "t.M()").Expression; - Assert.Equal("void T.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); - Assert.Equal(["void T.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); + AssertEx.Equal("void T.M()", model.GetSymbolInfo(expr).Symbol.ToTestDisplayString()); + AssertEx.SequenceEqual(["void T.M()"], model.GetMemberGroup(expr).ToTestDisplayStrings()); } [Fact] @@ -36490,10 +37396,10 @@ static void verifySymbolInfo(CSharpCompilation comp) var model = comp.GetSemanticModel(tree); var o = ((Compilation)comp).GetSpecialType(SpecialType.System_Object); - AssertEqualAndNoDuplicates(["void E.<>E__0.M()"], model.LookupSymbols(position: 0, o, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["void E.<>E__0.M2()"], model.LookupSymbols(position: 0, o, name: "M2", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["System.Int32 E.<>E__0.P { get; }"], model.LookupSymbols(position: 0, o, name: "P", includeReducedExtensionMethods: true).ToTestDisplayStrings()); - AssertEqualAndNoDuplicates(["System.Int32 E.<>E__0.P2 { get; }"], model.LookupSymbols(position: 0, o, name: "P2", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M()"], model.LookupSymbols(position: 0, o, name: "M", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M2()"], model.LookupSymbols(position: 0, o, name: "M2", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.P { get; }"], model.LookupSymbols(position: 0, o, name: "P", includeReducedExtensionMethods: true).ToTestDisplayStrings()); + AssertEqualAndNoDuplicates(["System.Int32 E.$C43E2675C7BBF9284AF22FB8A9BF0280.P2 { get; }"], model.LookupSymbols(position: 0, o, name: "P2", includeReducedExtensionMethods: true).ToTestDisplayStrings()); } } @@ -36686,10 +37592,10 @@ public void M2() { } Assert.Null(model.GetSymbolInfo(invocation).Symbol); invocation = GetSyntax(tree, "this.M2()"); - Assert.Equal("void E.<>E__0.M2()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M2()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); invocation = GetSyntax(tree, "M2(new object())"); - Assert.Equal("void E.M2(this System.Object o)", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.M2(this System.Object o)", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); } [Fact] @@ -36737,7 +37643,7 @@ public static void M2() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation = GetSyntax(tree, "M2()"); - Assert.Equal("void E.M2()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); + AssertEx.Equal("void E.M2()", model.GetSymbolInfo(invocation).Symbol.ToTestDisplayString()); } [Fact] @@ -37252,7 +38158,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var localDeclaration = GetSyntax(tree, "var x = int.M"); - Assert.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); } [Fact] @@ -37327,7 +38233,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var localDeclaration = GetSyntax(tree, "var x = 42.M"); - Assert.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); } [Fact] @@ -37351,7 +38257,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var localDeclaration = GetSyntax(tree, """var x = "ran".M"""); - Assert.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); } [Fact] @@ -37427,7 +38333,7 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var localDeclaration = GetSyntax(tree, """var x = "ran".M"""); - Assert.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); } [Fact] @@ -37452,7 +38358,7 @@ public void M(T t) { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var localDeclaration = GetSyntax(tree, """var x = "ran".M"""); - Assert.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); } [Fact] @@ -37537,7 +38443,7 @@ public static class E2 var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var localDeclaration = GetSyntax(tree, """var x = "ran".M"""); - Assert.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action", model.GetTypeInfo(localDeclaration.Type).Type.ToTestDisplayString()); } [Fact] @@ -37797,7 +38703,7 @@ public static void Main() static void validateSymbols(ModuleSymbol module) { var m = module.GlobalNamespace.GetMember("<>f__AnonymousDelegate0.Invoke"); - Assert.Equal("void <>f__AnonymousDelegate0.Invoke(params T1[] arg)", m.ToTestDisplayString()); + AssertEx.Equal("void <>f__AnonymousDelegate0.Invoke(params T1[] arg)", m.ToTestDisplayString()); } } @@ -37846,7 +38752,7 @@ public static void Main() static void validateSymbols(ModuleSymbol module) { var m = module.GlobalNamespace.GetMember("<>f__AnonymousDelegate0.Invoke"); - Assert.Equal("void <>f__AnonymousDelegate0.Invoke(params T1[] arg)", m.ToTestDisplayString()); + AssertEx.Equal("void <>f__AnonymousDelegate0.Invoke(params T1[] arg)", m.ToTestDisplayString()); } } @@ -37937,7 +38843,7 @@ public static void Main() static void validateSymbols(ModuleSymbol module) { var m = module.GlobalNamespace.GetMember("<>f__AnonymousDelegate0.Invoke"); - Assert.Equal("void <>f__AnonymousDelegate0.Invoke(params T1[] arg)", m.ToTestDisplayString()); + AssertEx.Equal("void <>f__AnonymousDelegate0.Invoke(params T1[] arg)", m.ToTestDisplayString()); } } @@ -38037,7 +38943,7 @@ public static class Extensions Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C()') Value: - IInvocationOperation ( C.Enumerator Extensions.<>E__0.GetEnumerator([System.Int32 x = 1])) (OperationKind.Invocation, Type: C.Enumerator, IsImplicit) (Syntax: 'new C()') + IInvocationOperation ( C.Enumerator Extensions.$9794DAFCCB9E752B29BFD6350ADA77F2.GetEnumerator([System.Int32 x = 1])) (OperationKind.Invocation, Type: C.Enumerator, IsImplicit) (Syntax: 'new C()') Instance Receiver: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: C, IsImplicit) (Syntax: 'new C()') Conversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -38144,7 +39050,7 @@ public static class Extensions Statements (1) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C()') Value: - IInvocationOperation ( C.Enumerator Extensions.<>E__0.GetEnumerator([System.Int32 x = 1])) (OperationKind.Invocation, Type: C.Enumerator, IsImplicit) (Syntax: 'new C()') + IInvocationOperation ( C.Enumerator Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.GetEnumerator([System.Int32 x = 1])) (OperationKind.Invocation, Type: C.Enumerator, IsImplicit) (Syntax: 'new C()') Instance Receiver: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new C()') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) @@ -39615,7 +40521,7 @@ ref struct RS { } Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "scoped").WithArguments("scoped").WithLocation(3, 15)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void ReceiverParameterValidation_UnnamedReceiverParameter_FromMetadata() { // extension(int) @@ -40047,59 +40953,88 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + int32 '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::'$' + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods - .method private hidebysig specialname static - void '$' ( - int32 '' - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig static void M () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::M .method private hidebysig specialname static int32 get_P () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P .method private hidebysig specialname static void set_P ( int32 'value' ) cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P // Properties .property int32 P() { - .get int32 E/'<>E__0'::get_P() - .set void E/'<>E__0'::set_P(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + .get int32 E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P() + .set void E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P(int32) } - } // end of class <>E__0 + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods .method private hidebysig static pinvokeimpl("something.dll" winapi) void M () cil managed preservesig @@ -40151,59 +41086,88 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$F4B4FFE41AB49E80A4ECF390CF6EB372' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + int32 i + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$F4B4FFE41AB49E80A4ECF390CF6EB372'::'$' + } // end of class $F4B4FFE41AB49E80A4ECF390CF6EB372 // Methods - .method private hidebysig specialname static - void '$' ( - int32 i - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig instance void M () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::M .method private hidebysig specialname instance int32 get_P () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P .method private hidebysig specialname instance void set_P ( int32 'value' ) cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P // Properties .property instance int32 P() { - .get instance int32 E/'<>E__0'::get_P() - .set instance void E/'<>E__0'::set_P(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + .get instance int32 E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P() + .set instance void E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P(int32) } - } // end of class <>E__0 + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods .method private hidebysig static pinvokeimpl("something.dll" winapi) void M ( @@ -40273,59 +41237,88 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + int32 '' + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::'$' + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods - .method private hidebysig specialname static - void '$' ( - int32 '' - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig static void M () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::M .method private hidebysig specialname static int32 get_P () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P .method private hidebysig specialname static void set_P ( int32 'value' ) cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P // Properties .property int32 P() { - .get int32 E/'<>E__0'::get_P() - .set void E/'<>E__0'::set_P(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 41 34 31 + 43 46 45 32 42 35 45 44 41 45 42 38 43 31 42 39 + 30 36 32 46 35 39 45 44 34 44 36 39 00 00 + ) + .get int32 E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P() + .set void E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P(int32) } - } // end of class <>E__0 + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods .method private hidebysig static pinvokeimpl("something.dll" as "Method1" winapi) void M () cil managed preservesig @@ -40384,59 +41377,88 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$F4B4FFE41AB49E80A4ECF390CF6EB372' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + int32 i + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$F4B4FFE41AB49E80A4ECF390CF6EB372'::'$' + } // end of class $F4B4FFE41AB49E80A4ECF390CF6EB372 // Methods - .method private hidebysig specialname static - void '$' ( - int32 i - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig instance void M () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::M .method private hidebysig specialname instance int32 get_P () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P .method private hidebysig specialname instance void set_P ( int32 'value' ) cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P // Properties .property instance int32 P() { - .get instance int32 E/'<>E__0'::get_P() - .set instance void E/'<>E__0'::set_P(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + .get instance int32 E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P() + .set instance void E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P(int32) } - } // end of class <>E__0 + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods .method private hidebysig static void M ( @@ -40541,59 +41563,88 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$F4B4FFE41AB49E80A4ECF390CF6EB372' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + int32 i + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$F4B4FFE41AB49E80A4ECF390CF6EB372'::'$' + } // end of class $F4B4FFE41AB49E80A4ECF390CF6EB372 // Methods - .method private hidebysig specialname static - void '$' ( - int32 i - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig static void M () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::M .method private hidebysig specialname static int32 get_P () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P .method private hidebysig specialname static void set_P ( int32 'value' ) cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P // Properties .property int32 P() { - .get int32 E/'<>E__0'::get_P() - .set void E/'<>E__0'::set_P(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + .get int32 E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P() + .set void E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P(int32) } - } // end of class <>E__0 + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods .method private hidebysig static void M () cil managed @@ -40668,59 +41719,88 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$F4B4FFE41AB49E80A4ECF390CF6EB372' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + int32 i + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$F4B4FFE41AB49E80A4ECF390CF6EB372'::'$' + } // end of class $F4B4FFE41AB49E80A4ECF390CF6EB372 // Methods - .method private hidebysig specialname static - void '$' ( - int32 i - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig static void M () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::M .method private hidebysig specialname static int32 get_P () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P .method private hidebysig specialname static void set_P ( int32 'value' ) cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P // Properties .property int32 P() { - .get int32 E/'<>E__0'::get_P() - .set void E/'<>E__0'::set_P(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + .get int32 E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P() + .set void E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P(int32) } - } // end of class <>E__0 + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods .method private hidebysig static void M () cil managed internalcall @@ -40773,59 +41853,88 @@ extends [netstandard]System.Object 01 00 00 00 ) // Nested Types - .class nested public auto ansi sealed specialname beforefieldinit '<>E__0' + .class nested public auto ansi sealed specialname '$BA41CFE2B5EDAEB8C1B9062F59ED4D69' extends [netstandard]System.Object { + .custom instance void [netstandard]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$F4B4FFE41AB49E80A4ECF390CF6EB372' + extends [netstandard]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + int32 i + ) cil managed + { + .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x206a + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$F4B4FFE41AB49E80A4ECF390CF6EB372'::'$' + } // end of class $F4B4FFE41AB49E80A4ECF390CF6EB372 // Methods - .method private hidebysig specialname static - void '$' ( - int32 i - ) cil managed - { - .custom instance void [netstandard]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( - 01 00 00 00 - ) - // Method begins at RVA 0x2067 - // Code size 1 (0x1) - .maxstack 8 - IL_0000: ret - } // end of method '<>E__0'::'$' .method private hidebysig instance void M () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::M + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::M .method private hidebysig specialname instance int32 get_P () cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::get_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P .method private hidebysig specialname instance void set_P ( int32 'value' ) cil managed { - // Method begins at RVA 0x2069 + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + // Method begins at RVA 0x2067 // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: throw - } // end of method '<>E__0'::set_P + } // end of method '$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P // Properties .property instance int32 P() { - .get instance int32 E/'<>E__0'::get_P() - .set instance void E/'<>E__0'::set_P(int32) + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 34 42 34 + 46 46 45 34 31 41 42 34 39 45 38 30 41 34 45 43 + 46 33 39 30 43 46 36 45 42 33 37 32 00 00 + ) + .get instance int32 E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::get_P() + .set instance void E/'$BA41CFE2B5EDAEB8C1B9062F59ED4D69'::set_P(int32) } - } // end of class <>E__0 + } // end of class $BA41CFE2B5EDAEB8C1B9062F59ED4D69 // Methods .method private hidebysig static void M ( @@ -41198,12 +42307,12 @@ static class E } } """; - var comp = CreateCompilation(source, options: TestOptions.ReleaseExe.WithMainTypeName("E.<>E__0")); + var comp = CreateCompilation(source, options: TestOptions.ReleaseExe.WithMainTypeName("E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69")); comp.VerifyEmitDiagnostics( - // error CS1555: Could not find 'E.<>E__0' specified for Main method - Diagnostic(ErrorCode.ERR_MainClassNotFound).WithArguments("E.<>E__0").WithLocation(1, 1)); + // error CS1555: Could not find 'E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69' specified for Main method + Diagnostic(ErrorCode.ERR_MainClassNotFound).WithArguments("E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69").WithLocation(1, 1)); - Assert.Equal("<>E__0", comp.GetTypeByMetadataName("E").GetTypeMembers().Single().ExtensionName); + AssertEx.Equal("$BA41CFE2B5EDAEB8C1B9062F59ED4D69", comp.GetTypeByMetadataName("E").GetTypeMembers().Single().ExtensionName); // Tracked by https://github.com/dotnet/roslyn/issues/78968 : we should find the unspeakable nested type Assert.Null(comp.GetTypeByMetadataName("E+<>E__0")); @@ -42096,10 +43205,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation1 = GetSyntax(tree, "oNull.M()"); - Assert.Equal("System.Object? E.extension(System.Object?).M()", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object? E.extension(System.Object?).M()", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); var invocation2 = GetSyntax(tree, "oNotNull.M()"); - Assert.Equal("System.Object! E.extension(System.Object!).M()", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object! E.extension(System.Object!).M()", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); } [Fact] @@ -42144,10 +43253,10 @@ public static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation1 = GetSyntax(tree, "oNull.M()"); - Assert.Equal("System.Object? E.extension(System.Object?).M()", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object? E.extension(System.Object?).M()", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); var invocation2 = GetSyntax(tree, "oNotNull.M()"); - Assert.Equal("System.Object! E.extension(System.Object!).M()", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object! E.extension(System.Object!).M()", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); } [Fact] @@ -42185,10 +43294,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation1 = GetSyntax(tree, "oNull.M(oNull)"); - Assert.Equal("System.Object? E.extension(System.Object?).M(System.Object? u)", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object? E.extension(System.Object?).M(System.Object? u)", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); var invocation2 = GetSyntax(tree, "oNotNull.M(oNotNull)"); - Assert.Equal("System.Object! E.extension(System.Object!).M(System.Object! u)", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object! E.extension(System.Object!).M(System.Object! u)", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); } [Fact] @@ -42224,10 +43333,10 @@ class C { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var invocation1 = GetSyntax(tree, "Derived1.M()"); - Assert.Equal("System.Object? E.extension(C!).M()", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object? E.extension(C!).M()", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); var invocation2 = GetSyntax(tree, "Derived2.M()"); - Assert.Equal("System.Object! E.extension(C!).M()", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object! E.extension(C!).M()", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); } [Fact] @@ -42449,16 +43558,16 @@ public void M() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "oNull.M"); - Assert.Equal("void E.extension(System.Object?).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("void E.extension(System.Object?).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); var localDeclaration1 = GetSyntax(tree, "var x = oNull.M"); - Assert.Equal("System.Action?", model.GetTypeInfo(localDeclaration1.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action?", model.GetTypeInfo(localDeclaration1.Type).Type.ToTestDisplayString()); var memberAccess2 = GetSyntax(tree, "oNotNull.M"); - Assert.Equal("void E.extension(System.Object?).M()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("void E.extension(System.Object?).M()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); var localDeclaration2 = GetSyntax(tree, "var y = oNotNull.M"); - Assert.Equal("System.Action?", model.GetTypeInfo(localDeclaration2.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action?", model.GetTypeInfo(localDeclaration2.Type).Type.ToTestDisplayString()); } [Fact] @@ -42490,16 +43599,16 @@ public void M() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "oNull.M"); - Assert.Equal("void E.extension(System.Object!).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("void E.extension(System.Object!).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); var localDeclaration1 = GetSyntax(tree, "var x = oNull.M"); - Assert.Equal("System.Action?", model.GetTypeInfo(localDeclaration1.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action?", model.GetTypeInfo(localDeclaration1.Type).Type.ToTestDisplayString()); var memberAccess2 = GetSyntax(tree, "oNotNull.M"); - Assert.Equal("void E.extension(System.Object!).M()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("void E.extension(System.Object!).M()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); var localDeclaration2 = GetSyntax(tree, "var y = oNotNull.M"); - Assert.Equal("System.Action?", model.GetTypeInfo(localDeclaration2.Type).Type.ToTestDisplayString()); + AssertEx.Equal("System.Action?", model.GetTypeInfo(localDeclaration2.Type).Type.ToTestDisplayString()); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78022")] @@ -42557,35 +43666,35 @@ static class E var model = comp.GetSemanticModel(tree); // Should be "System.Object? E.extension(System.Object?).M()" var memberAccess1 = GetSyntax(tree, "oNull.M"); - Assert.Equal("System.Object E.extension(System.Object).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object E.extension(System.Object).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Func?" var varDeclaration1 = GetSyntax(tree, "var x = oNull.M"); - Assert.Equal("System.Func?", model.GetTypeInfo(varDeclaration1.Type).Type.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Func?", model.GetTypeInfo(varDeclaration1.Type).Type.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Object? System.Object?.M2()" var memberAccess2 = GetSyntax(tree, "oNull.M2"); - Assert.Equal("System.Object System.Object!.M2()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object System.Object!.M2()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Func?" var varDeclaration2 = GetSyntax(tree, "var x2 = oNull.M2"); - Assert.Equal("System.Func?", model.GetTypeInfo(varDeclaration2.Type).Type.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Func?", model.GetTypeInfo(varDeclaration2.Type).Type.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Object? E.extension(System.Object?).M()" var memberAccess3 = GetSyntax(tree, "oNull2.M"); - Assert.Equal("System.Object E.extension(System.Object).M()", model.GetSymbolInfo(memberAccess3).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object E.extension(System.Object).M()", model.GetSymbolInfo(memberAccess3).Symbol.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Object? System.Object?.M2()" var memberAccess4 = GetSyntax(tree, "oNull2.M2"); - Assert.Equal("System.Object System.Object!.M2()", model.GetSymbolInfo(memberAccess4).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object System.Object!.M2()", model.GetSymbolInfo(memberAccess4).Symbol.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Object! E.extension(System.Object!).M()" var memberAccess5 = GetSyntax(tree, "oNotNull.M"); - Assert.Equal("System.Object E.extension(System.Object).M()", model.GetSymbolInfo(memberAccess5).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object E.extension(System.Object).M()", model.GetSymbolInfo(memberAccess5).Symbol.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Func?" var varDeclaration3 = GetSyntax(tree, "var y = oNotNull.M"); - Assert.Equal("System.Func?", model.GetTypeInfo(varDeclaration3.Type).Type.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Func?", model.GetTypeInfo(varDeclaration3.Type).Type.ToTestDisplayString(includeNonNullable: true)); } [Fact] @@ -42693,19 +43802,19 @@ class C { } var model = comp.GetSemanticModel(tree); var invocation1 = GetSyntax(tree, "Derived1.M"); // Should be "System.Object? E.extension(C!).M()" - Assert.Equal("System.Object E.extension(C!).M()", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object E.extension(C!).M()", model.GetSymbolInfo(invocation1).Symbol.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Func?" var localDeclaration1 = GetSyntax(tree, "var x = Derived1.M"); - Assert.Equal("System.Func?", model.GetTypeInfo(localDeclaration1.Type).Type.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Func?", model.GetTypeInfo(localDeclaration1.Type).Type.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Object! E.extension(C!).M()" var invocation2 = GetSyntax(tree, "Derived2.M"); - Assert.Equal("System.Object E.extension(C!).M()", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object E.extension(C!).M()", model.GetSymbolInfo(invocation2).Symbol.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Func?" var localDeclaration2 = GetSyntax(tree, "var x = Derived1.M"); - Assert.Equal("System.Func?", model.GetTypeInfo(localDeclaration2.Type).Type.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Func?", model.GetTypeInfo(localDeclaration2.Type).Type.ToTestDisplayString(includeNonNullable: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78022")] @@ -42740,11 +43849,11 @@ class C { } var model = comp.GetSemanticModel(tree); var memberAccess1 = GetSyntax(tree, "Derived1.M"); // Should be "System.Object? E.extension(C!).M()" - Assert.Equal("System.Object E.extension(C!).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object E.extension(C!).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); var memberAccess2 = GetSyntax(tree, "Derived2.M"); // Should be "System.Object! E.extension(C!).M()" - Assert.Equal("System.Object E.extension(C!).M()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object E.extension(C!).M()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); } [Fact] @@ -42793,18 +43902,18 @@ class C { } var model = comp.GetSemanticModel(tree); // Should be "System.Object? E.extension(C!).M()" var memberAccess1 = GetSyntax(tree, "Derived1.M"); - Assert.Equal("System.Object! E.extension(C!).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object! E.extension(C!).M()", model.GetSymbolInfo(memberAccess1).Symbol.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Func?" var varDeclaration1 = GetSyntax(tree, "var x = Derived1.M"); - Assert.Equal("System.Func?", model.GetTypeInfo(varDeclaration1.Type).Type.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Func?", model.GetTypeInfo(varDeclaration1.Type).Type.ToTestDisplayString(includeNonNullable: true)); // Should be "System.Object! E.extension(C!).M()" var memberAccess2 = GetSyntax(tree, "Derived2.M"); - Assert.Equal("System.Object! E.extension(C!).M()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Object! E.extension(C!).M()", model.GetSymbolInfo(memberAccess2).Symbol.ToTestDisplayString(includeNonNullable: true)); var varDeclaration2 = GetSyntax(tree, "var x = Derived1.M"); - Assert.Equal("System.Func?", model.GetTypeInfo(varDeclaration2.Type).Type.ToTestDisplayString(includeNonNullable: true)); + AssertEx.Equal("System.Func?", model.GetTypeInfo(varDeclaration2.Type).Type.ToTestDisplayString(includeNonNullable: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78022")] @@ -42848,17 +43957,17 @@ static class E var model = comp.GetSemanticModel(tree); var assignment1 = GetSyntax(tree, "var (x1, x2) = oNull"); // Should be "void E.extension(System.Object?).Deconstruct(out System.Object? t1, out System.Object? t2)" - Assert.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", + AssertEx.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", model.GetDeconstructionInfo(assignment1).Method.ToTestDisplayString(includeNonNullable: true)); // Should be "void E.extension(System.Object!).Deconstruct(out System.Object! t1, out System.Object! t2)" var assignment2 = GetSyntax(tree, "var (y1, y2) = oNotNull"); - Assert.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", + AssertEx.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", model.GetDeconstructionInfo(assignment2).Method.ToTestDisplayString(includeNonNullable: true)); // Should be "void E.Deconstruct(this System.Object? t, out System.Object? t1, out System.Object? t2, out System.Object? t3)" var assignment3 = GetSyntax(tree, "var (z1, z2, z3) = oNull"); - Assert.Equal("void E.Deconstruct(this System.Object t, out System.Object t1, out System.Object t2, out System.Object t3)", + AssertEx.Equal("void E.Deconstruct(this System.Object t, out System.Object t1, out System.Object t2, out System.Object t3)", model.GetDeconstructionInfo(assignment3).Method.ToTestDisplayString(includeNonNullable: true)); } @@ -42891,7 +44000,7 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var assignment1 = GetSyntax(tree, "var (x1, x2) = oNull"); - Assert.Equal("void E.extension(System.Object!).Deconstruct(out System.Int32 i1, out System.Int32 i2)", + AssertEx.Equal("void E.extension(System.Object!).Deconstruct(out System.Int32 i1, out System.Int32 i2)", model.GetDeconstructionInfo(assignment1).Method.ToTestDisplayString(includeNonNullable: true)); } @@ -43217,7 +44326,7 @@ static class E // Tracked by https://github.com/dotnet/roslyn/issues/78022 : the semantic model is incorrect for re-inferred deconstruction var assignment = tree.GetRoot().DescendantNodes().OfType().Single(); // Should be "void E.extension(System.Object).Deconstruct(out System.Object? t1, out System.Object? t2)" - Assert.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", + AssertEx.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", model.GetDeconstructionInfo(assignment).Method.ToTestDisplayString(includeNonNullable: true)); } @@ -43256,10 +44365,10 @@ static class E var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); var assignments = tree.GetRoot().DescendantNodes().OfType().ToArray(); - Assert.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", + AssertEx.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", model.GetDeconstructionInfo(assignments[0]).Method.ToTestDisplayString(includeNonNullable: true)); - Assert.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", + AssertEx.Equal("void E.extension(System.Object).Deconstruct(out System.Object t1, out System.Object t2)", model.GetDeconstructionInfo(assignments[1]).Method.ToTestDisplayString(includeNonNullable: true)); } @@ -43411,6 +44520,136 @@ public static class E Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "o").WithLocation(7, 27)); var libComp = CreateCompilation(libSrc); + + CompileAndVerify(libComp).VerifyTypeIL("E", """ +.class public auto ansi abstract sealed beforefieldinit E + extends [mscorlib]System.Object +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$FCD10F86264A5A381A31E52427E53CAB' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( + 01 00 02 00 00 + ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20a9 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$FCD10F86264A5A381A31E52427E53CAB'::'$' + } // end of class $FCD10F86264A5A381A31E52427E53CAB + .class nested private auto ansi abstract sealed specialname '$FB03ECDF5D1B3883A99E213C2D618E82' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( + 01 00 01 00 00 + ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x20a9 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$FB03ECDF5D1B3883A99E213C2D618E82'::'$' + } // end of class $FB03ECDF5D1B3883A99E213C2D618E82 + // Methods + .method public hidebysig + instance void M () cil managed + { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 43 44 31 + 30 46 38 36 32 36 34 41 35 41 33 38 31 41 33 31 + 45 35 32 34 32 37 45 35 33 43 41 42 00 00 + ) + // Method begins at RVA 0x20a6 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M + .method public hidebysig + instance void M2 () cil managed + { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 46 42 30 33 + 45 43 44 46 35 44 31 42 33 38 38 33 41 39 39 45 + 32 31 33 43 32 44 36 31 38 45 38 32 00 00 + ) + // Method begins at RVA 0x20a6 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method '$C43E2675C7BBF9284AF22FB8A9BF0280'::M2 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 + // Methods + .method public hidebysig static + void M ( + object o + ) cil managed + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( + 01 00 02 00 00 + ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209d + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance string [mscorlib]System.Object::ToString() + IL_0006: pop + IL_0007: ret + } // end of method E::M + .method public hidebysig static + void M2 ( + object o + ) cil managed + { + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( + 01 00 01 00 00 + ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x209d + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance string [mscorlib]System.Object::ToString() + IL_0006: pop + IL_0007: ret + } // end of method E::M2 +} // end of class E +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); + var comp2 = CreateCompilation(src, references: [libComp.EmitToImageReference()]); comp2.VerifyEmitDiagnostics(); } @@ -44467,12 +45706,12 @@ public void Nullability_Attribute_22() C.Try(out var x).AssertTrue().M(x); C.Try(out var y).AssertFalse().M(y); -class C +public class C { public static bool Try([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out object? o) => throw null!; public void M(object o) { } } -static class E +public static class E { extension([System.Diagnostics.CodeAnalysis.DoesNotReturnIf(false)] bool b) { @@ -44486,7 +45725,170 @@ static class E } """; var comp = CreateCompilation(src, targetFramework: TargetFramework.Net90); - comp.VerifyEmitDiagnostics( + CompileAndVerify(comp, symbolValidator: (m) => + { + var container = m.GlobalNamespace.GetTypeMember("E"); + var extensions = container.GetTypeMembers(); + + AssertEx.Equal("System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)", extensions[0].ExtensionParameter.GetAttributes().Single().ToString()); + AssertEx.Equal("$7073A58FCA9AF178F78C9DFB2EC1CFCB", extensions[0].MetadataName); + Symbol m1 = extensions[0].GetMembers().Single(); + AssertEx.Equal("E.extension(bool).AssertTrue()", m1.ToDisplayString()); + AssertEx.Equal(@"System.Runtime.CompilerServices.ExtensionMarkerNameAttribute(""$7073A58FCA9AF178F78C9DFB2EC1CFCB"")", m1.GetAttributes().Single().ToString()); + + AssertEx.Equal("System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(true)", extensions[1].ExtensionParameter.GetAttributes().Single().ToString()); + AssertEx.Equal("$B2C5862F475D26FF0E9CB6F2B30AA3F7", extensions[1].MetadataName); + Symbol m2 = extensions[1].GetMembers().Single(); + AssertEx.Equal("E.extension(bool).AssertFalse()", m2.ToDisplayString()); + AssertEx.Equal(@"System.Runtime.CompilerServices.ExtensionMarkerNameAttribute(""$B2C5862F475D26FF0E9CB6F2B30AA3F7"")", m2.GetAttributes().Single().ToString()); + }, verify: Verification.FailsPEVerify). + VerifyDiagnostics( + // (4,34): warning CS8604: Possible null reference argument for parameter 'o' in 'void C.M(object o)'. + // C.Try(out var y).AssertFalse().M(y); + Diagnostic(ErrorCode.WRN_NullReferenceArgument, "y").WithArguments("o", "void C.M(object o)").WithLocation(4, 34)). + VerifyTypeIL("E", """ +.class public auto ansi abstract sealed beforefieldinit E + extends [System.Runtime]System.Object +{ + .custom instance void [System.Runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( + 01 00 01 00 00 + ) + .custom instance void [System.Runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( + 01 00 00 00 00 + ) + .custom instance void [System.Runtime]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$A73C5770D9DE823384DE9FB3AFAAD000' + extends [System.Runtime]System.Object + { + .custom instance void [System.Runtime]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$7073A58FCA9AF178F78C9DFB2EC1CFCB' + extends [System.Runtime]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + bool b + ) cil managed + { + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + .param [1] + .custom instance void [System.Runtime]System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute::.ctor(bool) = ( + 01 00 00 00 00 + ) + // Method begins at RVA 0x2094 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$7073A58FCA9AF178F78C9DFB2EC1CFCB'::'$' + } // end of class $7073A58FCA9AF178F78C9DFB2EC1CFCB + .class nested private auto ansi abstract sealed specialname '$B2C5862F475D26FF0E9CB6F2B30AA3F7' + extends [System.Runtime]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + bool b + ) cil managed + { + .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + .param [1] + .custom instance void [System.Runtime]System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute::.ctor(bool) = ( + 01 00 01 00 00 + ) + // Method begins at RVA 0x2094 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$B2C5862F475D26FF0E9CB6F2B30AA3F7'::'$' + } // end of class $B2C5862F475D26FF0E9CB6F2B30AA3F7 + // Methods + .method public hidebysig + instance class C AssertTrue () cil managed + { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 37 30 37 33 + 41 35 38 46 43 41 39 41 46 31 37 38 46 37 38 43 + 39 44 46 42 32 45 43 31 43 46 43 42 00 00 + ) + // Method begins at RVA 0x2096 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method '$A73C5770D9DE823384DE9FB3AFAAD000'::AssertTrue + .method public hidebysig + instance class C AssertFalse () cil managed + { + .custom instance void System.Runtime.CompilerServices.ExtensionMarkerNameAttribute::.ctor(string) = ( + 01 00 29 3c 4d 61 72 6b 65 72 3e 24 42 32 43 35 + 38 36 32 46 34 37 35 44 32 36 46 46 30 45 39 43 + 42 36 46 32 42 33 30 41 41 33 46 37 00 00 + ) + // Method begins at RVA 0x2096 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method '$A73C5770D9DE823384DE9FB3AFAAD000'::AssertFalse + } // end of class $A73C5770D9DE823384DE9FB3AFAAD000 + // Methods + .method public hidebysig static + class C AssertTrue ( + bool b + ) cil managed + { + .custom instance void [System.Runtime]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + .param [1] + .custom instance void [System.Runtime]System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute::.ctor(bool) = ( + 01 00 00 00 00 + ) + // Method begins at RVA 0x2091 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method E::AssertTrue + .method public hidebysig static + class C AssertFalse ( + bool b + ) cil managed + { + .custom instance void [System.Runtime]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + .param [1] + .custom instance void [System.Runtime]System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute::.ctor(bool) = ( + 01 00 01 00 00 + ) + // Method begins at RVA 0x2091 + // Code size 2 (0x2) + .maxstack 8 + IL_0000: ldnull + IL_0001: throw + } // end of method E::AssertFalse +} // end of class E +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); + + var src2 = """ +#nullable enable + +C.Try(out var x).AssertTrue().M(x); +C.Try(out var y).AssertFalse().M(y); +"""; + var comp2 = CreateCompilation(src2, references: [comp.EmitToImageReference()], targetFramework: TargetFramework.Net90); + CompileAndVerify(comp2, verify: Verification.FailsPEVerify).VerifyDiagnostics( // (4,34): warning CS8604: Possible null reference argument for parameter 'o' in 'void C.M(object o)'. // C.Try(out var y).AssertFalse().M(y); Diagnostic(ErrorCode.WRN_NullReferenceArgument, "y").WithArguments("o", "void C.M(object o)").WithLocation(4, 34)); @@ -44647,7 +46049,7 @@ public IEnumerator GetEnumerator() var model = comp.GetSemanticModel(tree); var loop = tree.GetRoot().DescendantNodes().OfType().First(); // Tracked by https://github.com/dotnet/roslyn/issues/78022 : incorrect nullability - Assert.Equal("System.Collections.Generic.IEnumerator! E.extension(System.Object).GetEnumerator()", + AssertEx.Equal("System.Collections.Generic.IEnumerator! E.extension(System.Object).GetEnumerator()", model.GetForEachStatementInfo(loop).GetEnumeratorMethod.ToTestDisplayString(includeNonNullable: true)); src = """ @@ -44678,7 +46080,7 @@ public static IEnumerator GetEnumerator(this T t) tree = comp.SyntaxTrees.Single(); model = comp.GetSemanticModel(tree); loop = tree.GetRoot().DescendantNodes().OfType().First(); - Assert.Equal("System.Collections.Generic.IEnumerator! E.GetEnumerator(this System.Object t)", + AssertEx.Equal("System.Collections.Generic.IEnumerator! E.GetEnumerator(this System.Object t)", model.GetForEachStatementInfo(loop).GetEnumeratorMethod.ToTestDisplayString(includeNonNullable: true)); } @@ -44892,7 +46294,7 @@ public int Property { set { } } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var assignment = GetSyntax(tree, "Property = 42"); - Assert.Equal("System.Int32 E.extension(System.Object).Property { set; }", + AssertEx.Equal("System.Int32 E.extension(System.Object).Property { set; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString(includeNonNullable: true)); } @@ -44923,11 +46325,11 @@ public T Property { set { } } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); var assignment = GetSyntax(tree, "Property = oNull"); - Assert.Equal("System.Object E.extension(System.Object).Property { set; }", + AssertEx.Equal("System.Object E.extension(System.Object).Property { set; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString(includeNonNullable: true)); assignment = GetSyntax(tree, "Property = oNotNull"); - Assert.Equal("System.Object E.extension(System.Object).Property { set; }", + AssertEx.Equal("System.Object E.extension(System.Object).Property { set; }", model.GetSymbolInfo(assignment.Left).Symbol.ToTestDisplayString(includeNonNullable: true)); } @@ -45377,7 +46779,7 @@ .method public hidebysig static int32 get_P ( int32 '' ) cil managed Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "P").WithArguments("int", "P").WithLocation(2, 8)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void SpecialName_02() { // extension(int) @@ -45673,9 +47075,9 @@ static class E """, e.GetDocumentationCommentXml()); var extension = e.GetTypeMembers().Single(); - Assert.Equal("T:E.<>E__0`1", extension.GetDocumentationCommentId()); + AssertEx.Equal("T:E.$8048A6C8BE30A622530249B904B537EB", extension.GetDocumentationCommentId()); AssertEx.Equal(""" - + Summary for extension block Description for T Description for t @@ -45685,7 +47087,7 @@ static class E var mSkeleton = extension.GetMember("M"); AssertEx.Equal(""" - + Summary for M Description for U Description for u @@ -45696,14 +47098,14 @@ static class E var mImplementation = e.GetMember("M"); AssertEx.Equal(""" - + """, mImplementation.GetDocumentationCommentXml()); var p = extension.GetMember("P"); AssertEx.Equal(""" - + Summary for P @@ -45712,7 +47114,7 @@ static class E var pGetImplementation = e.GetMember("get_P"); AssertEx.Equal(""" - + """, pGetImplementation.GetDocumentationCommentXml()); @@ -45727,24 +47129,24 @@ static class E Summary for E - + Summary for extension block Description for T Description for t - + Summary for M Description for U Description for u - + Summary for P - + - + @@ -45753,7 +47155,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - Assert.Equal(["(T, T)", "(t, T t)", "(U, U)", "(u, U u)"], PrintXmlNameSymbols(tree, model)); + AssertEx.SequenceEqual(["(T, T)", "(t, T t)", "(U, U)", "(u, U u)"], PrintXmlNameSymbols(tree, model)); } private static IEnumerable PrintXmlNameSymbols(SyntaxTree tree, SemanticModel model) @@ -45815,7 +47217,7 @@ static class E comp.VerifyEmitDiagnostics(); var e = comp.GetMember("E"); - Assert.Equal(""" + AssertEx.Equal(""" Summary for E @@ -45824,7 +47226,7 @@ static class E var extension = e.GetTypeMembers().Single(); AssertEx.Equal(""" - + Summary for extension block Description for T Description for t @@ -45834,7 +47236,7 @@ static class E var mSkeleton = extension.GetMember("M"); AssertEx.Equal(""" - + Summary for M Description for U Description for u @@ -45845,14 +47247,14 @@ static class E var mImplementation = e.GetMember("M"); AssertEx.Equal(""" - + """, mImplementation.GetDocumentationCommentXml()); var p = extension.GetMember("P"); AssertEx.Equal(""" - + Summary for P @@ -45861,7 +47263,7 @@ static class E var pGetImplementation = e.GetMember("get_P"); AssertEx.Equal(""" - + """, pGetImplementation.GetDocumentationCommentXml()); @@ -45937,28 +47339,28 @@ static class E var mSkeleton = extension.GetMember("M"); AssertEx.Equal(""" - + """, mSkeleton.GetDocumentationCommentXml()); var mImplementation = e.GetMember("M"); AssertEx.Equal(""" - + """, mImplementation.GetDocumentationCommentXml()); var p = extension.GetMember("P"); AssertEx.Equal(""" - + """, p.GetDocumentationCommentXml()); var pGetImplementation = e.GetMember("get_P"); AssertEx.Equal(""" - + """, pGetImplementation.GetDocumentationCommentXml()); @@ -46252,7 +47654,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - Assert.Equal(["(o, System.Object o)", "(o, System.Object o)", "(o, null)"], PrintXmlNameSymbols(tree, model)); + AssertEx.SequenceEqual(["(o, System.Object o)", "(o, System.Object o)", "(o, null)"], PrintXmlNameSymbols(tree, model)); } [Fact] @@ -46339,7 +47741,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - Assert.Equal(["(T, T)", "(T, T)", "(T, T)", "(T, T)", "(T, T)"], PrintXmlNameSymbols(tree, model)); + AssertEx.SequenceEqual(["(T, T)", "(T, T)", "(T, T)", "(T, T)", "(T, T)"], PrintXmlNameSymbols(tree, model)); } [Fact] @@ -46364,7 +47766,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - Assert.Equal(["(T, null)", "(T, T)"], PrintXmlNameSymbols(tree, model)); + AssertEx.SequenceEqual(["(T, null)", "(T, T)"], PrintXmlNameSymbols(tree, model)); } [Fact] @@ -46389,13 +47791,13 @@ public void M() { } comp.GetAnalyzerDiagnostics([analyzer], null).Verify(); AssertEx.SetEqual([ - "Attr2 -> void E.<>E__0.M()", - "M -> void E.<>E__0.M()", - "Attr3 -> System.Int32 E.<>E__0.P { get; }", - "P -> System.Int32 E.<>E__0.P { get; }", - "T -> E.<>E__0", - "Attr -> E.<>E__0", - "extension -> E.<>E__0"], + "Attr2 -> void E.$8048A6C8BE30A622530249B904B537EB.M()", + "M -> void E.$8048A6C8BE30A622530249B904B537EB.M()", + "Attr3 -> System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P { get; }", + "P -> System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P { get; }", + "T -> E.$8048A6C8BE30A622530249B904B537EB", + "Attr -> E.$8048A6C8BE30A622530249B904B537EB", + "extension -> E.$8048A6C8BE30A622530249B904B537EB"], analyzer._results.ToArray()); } @@ -46458,15 +47860,15 @@ public void M(int i) { } AssertEx.SetEqual([ "E", - "E.<>E__0", - "System.Int32 E.<>E__0.P { get; }", + "E.$8048A6C8BE30A622530249B904B537EB", + "System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P { get; }", "T t", - "E.<>E__1", - "E.<>E__2", + "E.$865F3E9780C1FF12019ECA0B40816384", + "E.$C43E2675C7BBF9284AF22FB8A9BF0280", "System.Object o1", - "void E.<>E__0.M(System.Int32 i)", + "void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 i)", "System.Int32 i", - "System.Int32 E.<>E__0.P.get"], + "System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P.get"], analyzer._results.ToArray()); } @@ -46513,8 +47915,8 @@ public void M() { } comp.GetAnalyzerDiagnostics([analyzer], null).Verify(); AssertEx.SetEqual([ - "public void M() { } -> void E.<>E__0.M()", - "get { return 0; } -> System.Int32 E.<>E__0.P.get"], + "public void M() { } -> void E.$8048A6C8BE30A622530249B904B537EB.M()", + "get { return 0; } -> System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P.get"], analyzer._results.ToArray()); } @@ -46558,14 +47960,14 @@ public void M(int i) { } AssertEx.SetEqual([ "Start: E", - "Start: E.<>E__0", - "Start: void E.<>E__0.M(System.Int32 i)", - "Start: System.Int32 E.<>E__0.P { get; }", - "Start: System.Int32 E.<>E__0.P.get", - "End: System.Int32 E.<>E__0.P { get; }", - "End: System.Int32 E.<>E__0.P.get", - "End: void E.<>E__0.M(System.Int32 i)", - "End: E.<>E__0", + "Start: E.$8048A6C8BE30A622530249B904B537EB", + "Start: void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 i)", + "Start: System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P { get; }", + "Start: System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P.get", + "End: System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P { get; }", + "End: System.Int32 E.$8048A6C8BE30A622530249B904B537EB.P.get", + "End: void E.$8048A6C8BE30A622530249B904B537EB.M(System.Int32 i)", + "End: E.$8048A6C8BE30A622530249B904B537EB", "End: E"], analyzer._results.ToArray()); } diff --git a/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests2.cs b/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests2.cs index 38ae48a5f4363..527e00cba92d8 100644 --- a/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests2.cs +++ b/src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests2.cs @@ -2659,7 +2659,7 @@ namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : CompileAndVerify(comp, expectedOutput: "M 3").VerifyDiagnostics(); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PEMethodSymbol_GetUseSiteInfo() { // missing implementation method for M @@ -3030,7 +3030,7 @@ .method public hidebysig static void M () cil managed Diagnostic(ErrorCode.ERR_NoSuchMember, "M").WithArguments("int", "M").WithLocation(1, 5)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_08() { // No containing type @@ -3112,7 +3112,7 @@ .method public hidebysig static void M () cil managed Diagnostic(ErrorCode.ERR_NoSuchMember, "M").WithArguments("int", "M").WithLocation(1, 5)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_10() { // Arity mismatch between skeleton and implementation @@ -3154,7 +3154,7 @@ .method public hidebysig static void M () cil managed Diagnostic(ErrorCode.ERR_BindToBogus, "M").WithArguments("E.extension(int).M()").WithLocation(1, 5)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_11() { // Accessibility mismatch between skeleton and implementation @@ -3196,7 +3196,7 @@ .method assembly hidebysig static void M () cil managed Diagnostic(ErrorCode.ERR_BindToBogus, "M").WithArguments("E.extension(int).M()").WithLocation(1, 5)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_12() { // parameter count mismatch between skeleton and implementation @@ -3238,7 +3238,7 @@ .method public hidebysig static void M (string s) cil managed Diagnostic(ErrorCode.ERR_BindToBogus, "M").WithArguments("E.extension(int).M()").WithLocation(1, 5)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_13() { // return type mismatch between skeleton and implementation @@ -3280,7 +3280,7 @@ .method public hidebysig static int32 M () cil managed Diagnostic(ErrorCode.ERR_BindToBogus, "M").WithArguments("E.extension(int).M()").WithLocation(1, 5)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_14() { // parameter type mismatch, instance method @@ -3322,7 +3322,7 @@ .method public hidebysig static void M ( object i ) cil managed Diagnostic(ErrorCode.ERR_BindToBogus, "M").WithArguments("E.extension(int).M()").WithLocation(1, 4)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_15() { // parameter type mismatch, instance method @@ -3364,7 +3364,7 @@ .method public hidebysig static void M ( int32 i, object s ) cil managed Diagnostic(ErrorCode.ERR_BindToBogus, "M").WithArguments("E.extension(int).M(string)").WithLocation(1, 4)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_16() { // constraint mismatch between skeleton and implementation @@ -3406,7 +3406,7 @@ .method public hidebysig static void M () cil managed Diagnostic(ErrorCode.ERR_BindToBogus, "M").WithArguments("E.extension(int).M()").WithLocation(1, 5)); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_17() { // implementation is not static @@ -3675,7 +3675,7 @@ .class interface private auto ansi abstract beforefieldinit I Assert.False(comp.GetTypeByMetadataName("E").GetTypeMembers().Single().IsExtension); } - [Fact] + [Fact(Skip = "Used IL is obsolete")] // PROTOTYPE: Adjust public void PENamedTypeSymbol_23() { // parameter type mismatch, static method @@ -3765,19 +3765,19 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + - + """, e.GetDocumentationCommentXml()); - AssertEx.Equal("T:E.<>E__0", e.GetTypeMembers().Single().GetDocumentationCommentId()); + AssertEx.Equal("T:E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69", e.GetTypeMembers().Single().GetDocumentationCommentId()); var mSkeleton = comp.GetMember("E").GetTypeMembers().Single().GetMember("M"); AssertEx.Equal(""" - + @@ -3788,9 +3788,9 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(int).M(string), void E.<>E__0.M(System.String s))", + "(E.extension(int).M(string), void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M(System.String s))", "(E.M(int, string), void E.M(this System.Int32 i, System.String s))", - "(E.extension(int).M, void E.<>E__0.M(System.String s))", + "(E.extension(int).M, void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M(System.String s))", "(E.M, void E.M(this System.Int32 i, System.String s))", "(M(int, string), void E.M(this System.Int32 i, System.String s))", "(M(string), null)", @@ -3817,16 +3817,16 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); - AssertEx.Equal("T:E.<>E__0`1", e.GetTypeMembers().Single().GetDocumentationCommentId()); + AssertEx.Equal("T:E.$8048A6C8BE30A622530249B904B537EB", e.GetTypeMembers().Single().GetDocumentationCommentId()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension{T}(T).M{U}(U), void E.<>E__0.M(U u))"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension{T}(T).M{U}(U), void E.$8048A6C8BE30A622530249B904B537EB.M(U u))"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -3872,7 +3872,7 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + @@ -3881,7 +3881,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(ref int).M(), void E.<>E__0.M())", + "(E.extension(ref int).M(), void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M())", "(E.extension(int).M(), null)"], PrintXmlCrefSymbols(tree, model)); } @@ -3909,14 +3909,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M(), void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M(), void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -3952,8 +3952,8 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - - + + """, e.GetDocumentationCommentXml()); @@ -3993,14 +3993,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M(), void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M(), void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4035,7 +4035,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int, int).M(), null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int, int).M(), null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4071,7 +4071,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(.M(), null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(.M(), null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4104,7 +4104,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension().M(), null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension().M(), null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4140,7 +4140,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int, int).M(), null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int, int).M(), null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4162,14 +4162,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).P, System.Int32 E.<>E__0.P { get; })"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).P, System.Int32 E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P { get; })"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4195,14 +4195,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).P, System.Int32 E.<>E__0.P { get; })"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).P, System.Int32 E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.P { get; })"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4228,14 +4228,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(string).P, System.String E.<>E__1.P { get; })"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(string).P, System.String E.$34505F560D9EACF86A87F3ED1F85E448.P { get; })"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4257,14 +4257,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M, void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M, void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4296,7 +4296,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(string).M, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(string).M, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4318,14 +4318,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M, void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M, void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4348,14 +4348,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M, void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M, void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4379,7 +4379,7 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + @@ -4388,7 +4388,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); AssertEx.Equal([ - "(E.extension(int).M{U}, void E.<>E__0.M())", + "(E.extension(int).M{U}, void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M())", "(E.M{U}, void E.M(this System.Int32 i))"], PrintXmlCrefSymbols(tree, model)); } @@ -4423,7 +4423,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4456,7 +4456,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension{T}(int).M, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension{T}(int).M, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4478,14 +4478,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension{T}(int).M, void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension{T}(int).M, void E.$B8D310208B4544F25EEBACB9990FC73B.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4514,7 +4514,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.M, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.M, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4537,14 +4537,14 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension{U}(U).M, void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension{U}(U).M, void E.$8048A6C8BE30A622530249B904B537EB.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4580,7 +4580,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(string).P, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(string).P, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4607,7 +4607,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(string), void E.extension(System.String s))"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(string), void E.extension(System.String s))"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4642,7 +4642,7 @@ static class E var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int)., null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int)., null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4677,7 +4677,7 @@ public class Nested { } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).Nested, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).Nested, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4720,7 +4720,7 @@ interface I var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -4755,7 +4755,7 @@ public static void M() { } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(missing).M, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(missing).M, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -5004,7 +5004,7 @@ class @extension var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension, E.extension)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension, E.extension)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -5040,7 +5040,7 @@ public static void M() { } var tree = comp.SyntaxTrees.First(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(object).M, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(object).M, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -5070,14 +5070,14 @@ internal static void M() { } var c = comp.GetMember("C"); AssertEx.Equal(""" - + """, c.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(object).M, void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(object).M, void E.$C43E2675C7BBF9284AF22FB8A9BF0280.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -5114,7 +5114,7 @@ private static void M() { } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(object).M, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(object).M, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -5221,15 +5221,15 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - - + + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M, null)", "(E.extension(int).M2, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M, null)", "(E.extension(int).M2, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -5251,8 +5251,8 @@ static class E var comp2 = CreateCompilation("", references: [comp.EmitToImageReference(documentation: new TestDocumentationProvider())]); var mSkeleton = comp2.GetMember("E").GetTypeMembers().Single().GetMember("M"); - Assert.Equal("M:E.<>E__0.M", mSkeleton.GetDocumentationCommentId()); - Assert.Equal("M:E.<>E__0.M", mSkeleton.GetDocumentationCommentXml()); + AssertEx.Equal("M:E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M", mSkeleton.GetDocumentationCommentId()); + AssertEx.Equal("M:E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M", mSkeleton.GetDocumentationCommentXml()); } private class TestDocumentationProvider : DocumentationProvider @@ -5293,7 +5293,7 @@ class C var c = comp.GetMember("C"); AssertEx.Equal(""" - + """, c.GetDocumentationCommentXml()); @@ -5350,15 +5350,15 @@ static class E var e = comp.GetMember("E"); AssertEx.Equal(""" - - + + """, e.GetDocumentationCommentXml()); var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).M, null)", "(E.extension(int).M2, null)"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).M, null)", "(E.extension(int).M2, null)"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -5379,7 +5379,7 @@ public static void M() { } var tree = comp.SyntaxTrees.Single(); var model = comp.GetSemanticModel(tree); - AssertEx.Equal(["(E.extension(int).@M, void E.<>E__0.M())"], PrintXmlCrefSymbols(tree, model)); + AssertEx.SequenceEqual(["(E.extension(int).@M, void E.$BA41CFE2B5EDAEB8C1B9062F59ED4D69.M())"], PrintXmlCrefSymbols(tree, model)); } [Fact] @@ -5497,7 +5497,7 @@ static class E var mSkeleton = comp.GetMember("E").GetTypeMembers().First().GetMember("M"); AssertEx.Equal(""" - + @@ -10088,12 +10088,48 @@ static class E } """; var comp = CreateCompilation(src); - comp.VerifyEmitDiagnostics(); var e = comp.GetMember("E"); var extension = (SourceNamedTypeSymbol)e.GetTypeMembers().Single(); - Assert.Equal("extension(System.Object)", extension.ComputeExtensionGroupingRawName()); - Assert.Equal("extension(System.Object o)", extension.ComputeExtensionMarkerRawName()); + AssertEx.Equal("extension(System.Object)", extension.ComputeExtensionGroupingRawName()); + AssertEx.Equal("extension(System.Object o)", extension.ComputeExtensionMarkerRawName()); + + CompileAndVerify(comp).VerifyDiagnostics().VerifyTypeIL("E", """ +.class private auto ansi abstract sealed beforefieldinit E + extends [mscorlib]System.Object +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$C43E2675C7BBF9284AF22FB8A9BF0280' + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$119AA281C143547563250CAF89B48A76' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + object o + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$119AA281C143547563250CAF89B48A76'::'$' + } // end of class $119AA281C143547563250CAF89B48A76 + } // end of class $C43E2675C7BBF9284AF22FB8A9BF0280 +} // end of class E +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); } [Theory] @@ -10130,7 +10166,7 @@ static class E var e = comp.GetMember("E"); var extension = (SourceNamedTypeSymbol)e.GetTypeMembers().Single(); - Assert.Equal("extension(System.Object)", extension.ComputeExtensionGroupingRawName()); + AssertEx.Equal("extension(System.Object)", extension.ComputeExtensionGroupingRawName()); Assert.Equal($"extension(System.Object @{keyword})", extension.ComputeExtensionMarkerRawName()); } @@ -10165,8 +10201,8 @@ public class C3 { } var e = comp.GetMember("E"); var extension = (SourceNamedTypeSymbol)e.GetTypeMembers().Single(); - Assert.Equal("extension(N1.N2.C1/C2/C3)", extension.ComputeExtensionGroupingRawName()); - Assert.Equal("extension(N1.N2.C1.C2.C3)", extension.ComputeExtensionMarkerRawName()); + AssertEx.Equal("extension(N1.N2.C1/C2/C3)", extension.ComputeExtensionGroupingRawName()); + AssertEx.Equal("extension(N1.N2.C1.C2.C3)", extension.ComputeExtensionMarkerRawName()); } [Fact] @@ -10380,12 +10416,48 @@ static class E } """; var comp = CreateCompilation(src); - comp.VerifyEmitDiagnostics(); var e = comp.GetMember("E"); var extension = (SourceNamedTypeSymbol)e.GetTypeMembers().Single(); AssertEx.Equal("extension<>(!0)", extension.ComputeExtensionGroupingRawName()); AssertEx.Equal("extension(U)", extension.ComputeExtensionMarkerRawName()); + + CompileAndVerify(comp).VerifyDiagnostics().VerifyTypeIL("E", """ +.class private auto ansi abstract sealed beforefieldinit E + extends [mscorlib]System.Object +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$8048A6C8BE30A622530249B904B537EB'<$T0> + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$A93DBF9EBD61C29E8B5CFA979E4C33E8' + extends [mscorlib]System.Object + { + // Methods + .method private hidebysig specialname static + void '$' ( + !U '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$A93DBF9EBD61C29E8B5CFA979E4C33E8'::'$' + } // end of class $A93DBF9EBD61C29E8B5CFA979E4C33E8 + } // end of class $8048A6C8BE30A622530249B904B537EB +} // end of class E +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); } [Fact] @@ -10720,12 +10792,56 @@ static class E } """; var comp = CreateCompilation(src); - comp.VerifyEmitDiagnostics(); var extension = (SourceNamedTypeSymbol)comp.GetMember("E").GetTypeMembers().Single(); AssertEx.Equal("extension(!0)", extension.ComputeExtensionGroupingRawName()); AssertEx.Equal("extension(T) where T : unmanaged", extension.ComputeExtensionMarkerRawName()); + CompileAndVerify(comp).VerifyDiagnostics().VerifyTypeIL("E", """ +.class private auto ansi abstract sealed beforefieldinit E + extends [mscorlib]System.Object +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$BAC44226FEFE1ED1B549A4B5F35748C7' + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + .param type $T0 + .custom instance void System.Runtime.CompilerServices.IsUnmanagedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$03A00A6A168488BDF2B2E5B73B8099A6' + extends [mscorlib]System.Object + { + .param type T + .custom instance void System.Runtime.CompilerServices.IsUnmanagedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Methods + .method private hidebysig specialname static + void '$' ( + !T '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$03A00A6A168488BDF2B2E5B73B8099A6'::'$' + } // end of class $03A00A6A168488BDF2B2E5B73B8099A6 + } // end of class $BAC44226FEFE1ED1B549A4B5F35748C7 +} // end of class E +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); + var src2 = """ unsafe struct C where T : unmanaged { @@ -12386,11 +12502,55 @@ static class E interface I { } """; var comp = CreateCompilation(src); - comp.VerifyEmitDiagnostics(); var extension = (SourceNamedTypeSymbol)comp.GetMember("E").GetTypeMembers().Single(); AssertEx.Equal("extension<(I), (I), (I)>(System.Int32)", extension.ComputeExtensionGroupingRawName()); AssertEx.Equal("extension(System.Int32) where T1 : I! where T2 : I? where T3 : I", extension.ComputeExtensionMarkerRawName()); + + CompileAndVerify(comp).VerifyDiagnostics().VerifyTypeIL("E", """ +.class private auto ansi abstract sealed beforefieldinit E + extends [mscorlib]System.Object +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$0AD8C3962A3C5E6BFA97E099F6F428C4'<(I) $T0, (I) $T1, (I) $T2> + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$5B198AEBE2F597134BE1E94D84704187'<(I) T1, (I) T2, (I) T3> + extends [mscorlib]System.Object + { + .param constraint T1, I + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( + 01 00 01 00 00 + ) + .param constraint T2, I + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( + 01 00 02 00 00 + ) + // Methods + .method private hidebysig specialname static + void '$' ( + int32 '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x208e + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$5B198AEBE2F597134BE1E94D84704187'::'$' + } // end of class $5B198AEBE2F597134BE1E94D84704187 + } // end of class $0AD8C3962A3C5E6BFA97E099F6F428C4 +} // end of class E +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); } [Fact] @@ -12434,12 +12594,62 @@ class AAttribute : System.Attribute { } class BAttribute : System.Attribute { } """; var comp = CreateCompilation(src); - comp.VerifyEmitDiagnostics(); var extension = (SourceNamedTypeSymbol)comp.GetMember("E").GetTypeMembers().Single(); AssertEx.Equal("extension<>(System.Int32)", extension.ComputeExtensionGroupingRawName()); AssertEx.Equal("extension<[AAttribute/*()*/] [BAttribute/*()*/] T1>([AAttribute/*()*/] [BAttribute/*()*/] System.Int32)", extension.ComputeExtensionMarkerRawName()); + CompileAndVerify(comp).VerifyDiagnostics().VerifyTypeIL("E", """ +.class private auto ansi abstract sealed beforefieldinit E + extends [mscorlib]System.Object +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested public auto ansi sealed specialname '$B8D310208B4544F25EEBACB9990FC73B'<$T0> + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( + 01 00 00 00 + ) + // Nested Types + .class nested private auto ansi abstract sealed specialname '$D131137B02074799BD78183FB29034EC' + extends [mscorlib]System.Object + { + .param type T1 + .custom instance void AAttribute::.ctor() = ( + 01 00 00 00 + ) + .custom instance void BAttribute::.ctor() = ( + 01 00 00 00 + ) + // Methods + .method private hidebysig specialname static + void '$' ( + int32 '' + ) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( + 01 00 00 00 + ) + .param [1] + .custom instance void AAttribute::.ctor() = ( + 01 00 00 00 + ) + .custom instance void BAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x2067 + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method '$D131137B02074799BD78183FB29034EC'::'$' + } // end of class $D131137B02074799BD78183FB29034EC + } // end of class $B8D310208B4544F25EEBACB9990FC73B +} // end of class E +""".Replace("[mscorlib]", ExecutionConditionUtil.IsMonoOrCoreClr ? "[netstandard]" : "[mscorlib]")); + src = """ static class E { @@ -13926,7 +14136,7 @@ .method public hidebysig specialname rtspecialname instance void .ctor () cil ma comp.VerifyEmitDiagnostics(); var field = comp.GetMember("C").GetField("field"); - AssertEx.Equal(["System.Int32", "System.String", "System.Int64"], field.TypeWithAnnotations.CustomModifiers.SelectAsArray(m => m.Modifier.ToTestDisplayString())); + AssertEx.SequenceEqual(["System.Int32", "System.String", "System.Int64"], field.TypeWithAnnotations.CustomModifiers.SelectAsArray(m => m.Modifier.ToTestDisplayString())); } [Fact] diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IBinaryOperatorExpression.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IBinaryOperatorExpression.cs index 01c3f3a5ea609..1fd839ea03548 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IBinaryOperatorExpression.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IBinaryOperatorExpression.cs @@ -8305,7 +8305,7 @@ static class Extensions string expectedOperationTree = @" -IBinaryOperation (BinaryOperatorKind.Add) (OperatorMethod: C Extensions.<>E__0.op_Addition(C c1, C c2)) (OperationKind.Binary, Type: C) (Syntax: 'x + y') +IBinaryOperation (BinaryOperatorKind.Add) (OperatorMethod: C Extensions.$9794DAFCCB9E752B29BFD6350ADA77F2.op_Addition(C c1, C c2)) (OperationKind.Binary, Type: C) (Syntax: 'x + y') Left: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: C) (Syntax: 'x') Right: @@ -8342,7 +8342,7 @@ static class Extensions string expectedOperationTree = @" -IBinaryOperation (BinaryOperatorKind.ConditionalOr) (OperatorMethod: C Extensions.<>E__0.op_BitwiseOr(C x, C y)) (OperationKind.Binary, Type: C) (Syntax: 'x || y') +IBinaryOperation (BinaryOperatorKind.ConditionalOr) (OperatorMethod: C Extensions.$9794DAFCCB9E752B29BFD6350ADA77F2.op_BitwiseOr(C x, C y)) (OperationKind.Binary, Type: C) (Syntax: 'x || y') Left: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: C) (Syntax: 'x') Right: @@ -8488,7 +8488,7 @@ static class Extensions Left: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'GetArray()[0]') Right: - IBinaryOperation (BinaryOperatorKind.Add) (OperatorMethod: System.Int32 Extensions.<>E__0.op_Addition(C c1, C c2)) (OperationKind.Binary, Type: System.Int32) (Syntax: '(a ?? b) + (a ?? b)') + IBinaryOperation (BinaryOperatorKind.Add) (OperatorMethod: System.Int32 Extensions.$9794DAFCCB9E752B29BFD6350ADA77F2.op_Addition(C c1, C c2)) (OperationKind.Binary, Type: System.Int32) (Syntax: '(a ?? b) + (a ?? b)') Left: IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'a ?? b') Right: @@ -8559,7 +8559,7 @@ static class Extensions IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: C) (Syntax: 'a') Jump if False (Regular) to Block[B4] - IUnaryOperation (UnaryOperatorKind.True) (OperatorMethod: System.Boolean Extensions.<>E__0.op_True(C c)) (OperationKind.Unary, Type: System.Boolean, IsImplicit) (Syntax: 'a') + IUnaryOperation (UnaryOperatorKind.True) (OperatorMethod: System.Boolean Extensions.$9794DAFCCB9E752B29BFD6350ADA77F2.op_True(C c)) (OperationKind.Unary, Type: System.Boolean, IsImplicit) (Syntax: 'a') Operand: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'a') @@ -8578,7 +8578,7 @@ static class Extensions Statements (1) IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'a || b') Value: - IBinaryOperation (BinaryOperatorKind.Or) (OperatorMethod: C Extensions.<>E__0.op_BitwiseOr(C x, C y)) (OperationKind.Binary, Type: C) (Syntax: 'a || b') + IBinaryOperation (BinaryOperatorKind.Or) (OperatorMethod: C Extensions.$9794DAFCCB9E752B29BFD6350ADA77F2.op_BitwiseOr(C x, C y)) (OperationKind.Binary, Type: C) (Syntax: 'a || b') Left: IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'a') Right: diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_ICompoundAssignmentOperation.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_ICompoundAssignmentOperation.cs index 8ca61745c7bc6..36539af169532 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_ICompoundAssignmentOperation.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_ICompoundAssignmentOperation.cs @@ -1829,7 +1829,7 @@ static class Extensions } "; string expectedOperationTree = @" -ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: CustomType Extensions.<>E__0.op_Addition(CustomType x, System.Int32 y)) (OperationKind.CompoundAssignment, Type: CustomType) (Syntax: 'x += 1') +ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: CustomType Extensions.$9F7826FAF592F1266BEA2CA4AC24ECDD.op_Addition(CustomType x, System.Int32 y)) (OperationKind.CompoundAssignment, Type: CustomType) (Syntax: 'x += 1') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Left: @@ -1870,7 +1870,7 @@ static class Extensions " + CompilerFeatureRequiredAttribute; string expectedOperationTree = @" -ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: void Extensions.<>E__0.op_AdditionAssignment(System.Int32 y)) (OperationKind.CompoundAssignment, Type: CustomType) (Syntax: 'x += 1') +ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: void Extensions.$9F7826FAF592F1266BEA2CA4AC24ECDD.op_AdditionAssignment(System.Int32 y)) (OperationKind.CompoundAssignment, Type: CustomType) (Syntax: 'x += 1') InConversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Left: @@ -1911,7 +1911,7 @@ static class Extensions " + CompilerFeatureRequiredAttribute; string expectedOperationTree = @" -ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: void Extensions.<>E__0.op_AdditionAssignment(System.Int32 y)) (OperationKind.CompoundAssignment, Type: CustomType) (Syntax: 'x += 1') +ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.op_AdditionAssignment(System.Int32 y)) (OperationKind.CompoundAssignment, Type: CustomType) (Syntax: 'x += 1') InConversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Left: @@ -2057,7 +2057,7 @@ static class Extensions Statements (1) IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'a[x ?? y] += b ?? c;') Expression: - ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: S1 Extensions.<>E__0.op_Addition(S1 x, System.Int32 i)) (OperationKind.CompoundAssignment, Type: S1) (Syntax: 'a[x ?? y] += b ?? c') + ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: S1 Extensions.$78CFE6F93D970DBBE44B05C24FFEB91E.op_Addition(S1 x, System.Int32 i)) (OperationKind.CompoundAssignment, Type: S1) (Syntax: 'a[x ?? y] += b ?? c') InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Left: @@ -2209,7 +2209,7 @@ static class Extensions Statements (1) IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'a[x ?? y] += b ?? c;') Expression: - ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: void Extensions.<>E__0.op_AdditionAssignment(System.Int32 i)) (OperationKind.CompoundAssignment, Type: System.Void) (Syntax: 'a[x ?? y] += b ?? c') + ICompoundAssignmentOperation (BinaryOperatorKind.Add) (OperatorMethod: void Extensions.$78CFE6F93D970DBBE44B05C24FFEB91E.op_AdditionAssignment(System.Int32 i)) (OperationKind.CompoundAssignment, Type: System.Void) (Syntax: 'a[x ?? y] += b ?? c') InConversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) Left: diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IIncrementOrDecrementOperation.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IIncrementOrDecrementOperation.cs index 236b4a68d3008..1c3f054c580aa 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IIncrementOrDecrementOperation.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IIncrementOrDecrementOperation.cs @@ -249,7 +249,7 @@ static class Extensions } "; string expectedOperationTree = @" -IIncrementOrDecrementOperation (Prefix) (OperatorMethod: CustomType Extensions.<>E__0.op_Decrement(CustomType x)) (OperationKind.Decrement, Type: CustomType) (Syntax: '--x') +IIncrementOrDecrementOperation (Prefix) (OperatorMethod: CustomType Extensions.$9F7826FAF592F1266BEA2CA4AC24ECDD.op_Decrement(CustomType x)) (OperationKind.Decrement, Type: CustomType) (Syntax: '--x') Target: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: CustomType) (Syntax: 'x') "; @@ -286,7 +286,7 @@ static class Extensions " + CompilerFeatureRequiredAttribute; string expectedOperationTree = @" -IIncrementOrDecrementOperation (Prefix) (OperatorMethod: void Extensions.<>E__0.op_DecrementAssignment()) (OperationKind.Decrement, Type: CustomType) (Syntax: '--x') +IIncrementOrDecrementOperation (Prefix) (OperatorMethod: void Extensions.$9F7826FAF592F1266BEA2CA4AC24ECDD.op_DecrementAssignment()) (OperationKind.Decrement, Type: CustomType) (Syntax: '--x') Target: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: CustomType) (Syntax: 'x') "; @@ -323,7 +323,7 @@ static class Extensions " + CompilerFeatureRequiredAttribute; string expectedOperationTree = @" -IIncrementOrDecrementOperation (Prefix) (OperatorMethod: void Extensions.<>E__0.op_DecrementAssignment()) (OperationKind.Decrement, Type: CustomType) (Syntax: '--x') +IIncrementOrDecrementOperation (Prefix) (OperatorMethod: void Extensions.$C43E2675C7BBF9284AF22FB8A9BF0280.op_DecrementAssignment()) (OperationKind.Decrement, Type: CustomType) (Syntax: '--x') Target: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: CustomType) (Syntax: 'x') "; @@ -406,7 +406,7 @@ static class Extensions Statements (1) IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: '(x ?? y).i++;') Expression: - IIncrementOrDecrementOperation (Postfix) (OperatorMethod: S1 Extensions.<>E__0.op_Increment(S1 x)) (OperationKind.Increment, Type: S1) (Syntax: '(x ?? y).i++') + IIncrementOrDecrementOperation (Postfix) (OperatorMethod: S1 Extensions.$78CFE6F93D970DBBE44B05C24FFEB91E.op_Increment(S1 x)) (OperationKind.Increment, Type: S1) (Syntax: '(x ?? y).i++') Target: IFieldReferenceOperation: S1 C.D.i (OperationKind.FieldReference, Type: S1) (Syntax: '(x ?? y).i') Instance Receiver: @@ -494,7 +494,7 @@ static class Extensions Statements (1) IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: '(x ?? y).i++;') Expression: - IIncrementOrDecrementOperation (Postfix) (OperatorMethod: void Extensions.<>E__0.op_IncrementAssignment()) (OperationKind.Increment, Type: System.Void) (Syntax: '(x ?? y).i++') + IIncrementOrDecrementOperation (Postfix) (OperatorMethod: void Extensions.$78CFE6F93D970DBBE44B05C24FFEB91E.op_IncrementAssignment()) (OperationKind.Increment, Type: System.Void) (Syntax: '(x ?? y).i++') Target: IFieldReferenceOperation: S1 C.D.i (OperationKind.FieldReference, Type: S1) (Syntax: '(x ?? y).i') Instance Receiver: diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IUnaryOperatorExpression.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IUnaryOperatorExpression.cs index ab285d66c1bb7..762c36dc8dd8a 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IUnaryOperatorExpression.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IUnaryOperatorExpression.cs @@ -3717,7 +3717,7 @@ static class Extensions } "; string expectedOperationTree = @" -IUnaryOperation (UnaryOperatorKind.Minus) (OperatorMethod: CustomType Extensions.<>E__0.op_UnaryNegation(CustomType x)) (OperationKind.Unary, Type: CustomType) (Syntax: '-Method()') +IUnaryOperation (UnaryOperatorKind.Minus) (OperatorMethod: CustomType Extensions.$9F7826FAF592F1266BEA2CA4AC24ECDD.op_UnaryNegation(CustomType x)) (OperationKind.Unary, Type: CustomType) (Syntax: '-Method()') Operand: IInvocationOperation ( CustomType A.Method()) (OperationKind.Invocation, Type: CustomType) (Syntax: 'Method()') Instance Receiver: @@ -3764,7 +3764,7 @@ static class Extensions Predecessors: [B0] Statements (0) Next (Return) Block[B2] - IUnaryOperation (UnaryOperatorKind.Not) (OperatorMethod: CustomType Extensions.<>E__0.op_LogicalNot(CustomType x)) (OperationKind.Unary, Type: CustomType) (Syntax: '!f') + IUnaryOperation (UnaryOperatorKind.Not) (OperatorMethod: CustomType Extensions.$9F7826FAF592F1266BEA2CA4AC24ECDD.op_LogicalNot(CustomType x)) (OperationKind.Unary, Type: CustomType) (Syntax: '!f') Operand: IParameterReferenceOperation: f (OperationKind.ParameterReference, Type: CustomType) (Syntax: 'f') Block[B2] - Exit diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs index 93d304d2e2f8a..8710c3c0702d5 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs @@ -646,6 +646,7 @@ public void AllWellKnownTypes() case WellKnownType.System_Runtime_InteropServices_MemoryMarshal: case WellKnownType.System_Runtime_CompilerServices_Unsafe: case WellKnownType.System_Runtime_CompilerServices_ParamCollectionAttribute: + case WellKnownType.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute: // Not yet in the platform. continue; case WellKnownType.Microsoft_CodeAnalysis_Runtime_Instrumentation: @@ -1022,6 +1023,7 @@ public void AllWellKnownTypeMembers() case WellKnownMember.System_Runtime_CompilerServices_Unsafe__AsRef_T: case WellKnownMember.System_Runtime_CompilerServices_RequiresLocationAttribute__ctor: case WellKnownMember.System_Runtime_CompilerServices_ParamCollectionAttribute__ctor: + case WellKnownMember.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute__ctor: // Not yet in the platform. continue; case WellKnownMember.Microsoft_CodeAnalysis_Runtime_Instrumentation__CreatePayloadForMethodsSpanningSingleFile: diff --git a/src/Compilers/Core/Portable/CodeGen/PrivateImplementationDetails.cs b/src/Compilers/Core/Portable/CodeGen/PrivateImplementationDetails.cs index 3c820cdd06a80..79be747107d67 100644 --- a/src/Compilers/Core/Portable/CodeGen/PrivateImplementationDetails.cs +++ b/src/Compilers/Core/Portable/CodeGen/PrivateImplementationDetails.cs @@ -582,7 +582,7 @@ private static string ConstantsToHex(ImmutableArray constants) return HashToHex(hash.AsSpan()); } - private static string HashToHex(ReadOnlySpan hash) + public static string HashToHex(ReadOnlySpan hash) { #if NET9_0_OR_GREATER return string.Create(hash.Length * 2, hash, (destination, hash) => toHex(hash, destination)); @@ -1013,6 +1013,8 @@ public sealed override void Dispatch(Cci.MetadataVisitor visitor) public sealed override Cci.INestedTypeDefinition AsNestedTypeDefinition(EmitContext context) => this; public sealed override Cci.INestedTypeReference AsNestedTypeReference => this; + + bool Cci.INestedTypeReference.InheritsEnclosingTypeTypeParameters => true; } /// diff --git a/src/Compilers/Core/Portable/InternalUtilities/MultiDictionary.cs b/src/Compilers/Core/Portable/InternalUtilities/MultiDictionary.cs index 4dbc9950c386b..f78c87f326169 100644 --- a/src/Compilers/Core/Portable/InternalUtilities/MultiDictionary.cs +++ b/src/Compilers/Core/Portable/InternalUtilities/MultiDictionary.cs @@ -231,9 +231,10 @@ public MultiDictionary() _dictionary = new Dictionary(); } - public MultiDictionary(IEqualityComparer comparer) + public MultiDictionary(IEqualityComparer comparer, IEqualityComparer? valueComparer = null) { _dictionary = new Dictionary(comparer); + _valueComparer = valueComparer; } public void EnsureCapacity(int capacity) diff --git a/src/Compilers/Core/Portable/MetadataReader/PEModule.cs b/src/Compilers/Core/Portable/MetadataReader/PEModule.cs index 4907ad63b37d0..386459f467e3f 100644 --- a/src/Compilers/Core/Portable/MetadataReader/PEModule.cs +++ b/src/Compilers/Core/Portable/MetadataReader/PEModule.cs @@ -1054,6 +1054,11 @@ internal bool HasDefaultMemberAttribute(EntityHandle token, out string memberNam return HasStringValuedAttribute(token, AttributeDescription.DefaultMemberAttribute, out memberName); } + internal bool HasExtensionMarkerNameAttribute(EntityHandle token, out string markerName) + { + return HasStringValuedAttribute(token, AttributeDescription.ExtensionMarkerNameAttribute, out markerName); + } + internal bool HasGuidAttribute(EntityHandle token, out string guidValue) { return HasStringValuedAttribute(token, AttributeDescription.GuidAttribute, out guidValue); diff --git a/src/Compilers/Core/Portable/PEWriter/InheritedTypeParameter.cs b/src/Compilers/Core/Portable/PEWriter/InheritedTypeParameter.cs index a90fc8b2212b8..27114d6571144 100644 --- a/src/Compilers/Core/Portable/PEWriter/InheritedTypeParameter.cs +++ b/src/Compilers/Core/Portable/PEWriter/InheritedTypeParameter.cs @@ -33,7 +33,7 @@ public ITypeDefinition DefiningType #region IGenericParameter Members - public IEnumerable GetConstraints(EmitContext context) + public virtual IEnumerable GetConstraints(EmitContext context) { return _parentParameter.GetConstraints(context); } @@ -199,7 +199,7 @@ public IPointerTypeReference? AsPointerTypeReference CodeAnalysis.Symbols.ISymbolInternal? Cci.IReference.GetInternalSymbol() => null; - public IEnumerable GetAttributes(EmitContext context) + public virtual IEnumerable GetAttributes(EmitContext context) { return _parentParameter.GetAttributes(context); } @@ -253,7 +253,7 @@ public ushort Index #region INamedEntity Members - public string? Name + public virtual string? Name { get { return _parentParameter.Name; } } diff --git a/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs b/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs index 0b055e9a24e50..d62e1864b8982 100644 --- a/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs +++ b/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs @@ -534,7 +534,7 @@ protected virtual void OnIndicesCreated() protected IEnumerable GetConsolidatedTypeParameters(ITypeDefinition typeDef) { INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(Context); - if (nestedTypeDef == null) + if (nestedTypeDef == null || !nestedTypeDef.InheritsEnclosingTypeTypeParameters) { if (typeDef.IsGeneric) { @@ -544,44 +544,44 @@ protected IEnumerable GetConsolidatedTypeParameters(IType return null; } - return this.GetConsolidatedTypeParameters(typeDef, typeDef); - } + return getConsolidatedTypeParameters(typeDef, typeDef); - private List GetConsolidatedTypeParameters(ITypeDefinition typeDef, ITypeDefinition owner) - { - List result = null; - INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(Context); - if (nestedTypeDef != null) + List getConsolidatedTypeParameters(ITypeDefinition typeDef, ITypeDefinition owner) { - result = this.GetConsolidatedTypeParameters(nestedTypeDef.ContainingTypeDefinition, owner); - } - - if (typeDef.GenericParameterCount > 0) - { - ushort index = 0; - if (result == null) - { - result = new List(); - } - else + List result = null; + INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(Context); + if (nestedTypeDef != null && nestedTypeDef.InheritsEnclosingTypeTypeParameters) { - index = (ushort)result.Count; + result = getConsolidatedTypeParameters(nestedTypeDef.ContainingTypeDefinition, owner); } - if (typeDef == owner && index == 0) - { - result.AddRange(typeDef.GenericParameters); - } - else + if (typeDef.GenericParameterCount > 0) { - foreach (IGenericTypeParameter genericParameter in typeDef.GenericParameters) + ushort index = 0; + if (result == null) + { + result = new List(); + } + else { - result.Add(new InheritedTypeParameter(index++, owner, genericParameter)); + index = (ushort)result.Count; + } + + if (typeDef == owner && index == 0) + { + result.AddRange(typeDef.GenericParameters); + } + else + { + foreach (IGenericTypeParameter genericParameter in typeDef.GenericParameters) + { + result.Add(new InheritedTypeParameter(index++, owner, genericParameter)); + } } } - } - return result; + return result; + } } protected ImmutableArray GetParametersToEmit(IMethodDefinition methodDef) @@ -4135,7 +4135,7 @@ private void SerializeCustomModifiers(CustomModifiersEncoder encoder, ImmutableA private int GetNumberOfInheritedTypeParameters(ITypeReference type) { INestedTypeReference nestedType = type.AsNestedTypeReference; - if (nestedType == null) + if (nestedType == null || !nestedType.InheritsEnclosingTypeTypeParameters) { return 0; } @@ -4152,6 +4152,12 @@ private int GetNumberOfInheritedTypeParameters(ITypeReference type) while (nestedType != null) { result += nestedType.GenericParameterCount; + + if (!nestedType.InheritsEnclosingTypeTypeParameters) + { + return result; + } + type = nestedType.GetContainingType(Context); nestedType = type.AsNestedTypeReference; } diff --git a/src/Compilers/Core/Portable/PEWriter/Types.cs b/src/Compilers/Core/Portable/PEWriter/Types.cs index 4a842e9521f60..acc263c610007 100644 --- a/src/Compilers/Core/Portable/PEWriter/Types.cs +++ b/src/Compilers/Core/Portable/PEWriter/Types.cs @@ -325,6 +325,11 @@ internal interface INestedTypeDefinition : INamedTypeDefinition, ITypeDefinition /// internal interface INestedTypeReference : INamedTypeReference, ITypeMemberReference { + /// + /// When true, the type inherits type parameters from the enclosing type. + /// Note, does not include count of the inherited type parameters. + /// + bool InheritsEnclosingTypeTypeParameters { get; } } /// diff --git a/src/Compilers/Core/Portable/Symbols/Attributes/AttributeDescription.cs b/src/Compilers/Core/Portable/Symbols/Attributes/AttributeDescription.cs index 6b16eac1db4e2..f223439447254 100644 --- a/src/Compilers/Core/Portable/Symbols/Attributes/AttributeDescription.cs +++ b/src/Compilers/Core/Portable/Symbols/Attributes/AttributeDescription.cs @@ -491,5 +491,6 @@ static AttributeDescription() internal static readonly AttributeDescription CollectionBuilderAttribute = new AttributeDescription("System.Runtime.CompilerServices", "CollectionBuilderAttribute", s_signaturesOfCollectionBuilderAttribute); internal static readonly AttributeDescription OverloadResolutionPriorityAttribute = new AttributeDescription("System.Runtime.CompilerServices", "OverloadResolutionPriorityAttribute", s_signatures_HasThis_Void_Int32_Only); internal static readonly AttributeDescription CompilerLoweringPreserveAttribute = new AttributeDescription("System.Runtime.CompilerServices", "CompilerLoweringPreserveAttribute", s_signatures_HasThis_Void_Only); + internal static readonly AttributeDescription ExtensionMarkerNameAttribute = new AttributeDescription("System.Runtime.CompilerServices", "ExtensionMarkerNameAttribute", s_signatures_HasThis_Void_String_Only); } } diff --git a/src/Compilers/Core/Portable/Text/SourceText.cs b/src/Compilers/Core/Portable/Text/SourceText.cs index 01a6cd19999d4..4f24c11094df4 100644 --- a/src/Compilers/Core/Portable/Text/SourceText.cs +++ b/src/Compilers/Core/Portable/Text/SourceText.cs @@ -650,15 +650,7 @@ ImmutableArray computeContentHash() { var shortSpan = MemoryMarshal.Cast(charSpan); -#if NET8_0_OR_GREATER - // Defer to the platform to do the reversal. It ships with a vectorized - // implementation for this on .NET 8 and above. - BinaryPrimitives.ReverseEndianness(source: shortSpan, destination: shortSpan); -#else - // Otherwise, fallback to the simple approach of reversing each pair of bytes. - for (var i = 0; i < shortSpan.Length; i++) - shortSpan[i] = BinaryPrimitives.ReverseEndianness(shortSpan[i]); -#endif + ReverseEndianness(shortSpan); } hash.Append(MemoryMarshal.AsBytes(charSpan)); @@ -680,6 +672,19 @@ ImmutableArray computeContentHash() } } + internal static void ReverseEndianness(Span shortSpan) + { +#if NET8_0_OR_GREATER + // Defer to the platform to do the reversal. It ships with a vectorized + // implementation for this on .NET 8 and above. + BinaryPrimitives.ReverseEndianness(source: shortSpan, destination: shortSpan); +#else + // Otherwise, fallback to the simple approach of reversing each pair of bytes. + for (var i = 0; i < shortSpan.Length; i++) + shortSpan[i] = BinaryPrimitives.ReverseEndianness(shortSpan[i]); +#endif + } + internal static ImmutableArray CalculateChecksum(byte[] buffer, int offset, int count, SourceHashAlgorithm algorithmId) { using (var algorithm = CryptographicHashProvider.TryGetAlgorithm(algorithmId)) diff --git a/src/Compilers/Core/Portable/WellKnownMember.cs b/src/Compilers/Core/Portable/WellKnownMember.cs index c3c78f3858415..c4a4da5fed52d 100644 --- a/src/Compilers/Core/Portable/WellKnownMember.cs +++ b/src/Compilers/Core/Portable/WellKnownMember.cs @@ -623,6 +623,7 @@ internal enum WellKnownMember System_Collections_Generic_List_T__AddRange, System_Runtime_CompilerServices_ParamCollectionAttribute__ctor, + System_Runtime_CompilerServices_ExtensionMarkerNameAttribute__ctor, System_Linq_Enumerable__ToList, System_Linq_Enumerable__ToArray, diff --git a/src/Compilers/Core/Portable/WellKnownMembers.cs b/src/Compilers/Core/Portable/WellKnownMembers.cs index c3911dbb361d0..d99119d2f2883 100644 --- a/src/Compilers/Core/Portable/WellKnownMembers.cs +++ b/src/Compilers/Core/Portable/WellKnownMembers.cs @@ -4338,6 +4338,14 @@ static WellKnownMembers() 0, // Method Signature (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_Void, // Return Type + // System_Runtime_CompilerServices_ExtensionMarkerNameAttribute__ctor + (byte)MemberFlags.Constructor, // Flags + (byte)WellKnownType.ExtSentinel, (byte)(WellKnownType.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute - WellKnownType.ExtSentinel), // DeclaringTypeId + 0, // Arity + 1, // Method Signature + (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_Void, // Return Type + (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_String, + // System_Linq_Enumerable__ToList (byte)(MemberFlags.Method | MemberFlags.Static), // Flags (byte)WellKnownType.System_Linq_Enumerable, // DeclaringTypeId @@ -5732,6 +5740,7 @@ static WellKnownMembers() "Empty", // System_Collections_Immutable_ImmutableArray_T__Empty "AddRange", // System_Collections_Generic_List_T__AddRange ".ctor", // System_Runtime_CompilerServices_ParamCollectionAttribute__ctor + ".ctor", // System_Runtime_CompilerServices_ExtensionMarkerNameAttribute__ctor "ToList", // System_Linq_Enumerable__ToList "ToArray", // System_Linq_Enumerable__ToArray "ArrayIndex", // System_Linq_Expressions_Expression__ArrayIndex_Expression_Expression diff --git a/src/Compilers/Core/Portable/WellKnownTypes.cs b/src/Compilers/Core/Portable/WellKnownTypes.cs index bf210b97a1ec2..e04a5408dd55d 100644 --- a/src/Compilers/Core/Portable/WellKnownTypes.cs +++ b/src/Compilers/Core/Portable/WellKnownTypes.cs @@ -336,6 +336,7 @@ internal enum WellKnownType System_Runtime_CompilerServices_Unsafe, System_Runtime_CompilerServices_ParamCollectionAttribute, + System_Runtime_CompilerServices_ExtensionMarkerNameAttribute, System_Linq_Expressions_BinaryExpression, System_Linq_Expressions_MethodCallExpression, @@ -679,6 +680,7 @@ internal static class WellKnownTypes "System.Runtime.CompilerServices.Unsafe", "System.Runtime.CompilerServices.ParamCollectionAttribute", + "System.Runtime.CompilerServices.ExtensionMarkerNameAttribute", "System.Linq.Expressions.BinaryExpression", "System.Linq.Expressions.MethodCallExpression", diff --git a/src/Compilers/VisualBasic/Portable/Emit/GenericNestedTypeInstanceReference.vb b/src/Compilers/VisualBasic/Portable/Emit/GenericNestedTypeInstanceReference.vb index ebbb7008ec4ad..a5760cadde66e 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/GenericNestedTypeInstanceReference.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/GenericNestedTypeInstanceReference.vb @@ -46,5 +46,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Return Nothing End Get End Property + + Private ReadOnly Property INestedTypeReferenceInheritsEnclosingTypeTypeParameters As Boolean Implements Cci.INestedTypeReference.InheritsEnclosingTypeTypeParameters + Get + Return True + End Get + End Property End Class End Namespace diff --git a/src/Compilers/VisualBasic/Portable/Emit/NamedTypeSymbolAdapter.vb b/src/Compilers/VisualBasic/Portable/Emit/NamedTypeSymbolAdapter.vb index d443dd442e4d7..59089450b1bab 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/NamedTypeSymbolAdapter.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/NamedTypeSymbolAdapter.vb @@ -136,6 +136,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property + Private ReadOnly Property INestedTypeReferenceInheritsEnclosingTypeTypeParameters As Boolean Implements INestedTypeReference.InheritsEnclosingTypeTypeParameters + Get + Return True + End Get + End Property + Private Function ITypeReferenceAsNestedTypeDefinition(context As EmitContext) As INestedTypeDefinition Implements ITypeReference.AsNestedTypeDefinition Debug.Assert(Not AdaptedNamedTypeSymbol.IsAnonymousType) Dim moduleBeingBuilt As PEModuleBuilder = DirectCast(context.Module, PEModuleBuilder) diff --git a/src/Compilers/VisualBasic/Portable/Emit/SpecializedNestedTypeReference.vb b/src/Compilers/VisualBasic/Portable/Emit/SpecializedNestedTypeReference.vb index b0685aaee1edd..0cae449ab0be4 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/SpecializedNestedTypeReference.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/SpecializedNestedTypeReference.vb @@ -60,5 +60,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Return Me End Get End Property + + Private ReadOnly Property INestedTypeReferenceInheritsEnclosingTypeTypeParameters As Boolean Implements Cci.INestedTypeReference.InheritsEnclosingTypeTypeParameters + Get + Return True + End Get + End Property End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Symbol/SymbolDisplay/SymbolDisplayTests.vb b/src/Compilers/VisualBasic/Test/Symbol/SymbolDisplay/SymbolDisplayTests.vb index 17bb426aebd2f..c3cfd130543d7 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/SymbolDisplay/SymbolDisplayTests.vb +++ b/src/Compilers/VisualBasic/Test/Symbol/SymbolDisplay/SymbolDisplayTests.vb @@ -6069,17 +6069,17 @@ static class E Dim extension = e.GetMembers().OfType(Of ITypeSymbol).Single() Assert.True(extension.IsExtension) - Assert.Equal("E.<>E__0", SymbolDisplay.ToDisplayString(extension, format)) + AssertEx.Equal("E.$119AA281C143547563250CAF89B48A76", SymbolDisplay.ToDisplayString(extension, format)) Dim parts = SymbolDisplay.ToDisplayParts(extension, format) Verify(parts, - "E.<>E__0", + "E.$119AA281C143547563250CAF89B48A76", SymbolDisplayPartKind.ClassName, SymbolDisplayPartKind.Operator, SymbolDisplayPartKind.ClassName) Dim skeletonM = extension.GetMembers("M").Single() - Assert.Equal("Public Sub E.<>E__0.M()", SymbolDisplay.ToDisplayString(skeletonM, format)) + AssertEx.Equal("Public Sub E.$119AA281C143547563250CAF89B48A76.M()", SymbolDisplay.ToDisplayString(skeletonM, format)) End Sub @@ -6125,11 +6125,11 @@ static class E ' Tracked by https://github.com/dotnet/roslyn/issues/78957 : public API, the arity should not be included in the extension type name Assert.True(extension.IsExtension) - Assert.Equal("E.<>E__0`1(Of T)", SymbolDisplay.ToDisplayString(extension, format)) + AssertEx.Equal("E.$D1693D81A12E8DED4ED68FE22D9E856F(Of T)", SymbolDisplay.ToDisplayString(extension, format)) Dim parts = SymbolDisplay.ToDisplayParts(extension, format) Verify(parts, - "E.<>E__0`1(Of T)", + "E.$D1693D81A12E8DED4ED68FE22D9E856F(Of T)", SymbolDisplayPartKind.ClassName, SymbolDisplayPartKind.Operator, SymbolDisplayPartKind.ClassName, @@ -6140,7 +6140,7 @@ static class E SymbolDisplayPartKind.Punctuation) Dim skeletonM = extension.GetMembers("M").Single() - Assert.Equal("Public Sub E.<>E__0`1(Of T).M()", SymbolDisplay.ToDisplayString(skeletonM, format)) + AssertEx.Equal("Public Sub E.$D1693D81A12E8DED4ED68FE22D9E856F(Of T).M()", SymbolDisplay.ToDisplayString(skeletonM, format)) End Sub #Region "Helpers" diff --git a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb index 99df2dab956b3..bbcded4e080c4 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb +++ b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb @@ -570,7 +570,8 @@ End Namespace WellKnownType.System_Runtime_CompilerServices_RequiresLocationAttribute, WellKnownType.System_Runtime_InteropServices_CollectionsMarshal, WellKnownType.System_Runtime_InteropServices_ImmutableCollectionsMarshal, - WellKnownType.System_Runtime_CompilerServices_ParamCollectionAttribute + WellKnownType.System_Runtime_CompilerServices_ParamCollectionAttribute, + WellKnownType.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute ' Not available on all platforms. Continue For Case WellKnownType.ExtSentinel @@ -653,7 +654,8 @@ End Namespace WellKnownType.System_Runtime_CompilerServices_RequiresLocationAttribute, WellKnownType.System_Runtime_InteropServices_CollectionsMarshal, WellKnownType.System_Runtime_InteropServices_ImmutableCollectionsMarshal, - WellKnownType.System_Runtime_CompilerServices_ParamCollectionAttribute + WellKnownType.System_Runtime_CompilerServices_ParamCollectionAttribute, + WellKnownType.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute ' Not available on all platforms. Continue For Case WellKnownType.ExtSentinel @@ -758,7 +760,8 @@ End Namespace WellKnownMember.System_Runtime_CompilerServices_MetadataUpdateOriginalTypeAttribute__ctor, WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__CreateSpanRuntimeFieldHandle, WellKnownMember.System_Runtime_CompilerServices_RequiresLocationAttribute__ctor, - WellKnownMember.System_Runtime_CompilerServices_ParamCollectionAttribute__ctor + WellKnownMember.System_Runtime_CompilerServices_ParamCollectionAttribute__ctor, + WellKnownMember.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute__ctor ' Not available yet, but will be in upcoming release. Continue For Case WellKnownMember.Microsoft_CodeAnalysis_Runtime_Instrumentation__CreatePayloadForMethodsSpanningSingleFile, @@ -969,7 +972,8 @@ End Namespace WellKnownMember.System_Runtime_CompilerServices_MetadataUpdateOriginalTypeAttribute__ctor, WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__CreateSpanRuntimeFieldHandle, WellKnownMember.System_Runtime_CompilerServices_RequiresLocationAttribute__ctor, - WellKnownMember.System_Runtime_CompilerServices_ParamCollectionAttribute__ctor + WellKnownMember.System_Runtime_CompilerServices_ParamCollectionAttribute__ctor, + WellKnownMember.System_Runtime_CompilerServices_ExtensionMarkerNameAttribute__ctor ' Not available yet, but will be in upcoming release. Continue For Case WellKnownMember.Microsoft_CodeAnalysis_Runtime_Instrumentation__CreatePayloadForMethodsSpanningSingleFile, diff --git a/src/Dependencies/Collections/Extensions/IEnumerableExtensions.cs b/src/Dependencies/Collections/Extensions/IEnumerableExtensions.cs index d35fe59339b78..8d390fdade4ba 100644 --- a/src/Dependencies/Collections/Extensions/IEnumerableExtensions.cs +++ b/src/Dependencies/Collections/Extensions/IEnumerableExtensions.cs @@ -377,6 +377,21 @@ public static ImmutableArray SelectAsArray(this IEnum return builder.ToImmutableAndFree(); } + public static ImmutableArray SelectAsArray(this IEnumerable? source, Func selector, TArg arg) + { + if (source == null) + return ImmutableArray.Empty; + + var builder = ArrayBuilder.GetInstance(); + + foreach (var element in source) + { + builder.Add(selector(element, arg)); + } + + return builder.ToImmutableAndFree(); + } + public static ImmutableArray SelectAsArray(this IReadOnlyCollection? source, Func selector) { if (source == null)