Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial properties: merging declarations and emit of simple cases #72999

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address feedback
RikkiGibson committed Apr 26, 2024
commit 038e6d3362f8d938376bc821ffc5fe00f9f956d0
Original file line number Diff line number Diff line change
@@ -304,7 +304,7 @@ partial class C
[Fact]
public void AccessorKind_01()
{
// set vs init
// definition has set but implementation has init
var source = """
partial class C
{
@@ -318,6 +318,23 @@ partial class C
);
}

[Fact]
public void AccessorKind_02()
{
// definition has init but implementation has set
var source = """
partial class C
{
partial int P { get; init; }
partial int P { get => throw null!; set { } }
}
""";
// PROTOTYPE(partial-properties): give an error diagnostic for an accessor kind difference
var comp = CreateCompilation([source, IsExternalInitTypeDefinition]);
comp.VerifyEmitDiagnostics(
);
}

[Fact]
public void Extern_01()
{
@@ -333,6 +350,11 @@ partial class C
var comp = CreateCompilation([source, IsExternalInitTypeDefinition]);
comp.VerifyEmitDiagnostics(
);

var prop = comp.GetMember<SourcePropertySymbol>("C.P");
// PROTOTYPE(partial-properties): a partial method definition should delegate to its implementation part to implement this API, i.e. return 'true' here
Assert.False(prop.GetPublicSymbol().IsExtern);
Assert.True(prop.PartialImplementationPart!.GetPublicSymbol().IsExtern);
}

[Fact]