-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Enc pdb tests #18883
Enc pdb tests #18883
Conversation
@@ -5765,6 +5767,197 @@ static void M() | |||
|
|||
#endregion | |||
|
|||
#region Patterns | |||
|
|||
public void SyntaxOffset_Parrern() |
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.
Parrern [](start = 33, length = 7)
Typo
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.
Thanks! Fixed
|
||
public void SyntaxOffset_Parrern() | ||
{ | ||
var source = @"class C { int F(object o) { if (o is 33) { return 44; } if (o is int i) { return i; } if (o is bool) { return 1; } return 0; }}"; |
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.
if (o is int i) { return i; } [](start = 84, length = 29)
nit: It'd be better to move the pattern declaring the variable to the beginning of the body, so that it's easier to see that the offset is correct.
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.
You can also simplify the code like so:
bool F(object o) => o is int i && o is 3 && o is bool;
In reply to: 113005390 [](ancestors = 113005390)
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.
OK. Thanks!
[Fact] | ||
public void SyntaxOffset_TupleVarDefined() | ||
{ | ||
var source = @"class C { int F() { var x = (1, 2); ; return x.Item1 + x.Item2; } }"; |
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.
; [](start = 62, length = 3)
nit: extra ;
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.
Thanks!
[Fact] | ||
public void SyntaxOffset_TupleIgnoreDeconstructionIfVariableDeclared() | ||
{ | ||
var source = @"class C { int F() { (int x, int y) a = (1, 2); ; return a.Item1 + a.Item2; } }"; |
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.
; [](start = 74, length = 1)
nit: extra ;
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.
Thanks!
[Fact] | ||
public void SyntaxOffset_TupleDeconstruction() | ||
{ | ||
var source = @"class C { int F() { (int a, (int b, int c)) = (1, (2, 3)); return a + b + c; } }"; |
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.
int b [](start = 56, length = 5)
Perhaps replace int b
with _ so that we have coverage of discard as well.
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.
OK. Let us try. Thanks!
Signed off by @tmat. Tests passed except optional ones permanently failed due to unrelated configuration issues. |
@ivanbasov Test-only fix, no approval required. |
Customer scenario
PDB tests are part of implementation of supporting C# 7.0 features in ENC..
Bugs this fixes:
Contributes to all issues mentioned in # #12435, #12436.
Workarounds, if any
none
Risk
low
Performance impact
N/A
Is this a regression from a previous update?
No
Root cause analysis:
N/A
How was the bug found?
Planned