未验证 提交 7933187a 编写于 作者: J Jason Malinowski 提交者: GitHub

Merge pull request #30834 from dotnet/merges/dev16.0.x-to-master

Merge dev16.0.x to master
......@@ -953,6 +953,11 @@ protected virtual Cci.IModuleReference TranslateModule(ModuleSymbol module, Diag
}
}
if (!InjectedSymbolsAreFrozen && namedTypeSymbol.Equals(_injectedNonNullTypesAttribute))
{
EnsureNonNullTypesAttributeExists();
}
// NoPia: See if this is a type, which definition we should copy into our assembly.
Debug.Assert(namedTypeSymbol.IsDefinition);
......@@ -961,11 +966,6 @@ protected virtual Cci.IModuleReference TranslateModule(ModuleSymbol module, Diag
return _embeddedTypesManagerOpt.EmbedTypeIfNeedTo(namedTypeSymbol, fromImplements, syntaxNodeOpt, diagnostics);
}
if (!InjectedSymbolsAreFrozen && namedTypeSymbol.Equals(_injectedNonNullTypesAttribute))
{
EnsureNonNullTypesAttributeExists();
}
return namedTypeSymbol;
}
......
......@@ -51373,5 +51373,38 @@ public class EqualityComparer<T>
Assert.True(explicitOp.IsDefinition);
Assert.True(getDefault.IsDefinition);
}
[Fact]
public void AccessPropertyWithoutArguments()
{
var source1 =
@"Imports System
Imports System.Runtime.InteropServices
<Assembly: PrimaryInteropAssembly(0, 0)>
<Assembly: Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E210"")>
<ComImport()>
<Guid(""165F752D-E9C4-4F7E-B0D0-CDFD7A36E211"")>
Public Interface I
Property Value(Optional index As Object = Nothing) As Object
End Interface";
var ref1 = BasicCompilationUtils.CompileToMetadata(source1);
var source2 =
@"class C : I
{
public dynamic get_Value(object index = null) => ""Test"";
public void set_Value(object index = null, object value = null) { }
}
class Test
{
static void Main()
{
I x = new C();
System.Console.WriteLine(x.Value.Length);
}
}";
var comp = CreateCompilation(source2, new[] { ref1.WithEmbedInteropTypes(true), CSharpRef }, options: WithNonNullTypesTrue(TestOptions.ReleaseExe));
CompileAndVerify(comp, expectedOutput: "4");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册