Conversation
Remove the sentence "No access modifiers are allowed on interface member declarations." from the interface members bullet. Keep "Interface members implicitly have `public` declared accessibility."
Replace "`double` precision" with "`decimal` precision" in the sentence about decimal binary operators. The committee proposed a longer multi-case replacement, but the simplest fix is just the word swap since the surrounding text already covers the detailed behavior.
Add `[§7.9]` xref to item 9 (alongside existing `[§7.2]`), then remove the duplicate item 11 on line 41.
Change "An interface method declaration that has a block body or expression body as a *method\_body*" to "An interface property or interface property accessor declaration that has a block body or expression body"
Swap "enumerable" and "enumerator" (and their `§15.15.3`/`§15.15.2` xrefs) in the third warning bullet.
Replace "an unmanaged type (§8.8) or known to be a non-nullable value type" with "a non-nullable value type or a pointer type in unsafe code"
Change `` `Sᵢ,... Aₑ` `` to `` `S<Aᵢ,... Aₑ>` `` to match the input-unsafe definition format.
Change "the class or struct" to "the class" — structs cannot be abstract.
Replace both occurrences of `local_variable_declaration` with `non_ref_local_variable_declaration` in the prose.
In the `pointer_type` ANTLR production, replace `value_type` with `unmanaged_type`. Both files must be updated in sync.
Add "a nullable value type conversion" to the list of conversions that make type `E` pattern-compatible with `T`.
In the second paragraph, change "the result of the element access" to "the result of the array access".
Restructure the bullet list so all items grammatically complete the lead-in "It is a compile-time error if a ref struct type is used in any of the following contexts:". Several items are currently standalone statements (e.g., "There is no conversion from...") that don't fit the lead-in.
…ons" Change `- Explicit interface conversions` to `- Explicit interface conversions ([§10.3.5](conversions.md#1035-explicit-reference-conversions))`
Replace "instance" with "interface" in three bullet points about event declarations, matching the naming convention used in sibling sections (§19.4.3 "interface method", §19.4.4 "interface property").
| ```ANTLR | ||
| pointer_type | ||
| : value_type ('*')+ | ||
| : unmanaged_type ('*')+ |
There was a problem hiding this comment.
This change does introduce a left recursion in the grammar. In 8.8, an unmanaged_type is defined in the grammar as a value_type or a pointer_type. Then, in the prose the value_type is constrained to the builtin value types, enum types, and struct types whose members are only other unmanaged types in that list (paraphrasing here in the comment).
It's true that a pointer_type can only refer to an unmanaged_type, as written in the prose in line 120. But, to avoid the recursion, a bit fix might be to revert this change and expand the prose on line 120.
There was a problem hiding this comment.
cc @Nigel-Ecma for thoughts on the impact of introducing left recursion.
jskeet
left a comment
There was a problem hiding this comment.
Generally fine - not sure about the left-recursion aspect, and one clarity comment.
| ```ANTLR | ||
| pointer_type | ||
| : value_type ('*')+ | ||
| : unmanaged_type ('*')+ |
There was a problem hiding this comment.
cc @Nigel-Ecma for thoughts on the impact of introducing left recursion.
| - There is no conversion from a `ref struct` type to the type `object` or the type `System.ValueType`. | ||
| - In an async method. | ||
| - In an iterator. | ||
| - As the receiver type for a method group conversion to a delegate type. |
There was a problem hiding this comment.
The existing text makes it clear this is only for instance methods. I haven't looked up the precise definition for "receiver type for a method group conversion" - maybe that only terminology only works for instance methods only, but I wouldn't want a reader to think that Action<string> x = SomeRefStructType.StaticMethodAcceptingString; is invalid, if that makes sense.
Addresses most of #1580
I did these in a series of small commits so we can revert any we choose to defer or remove:
Phase 1: Items with 2 upvotes (3 commits)
Commit 1 — Item 4: Remove interface access modifier contradiction (§7.5.2)
publicdeclared accessibility."Commit 2 — Item 5: Fix "double precision" → decimal precision (§8.3.8)
doubleprecision" with "decimalprecision" in the sentence about decimal binary operators. The committee proposed a longer multi-case replacement, but the simplest fix is just the word swap since the surrounding text already covers the detailed behavior.Commit 3 — Item 43: Remove duplicate portability entry for finalizers (Annex B)
[§7.9]xref to item 9 (alongside existing[§7.2]), then remove the duplicate item 11 on line 41.Phase 2: Items with 1 upvote (12 commits)
Commit 4 — Item 7: Fix "interface method" → "interface property or interface property accessor" (§19.4.4)
Commit 5 — Item 10: Fix EnumeratorCancellation warning rule (§23.5.2)
§15.15.3/§15.15.2xrefs) in the third warning bullet.Commit 6 — Item 15: Fix null coalescing operator condition (§12.17)
Commit 7 — Item 25: Add angle brackets to output-unsafe definition (§19.2.3.2)
`Sᵢ,... Aₑ`to`S<Aᵢ,... Aₑ>`to match the input-unsafe definition format.Commit 8 — Item 26: Fix "class or struct" → "class" in §19.6.8
Commit 9 — Item 27: Fix
usingstatement prose to match grammar (§13.13)local_variable_declarationwithnon_ref_local_variable_declarationin the prose.Commit 10 — Item 29: Fix pointer_type grammar to use unmanaged_type (§24.3)
pointer_typeANTLR production, replacevalue_typewithunmanaged_type. Both files must be updated in sync.Commit 11 — Item 31: Add nullable conversions to pattern compatibility (§11.2.2)
Epattern-compatible withT.Commit 12 — Item 44: Fix "element access" → "array access" (§17.4)
Commit 13 — Item 45: Restructure ref struct restriction list (§16.2.3)
Commit 14 — Item 47: Add cross-reference for "Explicit interface conversions" (§10.3.1)
- Explicit interface conversionsto- Explicit interface conversions ([§10.3.5](conversions.md#1035-explicit-reference-conversions))Commit 15 — jskeet's comment: Fix "instance event" → "interface event" in §19.4.5
Excluded items — Items 30 and 32 (😕 reactions), Item 46 (no clear upvote, some uncertainty)
I'll open follow up on items 30, 32, and 46 based on any decisions in the meeting.