Merged
Conversation
cston
approved these changes
Apr 17, 2024
AlekseyTs
reviewed
Apr 19, 2024
AlekseyTs
reviewed
Apr 19, 2024
AlekseyTs
reviewed
Apr 23, 2024
AlekseyTs
reviewed
Apr 24, 2024
cston
reviewed
Apr 24, 2024
| } | ||
| local(); | ||
| } | ||
| partial IEnumerable<int> M5(); // unsafe context, no iterator body |
Contributor
cston
approved these changes
Apr 24, 2024
AlekseyTs
reviewed
Apr 25, 2024
AlekseyTs
reviewed
Apr 25, 2024
Contributor
|
Done with review pass (commit 11) |
cston
reviewed
Apr 25, 2024
| > ~~It is a compile-time error for an iterator block to contain an unsafe context ([§23.2][unsafe-contexts]). | ||
| > An iterator block always defines a safe context, even when its declaration is nested in an unsafe context.~~ | ||
| > **The iterator block used to implement an iterator ([§15.14][iterators]) | ||
| > always defines a safe context, even when its declaration is nested in an unsafe context.** |
Contributor
cston
reviewed
Apr 25, 2024
| - The `set` accessor of an iterator property or indexer (i.e., its `get` accessor is implemented via an iterator block) | ||
| "inherits" its safe/unsafe scope from the declaration. | ||
| - This does not affect partial declarations without implementation as they are only signatures and cannot have an iterator body. | ||
| - In C# 12 it is an error to have an iterator method marked with the `unsafe` modifier, but that is allowed in C# 13. |
Contributor
There was a problem hiding this comment.
Member
Author
There was a problem hiding this comment.
Well, you're right, the C# 12/13 thing does not follow just from the spec but also from this:
csharplang/proposals/ref-unsafe-in-iterators-async.md
Lines 43 to 46 in f0732b0
I'm not sure, but I thought the spec is usually not conditional on langversion, the whole spec is for one specific langversion, hence I left this out of the spec itself. Anyway I will clarify this, thanks.
cston
approved these changes
Apr 26, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.