Skip to content

Commit c155346

Browse files
authored
Merge branch 'draft-v8' into unmanaged-constructed-types
2 parents 0e73020 + 773fdb8 commit c155346

File tree

139 files changed

+6356
-3910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+6356
-3910
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Learn feedback control.
2+
description: |
3+
⛔ This template is hooked into the feedback control on the bottom of every page on the learn.microsoft.com site. It automatically fills in several fields for you. Don't use for other purposes. ⛔
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: "## Issue information"
8+
- type: markdown
9+
attributes:
10+
value: Select the issue type, and describe the issue in the text box below. Add as much detail as needed to help us resolve the issue. Make sure to include the relevant section number. The committee is working on C# 8 currently. Don't write issues about features added after that version.
11+
- type: dropdown
12+
id: issue-type
13+
attributes:
14+
label: Type of issue
15+
options:
16+
- Typo
17+
- Spec incorrect
18+
- Spec incomplete
19+
- xref missing
20+
- Other (describe below)
21+
validations:
22+
required: true
23+
- type: textarea
24+
id: feedback
25+
validations:
26+
required: true
27+
attributes:
28+
label: Description
29+
- type: markdown
30+
attributes:
31+
value: "## 🚧 Document information 🚧"
32+
- type: markdown
33+
attributes:
34+
value: "*Don't modify the following fields*. They are automatically filled in for you. Doing so will disconnect your issue from the affected article. *Don't edit them*."
35+
- type: input
36+
id: pageUrl
37+
validations:
38+
required: true
39+
attributes:
40+
label: Page URL
41+
- type: input
42+
id: contentSourceUrl
43+
validations:
44+
required: true
45+
attributes:
46+
label: Content source URL

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "nuget"
4+
directory: "/tools" #tools.sln
5+
schedule:
6+
interval: "weekly"
7+
day: "wednesday"
8+
open-pull-requests-limit: 5
9+
groups:
10+
# Group .NET updates together for solutions.
11+
dotnet:
12+
patterns:
13+
- "*" # Prefer a single PR per solution update.
Binary file not shown.

.github/workflows/dependencies/ReplaceAndAdd.md

Lines changed: 77 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -32,88 +32,15 @@ the automatic section numbering tooling, they **must** be maintained manually.
3232

3333
# Verification-Only Replacements & Additions
3434

35-
This set of replacements and additions is the bare minimum required to allow the grammar to verify and run, though
36-
it may not produce the desired parse (that requires at least the use of modes and/or
37-
lexical predicates).
35+
This set of replacements and additions is the bare minimum required to allow the grammar
36+
to verify and run, though it may not produce the desired lex and parse (that requires at
37+
least the use of modes and/or lexical predicates).
3838

39-
This set can be used as a basic check that the grammar is a correct ANTLR grammar.
39+
Pre-processing directives are skipped like whitespace, however lexing confirms the lexical
40+
grammar is valid.
4041

41-
---
42-
43-
## Top Level Rule
44-
45-
The Standard’s *compilation_unit* as is will allow garbage at the end of a file, this
46-
rule has an EOF requirement to ensure the whole of the input must be a correct program.
47-
48-
> *Note: The section number makes this the first rule in the grammar, not required but it
49-
has to go somewhere…*
50-
51-
### 0.0.0 Top Level Rule
52-
53-
```ANTLR
54-
// [ADDED] Rule added as the start point
55-
prog: compilation_unit EOF;
56-
```
57-
---
58-
59-
## Discarding Whitespace
60-
61-
The following changes in §7.3.2, §7.3.3 and §7.3.4, add `-> skip` to the “whitespace”
62-
token rules so that are not passed to the parser. This behaviour is implicit in the
63-
Standard.
64-
65-
### 7.3.2 Line terminators
66-
67-
```ANTLR
68-
// [SKIP]
69-
New_Line
70-
: ( New_Line_Character
71-
| '\u000D\u000A' // carriage return, line feed
72-
) -> skip
73-
;
74-
```
75-
76-
### 7.3.3 Comments
77-
78-
```ANTLR
79-
// [SKIP]
80-
Comment
81-
: ( Single_Line_Comment
82-
| Delimited_Comment
83-
) -> skip
84-
;
85-
```
86-
87-
### 7.3.4 White space
88-
89-
```ANTLR
90-
// [SKIP]
91-
Whitespace
92-
: ( [\p{Zs}] // any character with Unicode class Zs
93-
| '\u0009' // horizontal tab
94-
| '\u000B' // vertical tab
95-
| '\u000C' // form feed
96-
) -> skip
97-
;
98-
99-
```
100-
101-
---
102-
103-
## Pre-processing directives
104-
105-
This change causes all pre-processor directives to be discarded, they don’t need to be
106-
processed to validate the grammar (processing them would exercise the *implementation*
107-
of the pre-processor, which is not part of the Standard).
42+
This set can be used as a basic check that the grammar is a valid ANTLR grammar.
10843

109-
### 7.5.1 General
110-
111-
```ANTLR
112-
// [CHANGE] Discard pre-processor directives
113-
PP_Directive
114-
: (PP_Start PP_Kind PP_New_Line) -> skip
115-
;
116-
```
11744

11845
---
11946

@@ -125,32 +52,73 @@ strive not to introduce any new ones).
12552
This change resolves the one remaining MLR group by inlining some of the non-terminal
12653
alternatives in *primary_no_array_creation_expression*.
12754

128-
Non-terminals that are inlined are commented out and the inlined body is indented.
55+
Non-terminals that are inlined
56+
are commented out and the inlined body is indented.
12957

13058
This change has not been made to the Standard itself as it makes *primary_no_array_creation_expression*
131-
“uglier” and would obfuscate somewhat the description in the Standard.
59+
“uglier” and would obfuscate somewhat the description in the Standard – both
60+
subjective reasons of course...
13261

13362
As MLR is not supported by ANTLR without this change the grammar would be rejected.
13463

135-
### 12.7.1 General
64+
### 12.8.1 General
13665

13766
```ANTLR
13867
// [CHANGE] This removes a mutual left-recursion group which we have (currently?)
139-
// [CHANGE] decided to leave in the Standard. Without this change the grammar will fail.
68+
// [CHANGE] decided to leave in the Standard. Without this change the grammar will
69+
// [CHANGE] fail to verify.
70+
# Expect
14071
primary_no_array_creation_expression
14172
: literal
73+
| interpolated_string_expression
14274
| simple_name
14375
| parenthesized_expression
76+
| tuple_expression
77+
| member_access
78+
| null_conditional_member_access
79+
| invocation_expression
80+
| element_access
81+
| null_conditional_element_access
82+
| this_access
83+
| base_access
84+
| post_increment_expression
85+
| post_decrement_expression
86+
| object_creation_expression
87+
| delegate_creation_expression
88+
| anonymous_object_creation_expression
89+
| typeof_expression
90+
| sizeof_expression
91+
| checked_expression
92+
| unchecked_expression
93+
| default_value_expression
94+
| nameof_expression
95+
| anonymous_method_expression
96+
| pointer_member_access // unsafe code support
97+
| pointer_element_access // unsafe code support
98+
| stackalloc_expression
99+
;
100+
# ReplaceWith
101+
primary_no_array_creation_expression
102+
: literal
103+
| interpolated_string_expression
104+
| simple_name
105+
| parenthesized_expression
106+
| tuple_expression
144107
// | member_access
145108
| primary_no_array_creation_expression '.' identifier type_argument_list?
146109
| array_creation_expression '.' identifier type_argument_list?
147110
| predefined_type '.' identifier type_argument_list?
148111
| qualified_alias_member '.' identifier type_argument_list?
112+
// | null_conditional_member_access
113+
| primary_no_array_creation_expression '?' '.' identifier type_argument_list? dependent_access*
114+
| array_creation_expression '?' '.' identifier type_argument_list? dependent_access*
149115
// | invocation_expression
150116
| primary_no_array_creation_expression '(' argument_list? ')'
151117
| array_creation_expression '(' argument_list? ')'
152118
// | element_access and pointer_element_access (unsafe code support)
153119
| primary_no_array_creation_expression '[' argument_list ']'
120+
// | null_conditional_element_access
121+
| primary_no_array_creation_expression '?' '[' argument_list ']' dependent_access*
154122
| this_access
155123
| base_access
156124
// | post_increment_expression
@@ -174,5 +142,31 @@ primary_no_array_creation_expression
174142
| array_creation_expression '->' identifier type_argument_list?
175143
// | pointer_element_access // unsafe code support
176144
// covered by element_access replacement above
145+
| stackalloc_expression
146+
;
147+
```
148+
149+
150+
---
151+
152+
## Interpolated strings
153+
154+
The lexical rules for interpolated strings are context-sensitive and are not ANLTR-ready in the Standard
155+
as how such rules are handled is an implementation detail, e.g. using ANTLR modes.
156+
Here we just define one token in terms of another to remove the overlap warnings.
157+
158+
### 12.8.3 Interpolated string expressions
159+
160+
```ANTLR
161+
// [CHANGE] This allows the grammar to verify without warnings, it does NOT correctly
162+
// [CHANGE] parse interpolated strings – that requires modes and/or lexical predicates.
163+
// [CHANGE] Note: Interpolated strings are properly parsed in Base and other sets.
164+
# Expect
165+
Interpolated_Verbatim_String_End
166+
: '"'
167+
;
168+
# ReplaceWith
169+
Interpolated_Verbatim_String_End
170+
: Interpolated_Regular_String_End
177171
;
178172
```
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This GitHub Action workflow is triggered on label changes for pull requests.
2+
# When a pull request is labeled with "DO NOT MERGE", the workflow fails, thus
3+
# preventing the pull request from being merged. Otherwise, the workflow will
4+
# succeed, allowing the pull request to be merged.
5+
6+
name: "Check labels that prevent merge"
7+
on:
8+
pull_request:
9+
branches: [main]
10+
types: [labeled, unlabeled]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
labels-preventing-merge-check:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
label:
21+
# Labels that prevent merging
22+
- 'do not merge'
23+
steps:
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
26+
with:
27+
egress-policy: audit
28+
29+
- name: 'Check "${{ matrix.label }}" label'
30+
run: |
31+
echo "::notice::Merging permission is diabled for PRs when the '${{ matrix.label }}' label is applied."
32+
33+
if [ "${{ contains(github.event.pull_request.labels.*.name, matrix.label) }}" = "true" ]; then
34+
echo "::error::Pull request is labeled as '${{ matrix.label }}'. Please remove the label before merging."
35+
exit 1
36+
else
37+
exit 0
38+
fi

.github/workflows/grammar-validator.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
- name: Check out our repo
2222
uses: actions/checkout@v2
2323

24-
- name: Setup .NET 6.0
24+
- name: Setup .NET 8.0
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 6.0.x
27+
dotnet-version: 8.0.x
2828

2929
- name: Set up JDK 15
3030
uses: actions/setup-java@v1
@@ -34,7 +34,7 @@ jobs:
3434
# Install build grammar global tool
3535
- name: Install BuildGrammar tool
3636
run: |
37-
dotnet tool install --version 1.0.0-alpha.2 --global --add-source ./.github/workflows/dependencies/ EcmaTC49.BuildGrammar
37+
dotnet tool install --version 2.0.0-beta.3 --global --add-source ./.github/workflows/dependencies/ EcmaTC49.BuildGrammar
3838
3939

4040
- name: run validate

.github/workflows/markdown-links-verifier.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/quest-bulk.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)