Skip to content

Fix a bug and finish ref-reassignment test plan#25911

Merged
agocke merged 2 commits intodotnet:dev15.7.xfrom
agocke:finish-ref-local-tests
Apr 5, 2018
Merged

Fix a bug and finish ref-reassignment test plan#25911
agocke merged 2 commits intodotnet:dev15.7.xfrom
agocke:finish-ref-local-tests

Conversation

@agocke
Copy link
Copy Markdown
Member

@agocke agocke commented Apr 3, 2018

Customer scenario

Quality for new feature. Bug fix is in the first commit, additional tests are in the second commit.

Bugs this fixes

While implementing the tests for the ref-reassignment test plan (#22466)
I found a bug in the handling of the ref-escape scope of a ref local in foreach. That bug is fixed
and the rest of the items in the test plan should have a test.

Workarounds, if any

None.

Risk

Small bug fix, localized change only to ref locals in foreach statements.

Performance impact

Small, no additional allocations, minimal additional calculation.

Is this a regression from a previous update?

No.

Root cause analysis

New feature.

How was the bug found?

Uncovered in test plan.

@agocke agocke added this to the 15.7 milestone Apr 3, 2018
@agocke agocke requested review from OmarTawfik and VSadov April 3, 2018 18:31
@agocke agocke requested a review from a team as a code owner April 3, 2018 18:31
@agocke
Copy link
Copy Markdown
Member Author

agocke commented Apr 4, 2018

ping @dotnet/roslyn-compiler for review

@agocke
Copy link
Copy Markdown
Member Author

agocke commented Apr 4, 2018

@jaredpar for ask mode approval

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will always compute the same value as collectionValEscape above that is already computed (since there are no arguments going to either GetEnumerator, nor to the Current).

Should just use that as a ref escape for the local.

Copy link
Copy Markdown
Member

@VSadov VSadov Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we probably should just say that in the spec - "ref-escape of a local in a ref-foreach is a val-escape of the collection".
We are saying something similar in the val case. It is simpler - No need to involve how it is lowered.

Copy link
Copy Markdown
Member

@VSadov VSadov Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. We do not respect PEVerify-compat when that would result in functional break of the feature.

Another example is ref-returning a readonly field. PEVerify compat flag generally makes us to do local copies before taking a ref to a readonly field, but returning a ref to a local clone makes no sense. Having a choice between not compatible and completely broken we pick not compatible.

Copy link
Copy Markdown
Member

@VSadov VSadov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,
but I think it is worth making simplification to the ref-escape of the ref-foreach local.

@agocke agocke requested a review from a team April 5, 2018 16:23
@jaredpar
Copy link
Copy Markdown
Member

jaredpar commented Apr 5, 2018

LGTM,
but I think it is worth making simplification to the ref-escape of the ref-foreach local.

Lets do this in 15.8.

@jaredpar
Copy link
Copy Markdown
Member

jaredpar commented Apr 5, 2018

@agocke you just hit a merge conflict here. Can you clean up the conflict and get the commit re-pushed here?

@VSadov
Copy link
Copy Markdown
Member

VSadov commented Apr 5, 2018

By "simplification" I meant - "not computing the value twice". It is an easy thing to fix.

@agocke agocke force-pushed the finish-ref-local-tests branch from 94fcc57 to 16c1a6f Compare April 5, 2018 17:46
@agocke
Copy link
Copy Markdown
Member Author

agocke commented Apr 5, 2018

@jaredpar Done. @VSadov I fixed up your comments during the rebase.

@agocke agocke merged commit a4c008b into dotnet:dev15.7.x Apr 5, 2018
@agocke agocke deleted the finish-ref-local-tests branch April 5, 2018 18:59
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.

3 participants