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

scoped should set ref escape scope to current block #64093

Merged
merged 4 commits into from
Sep 20, 2022
Merged

Conversation

cston
Copy link
Member

@cston cston commented Sep 16, 2022

scoped should set ref escape scope to the current block rather than the current method.

Fixes #64009.

@cston cston marked this pull request as ready for review September 16, 2022 22:31
@cston cston requested a review from a team as a code owner September 16, 2022 22:31
@@ -32,6 +32,7 @@ internal class SourceLocalSymbol : LocalSymbol
private readonly RefKind _refKind;
private readonly LocalDeclarationKind _declarationKind;
private readonly DeclarationScope _scope;
private readonly uint _localScopeDepth;

Copy link
Contributor

@AlekseyTs AlekseyTs Sep 16, 2022

Choose a reason for hiding this comment

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

It doesn't look like we need to store this value, we have _scopeBinder readily available #Closed

@AlekseyTs
Copy link
Contributor

Done with review pass (commit 2)

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 4)

@cston cston requested a review from a team September 19, 2022 15:51
@cston
Copy link
Member Author

cston commented Sep 20, 2022

@dotnet/roslyn-compiler please review, thanks.

@RikkiGibson RikkiGibson self-assigned this Sep 20, 2022
@cston cston merged commit c0c896c into dotnet:main Sep 20, 2022
@cston cston deleted the 64009 branch September 20, 2022 19:17
@ghost ghost added this to the Next milestone Sep 20, 2022
@Cosifne Cosifne modified the milestones: Next, 17.4 P3 Sep 26, 2022
jaredpar pushed a commit to jaredpar/runtime that referenced this pull request Sep 30, 2022
dotnet/roslyn#64093

This change enforced that `scoped` on a local set the escape scope to
the current block where previously it was incorrectly setting to the
containing method.
jaredpar pushed a commit to jaredpar/runtime that referenced this pull request Sep 30, 2022
dotnet/roslyn#64093

This change enforced that `scoped` on a local set the escape scope to
the current block where previously it was incorrectly setting to the
containing method.
jaredpar added a commit to dotnet/runtime that referenced this pull request Oct 3, 2022
* Patches for scoped locals

dotnet/roslyn#64093

This change enforced that `scoped` on a local set the escape scope to
the current block where previously it was incorrectly setting to the
containing method.

* Make return and out equivalent for ref safety

dotnet/roslyn#64318

This change allows anything returnable from a method to be assigned to
an `out` parameter. In several places had to add `scoped` to `ref` to
inform compiler they could not be captured in an `out` parameter.

* Warnings on managed pointer types

dotnet/roslyn#64294

Compiler now issues warnings for pointer operations involving managed
types

* Update compiler version

* PR feedback

* Ref safety rules attribute

Co-authored-by: Charles Stoner <10732005+cston@users.noreply.github.com>
carlossanlop pushed a commit to dotnet/runtime that referenced this pull request Oct 4, 2022
* Patches for scoped locals

dotnet/roslyn#64093

This change enforced that `scoped` on a local set the escape scope to
the current block where previously it was incorrectly setting to the
containing method.

* Make return and out equivalent for ref safety

dotnet/roslyn#64318

This change allows anything returnable from a method to be assigned to
an `out` parameter. In several places had to add `scoped` to `ref` to
inform compiler they could not be captured in an `out` parameter.

* Warnings on managed pointer types

dotnet/roslyn#64294

Compiler now issues warnings for pointer operations involving managed
types

* Update compiler version

* Fixup

* Ref safety rules attribute

Co-authored-by: Charles Stoner <10732005+cston@users.noreply.github.com>
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.

It looks like RefEscapeScope is incorrectly calculated for a scoped local inside an explicit block.
4 participants