-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Support abstract methods and records in complete statement command #48128
Changes from all commits
b0e0b81
8abe812
f5b2665
ce97cf1
63dec08
24538b2
60813c5
ba0caa3
1303a00
4a71491
62b40d0
8f022fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,11 +42,16 @@ internal static int MethodM(int a, int b) | |
#region ParameterList | ||
|
||
[WpfTheory, Trait(Traits.Feature, Traits.Features.CompleteStatement)] | ||
[InlineData("extern void M(object o$$)", "extern void M(object o)")] | ||
[InlineData("partial void M(object o$$)", "partial void M(object o)")] | ||
[InlineData("abstract void M(object o$$)", "abstract void M(object o)")] | ||
[InlineData("abstract void M($$object o)", "abstract void M(object o)")] | ||
[InlineData("abstract void M(object o = default(object$$))", "abstract void M(object o = default(object))")] | ||
[InlineData("abstract void M(object o = default($$object))", "abstract void M(object o = default(object))")] | ||
[InlineData("abstract void M(object o = $$default(object))", "abstract void M(object o = default(object))")] | ||
[InlineData("public record C(int X, $$int Y)", "public record C(int X, int Y)")] | ||
[InlineData("public record C(int X, int$$ Y)", "public record C(int X, int Y)")] | ||
[InlineData("public record C(int X, int Y$$)", "public record C(int X, int Y)")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i see tests added for records, but nothing new for the 'abstract method' code you added. do we need tests for that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @CyrusNajmabadi Abstract methods already have tests. But the test was disabled. I added record tests (in addition to the existing for abstract methods), and enabled the test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok! |
||
public void ParameterList_CouldBeHandled(string signature, string expectedSignature) | ||
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
var code = $@" | ||
|
@@ -61,16 +66,33 @@ public class Class1 | |
{expectedSignature};$$ | ||
}}"; | ||
|
||
// These cases are not currently handled. If support is added in the future, 'expected' should be correct. | ||
_ = expected; | ||
VerifyNoSpecialSemicolonHandling(code); | ||
VerifyTypingSemicolon(code, expected); | ||
} | ||
|
||
[WpfFact, Trait(Traits.Feature, Traits.Features.CompleteStatement)] | ||
public void ParameterList_InterfaceMethod() | ||
{ | ||
var code = @" | ||
public interface I | ||
{ | ||
public void M(object o$$) | ||
}"; | ||
|
||
var expected = @" | ||
public interface I | ||
{ | ||
public void M(object o);$$ | ||
}"; | ||
|
||
VerifyTypingSemicolon(code, expected); | ||
} | ||
|
||
[WpfTheory, Trait(Traits.Feature, Traits.Features.CompleteStatement)] | ||
[InlineData("void M$$(object o)")] | ||
[InlineData("void Me$$thod(object o)")] | ||
[InlineData("void Method(object o$$")] | ||
[InlineData("void Method($$object o")] | ||
[InlineData("partial void Method($$object o) { }")] | ||
public void ParameterList_NotHandled(string signature) | ||
{ | ||
var code = $@" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ Is there any harm in making this unconditional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Note that
partial
methods also can be declared without a body.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sharwell I think it will unnecessarily move the caret to the end for typos, which can be annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good case. Going to fix it and add a test.