Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson committed Mar 19, 2019
1 parent 85fe043 commit c9bd1b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ void validate(ModuleSymbol module)
Assert.True(peModule.Module.HasIsReadOnlyAttribute(((PEMethodSymbol)p4.SetMethod).Handle));

Assert.False(peModule.Module.HasIsReadOnlyAttribute(((PEPropertySymbol)p5).Handle));
Assert.False(peModule.Module.HasIsReadOnlyAttribute(((PEMethodSymbol)p1.GetMethod).Handle));
Assert.False(peModule.Module.HasIsReadOnlyAttribute(((PEMethodSymbol)p5.GetMethod).Handle));
Assert.False(peModule.Module.HasIsReadOnlyAttribute(((PEMethodSymbol)p5.SetMethod).Handle));

AssertDeclaresType(peModule, WellKnownType.System_Runtime_CompilerServices_IsReadOnlyAttribute, Accessibility.Internal);
Expand Down
19 changes: 17 additions & 2 deletions src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2078,9 +2078,24 @@ internal struct InternalStruct
var refImage = comp.EmitToImageReference(emitRefOnly);
var compWithRef = CreateEmptyCompilation("", references: new[] { MscorlibRef, refImage },
options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All));

var globalNamespace = compWithRef.SourceModule.GetReferencedAssemblySymbols().Last().GlobalNamespace;

AssertEx.Equal(
new[] { "<Module>", "InternalStruct" },
compWithRef.SourceModule.GetReferencedAssemblySymbols().Last().GlobalNamespace.GetMembers().Select(m => m.ToDisplayString()));
new[] { "<Module>", "InternalStruct", "Microsoft", "System" },
globalNamespace.GetMembers().Select(m => m.ToDisplayString()));

AssertEx.Equal(new[] { "Microsoft.CodeAnalysis" }, globalNamespace.GetMember<NamespaceSymbol>("Microsoft").GetMembers().Select(m => m.ToDisplayString()));
AssertEx.Equal(
new[] { "Microsoft.CodeAnalysis.EmbeddedAttribute" },
globalNamespace.GetMember<NamespaceSymbol>("Microsoft.CodeAnalysis").GetMembers().Select(m => m.ToDisplayString()));

AssertEx.Equal(
new[] { "System.Runtime.CompilerServices" },
globalNamespace.GetMember<NamespaceSymbol>("System.Runtime").GetMembers().Select(m => m.ToDisplayString()));
AssertEx.Equal(
new[] { "System.Runtime.CompilerServices.IsReadOnlyAttribute" },
globalNamespace.GetMember<NamespaceSymbol>("System.Runtime.CompilerServices").GetMembers().Select(m => m.ToDisplayString()));

AssertEx.Equal(
new[] { "System.Int32 InternalStruct.<P>k__BackingField", "InternalStruct..ctor()" },
Expand Down

0 comments on commit c9bd1b6

Please sign in to comment.