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

Enc pdb tests #18883

Merged
merged 4 commits into from
Apr 25, 2017
Merged

Enc pdb tests #18883

merged 4 commits into from
Apr 25, 2017

Conversation

ivanbasov
Copy link
Contributor

@ivanbasov ivanbasov commented Apr 21, 2017

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

@@ -5765,6 +5767,197 @@ static void M()

#endregion

#region Patterns

public void SyntaxOffset_Parrern()
Copy link
Member

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

Copy link
Contributor Author

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; }}";
Copy link
Member

@tmat tmat Apr 24, 2017

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.

Copy link
Member

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)

Copy link
Contributor Author

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; } }";
Copy link
Member

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 ;

Copy link
Contributor Author

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; } }";
Copy link
Member

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 ;

Copy link
Contributor Author

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; } }";
Copy link
Member

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.

Copy link
Contributor Author

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!

@tmat
Copy link
Member

tmat commented Apr 25, 2017

:shipit:

@ivanbasov
Copy link
Contributor Author

Signed off by @tmat. Tests passed except optional ones permanently failed due to unrelated configuration issues.
Tagging @MattGertz for ask mode approval.

@MattGertz
Copy link
Contributor

@ivanbasov Test-only fix, no approval required.

@ivanbasov ivanbasov merged commit 54efe21 into dotnet:master Apr 25, 2017
@ivanbasov ivanbasov deleted the EncPdbTests branch April 25, 2017 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants