Skip to content

Commit 1474264

Browse files
committed
Review and update changes
`file` should be a contextual keyword. Fix some other errors of omission.
1 parent e9e3024 commit 1474264

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

standard/classes.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ When a partial type declaration ([§15.2.7](classes.md#1527-partial-type-declara
8282

8383
The `abstract`, `sealed`, and `static` modifiers are discussed in the following subclauses.
8484

85-
The `file` modifier specifies that the type being declared is local to its parent compilation unit. A compilation unit containing a `file`-modified type shall not also contain a type declaration having the same name but without the `file` modifier.
85+
The `file` modifier specifies that the type being declared is local to its parent compilation unit. A compilation unit containing a `file`-modified type shall not also contain a type declaration having the same name but without the `file` modifier. (`file` is a contextual keyword (§6.4.4) that has special meaning when used as a top-level type modifier.)
8686

8787
The `file` modifier shall only appear in a type declaration for a top-level type.
8888

8989
When a type declaration contains the `file` modifier, that type is said to be a ***file-local type***.
9090

91-
The implementation shall guarantee that file-local types with the same name declared in different compilation units, are distinct at runtime. The implementation shall guarantee that a file-local type with the same name as a non-file-local type declared in different compilation units, are distinct at runtime.
91+
The implementation shall guarantee that two type declarations are distinct at runtime when either both are file-local types with the same name declared in different compilation units, or one is a file-local type and the other is a non-file-local type with the same name.
9292

93-
A file-local class that is an attribute type may be used an as attribute within both file-local types and non-file-local types, just as if the attribute type were a non-file-local class.
93+
A file-local class that is an attribute type may be used as an attribute within both file-local types and non-file-local types, just as if the attribute type were a non-file-local class.
9494

9595
#### 15.2.2.2 Abstract classes
9696

@@ -811,6 +811,8 @@ The modifier `partial` is used when defining a class, struct, or interface type
811811

812812
Each part of a ***partial type*** declaration shall include a `partial` modifier and shall be declared in the same namespace or containing type as the other parts. The `partial` modifier indicates that additional parts of the type declaration might exist elsewhere, but the existence of such additional parts is not a requirement; it is valid for the only declaration of a type to include the `partial` modifier. It is valid for only one declaration of a partial type to include the base class or implemented interfaces. However, all declarations of a base class or implemented interfaces shall match, including the nullability of any specified type arguments.
813813

814+
For a partial type, either all parts shall include the `file` modifier and be declared in the same compilation unit, or no part shall include the `file` modifier.
815+
814816
All parts of a partial type shall be compiled together such that the parts can be merged at compile-time. Partial types specifically do not allow already compiled types to be extended.
815817

816818
Nested types may be declared in multiple parts by using the `partial` modifier. Typically, the containing type is declared using `partial` as well, and each part of the nested type is declared in a different part of the containing type.

standard/lexical-structure.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ keyword
588588
| 'byte' | 'case' | 'catch' | 'char' | 'checked'
589589
| 'class' | 'const' | 'continue' | 'decimal' | DEFAULT
590590
| 'delegate' | 'do' | 'double' | 'else' | 'enum'
591-
| 'event' | 'explicit' | 'extern' | FALSE | 'file' | 'finally'
591+
| 'event' | 'explicit' | 'extern' | FALSE | 'finally'
592592
| 'fixed' | 'float' | 'for' | 'foreach' | 'goto'
593593
| 'if' | 'implicit' | 'in' | 'int' | 'interface'
594594
| 'internal' | 'is' | 'lock' | 'long' | 'namespace'
@@ -609,13 +609,13 @@ A ***contextual keyword*** is an identifier-like sequence of characters that has
609609
contextual_keyword
610610
: 'add' | 'alias' | 'and' | 'ascending' | 'async'
611611
| 'await' | 'by' | 'Cdecl' | 'descending'| 'dynamic'
612-
| 'equals' | 'Fastcall' | 'from' | 'get' | 'global'
613-
| 'group' | 'init' | 'into' | 'join' | 'let'
614-
| 'managed' | 'nameof' | 'nint' | 'not' | 'notnull'
615-
| 'nuint' | 'on' | 'or' | 'orderby' | 'partial'
616-
| 'record' | 'remove' | 'select' | 'set' | 'Stdcall'
617-
| 'Thiscall' | 'unmanaged' | 'value' | 'var' | 'when'
618-
| 'where' | 'yield'
612+
| 'equals' | 'Fastcall' | 'file' | 'from' | 'get'
613+
| 'global' | 'group' | 'init' | 'into' | 'join'
614+
| 'let' | 'managed' | 'nameof' | 'nint' | 'not'
615+
| 'notnull' | 'nuint' | 'on' | 'or' | 'orderby'
616+
| 'partial' | 'record' | 'remove' | 'select' | 'set'
617+
| 'Stdcall' | 'Thiscall' | 'unmanaged' | 'value' | 'var'
618+
| 'when' | 'where' | 'yield'
619619
;
620620
```
621621

0 commit comments

Comments
 (0)