You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Release prep: bump to v0.2 + refresh docs (#807) (#838)
* chore: bump version base to 0.2 (#807)
Bump nbgv version base from 0.1 to 0.2 for the v0.2 release line.
The commit-height patch component is still derived by Nerdbank.GitVersioning
from the Git commit and the orchestrator will tag v0.2.<patch> on main
after this PR merges.
Refs #807, #706
* docs: refresh release notes, diagnostics catalogue, tutorials for v0.2 (#807)
Doc sweep for the v0.2 release line:
- Cut the `Unreleased` block in release-notes.md into a dated `0.2`
section. Add a `Highlights` summary covering the Oats-sweep themes
(ADR-0070..0104), the legacy-spelling removals with their migration
diagnostics, native-interop end-to-end, the Go-flavored opt-in import,
and tooling polish (LSP async-shaped completions, nil quick fixes,
null->nil did-you-mean).
- Update the version-base paragraph to point at `0.2`.
- Add diagnostics-page sections for previously-undocumented v0.2 IDs:
GS0285-GS0287 (top-level statements), GS0288 (field var/let),
GS0289-GS0292 (deinit), GS0293-GS0295 (labeled break/continue), and
GS0365 (variadic slot in anonymous function-type clause must be a
slice). Extend the existing GS0363/GS0364 section to cover ADR-0102.
- Tutorials: drop the stale "this is the v0.1 design" comment in
control-flow.md.
Refs #807, #706
* docs(website): rotate versioned snapshot from 0.1 to 0.2 (#807)
Snapshot the live docs as the new `version-0.2` set (created with
`npm run docusaurus -- docs:version 0.2`) and retire the `version-0.1`
snapshot. Update versions.json so the docusaurus version dropdown lists
only `0.2` and `Next`. The 0.1 URL space is no longer served.
Verified `npm ci && npm run build` succeeds with no broken links and
no warnings.
Refs #807, #706
---------
Co-authored-by: Copilot CLI <noreply@github.com>
Copy file name to clipboardExpand all lines: website/docs/ref/diagnostics.md
+75-10Lines changed: 75 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -452,6 +452,61 @@ Cause/fix examples:
452
452
-**GS0296** — `let s = "hi"; if let v = s { ... }`. Fix: either use a plain `let v = s` (no narrowing) or pass a nullable value. The binding only makes sense when the RHS has type `T?`.
453
453
-**GS0297** — `guard let v = s else { var x = 1 }`. Fix: make the else block exit the enclosing scope — `return`, `throw`, `break`, or `continue`. The binding is only in scope after the guard precisely because the else cannot fall through.
ADR-0066 (top-level statements). The three diagnostics below cover
458
+
the project-shape / placement / return-shape rules that the synthesized
459
+
entry point depends on.
460
+
461
+
| Code | Severity | Message |
462
+
|------|----------|---------|
463
+
| GS0285 | Error | Top-level statements are not allowed in a library project. Set `<OutputType>Exe</OutputType>` on the project, or move the statements into an explicit `func Main()`. |
464
+
| GS0286 | Warning | Top-level statements should form a single contiguous block within a file — interleaving them with type or function declarations is hard to read. |
465
+
| GS0287 | Error | Top-level statements mix bare `return;` and `return <expr>;`. Choose one return shape so the synthesized entry point has a single return type. |
466
+
467
+
## Field declaration `var` / `let` requirement (GS0288)
468
+
469
+
ADR-0067. Field declarations inside a `struct`, `class`, or `shared`
470
+
block must carry a leading `var` (mutable) or `let` (read-only)
471
+
keyword. The keyword distinguishes mutable from read-only storage and
472
+
keeps type bodies visually consistent with property, event, and method
473
+
members.
474
+
475
+
| Code | Severity | Message |
476
+
|------|----------|---------|
477
+
| GS0288 | Error | Field declarations require a `var` (mutable) or `let` (read-only) keyword. |
478
+
479
+
Cause/fix — `struct Point { x int32; y int32 }` → `struct Point { var x int32; var y int32 }` (or `let` for read-only). The parser recovers by treating the field as `var`, but the error still fires.
| GS0293 | Error | No enclosing loop is labeled `<label>` (in `break <label>` / `continue <label>`). |
501
+
| GS0294 | Error | Label `<label>` can only be applied to a loop statement (`for` / `while` / `do-while`). |
502
+
| GS0295 | Warning | Label `<label>` shadows an enclosing loop label of the same name; the inner label wins for nested `break` / `continue`. |
503
+
504
+
Cause/fix:
505
+
506
+
-**GS0293** — typo or stale name; spell the label exactly as it appears on the enclosing loop.
507
+
-**GS0294** — label-prefixes only attach to the three loop forms; remove the prefix on `if`/`switch`/etc.
508
+
-**GS0295** — rename the inner label so the two are distinguishable, or accept the inner-wins semantics.
509
+
455
510
## If-expression diagnostics (GS0276–GS0277)
456
511
457
512
ADR-0064 generalises `if` so that it can sit in value position (`let x = if cond { a } else { b }`). The diagnostics below guard the two binder rejection paths that are unique to the expression form; the branch-type-mismatch case reuses GS0263 (shared with the ADR-0062 ternary).
@@ -1400,26 +1455,35 @@ Cross-references:
1400
1455
- ADR-0087 — reified generics (`initobj T` for unconstrained `T`).
ADR-0101 / issue #799. The canonical G# spelling for a variadic
1406
-
parameter is `name ...T` (Go-style: the ellipsis sits between the
1407
-
parameter identifier and the element type); inside the body the
1408
-
parameter has type `[]T`. A signature may declare **at most one**
1409
-
variadic parameter and it must be the **last** parameter
1410
-
(see `GS0145` above). Variadic declarations are accepted only on
1411
-
top-level `func` declarations in this ADR; other declaration sites
1412
-
report `GS0146` (see above).
1460
+
ADR-0101 (`...T` parameters) and ADR-0102 (variadic slot in anonymous
1461
+
function-type clauses) / issues #799, #818. The canonical G# spelling
1462
+
for a variadic parameter is `name ...T` (Go-style: the ellipsis sits
1463
+
between the parameter identifier and the element type); inside the
1464
+
body the parameter has type `[]T`. A signature may declare **at most
1465
+
one** variadic parameter and it must be the **last** parameter
1466
+
(see `GS0145` above). Variadic declarations are accepted on top-level
1467
+
`func` declarations and on anonymous function-type clauses of the
1468
+
shape `(T1, ...T2) -> R`; other declaration sites report `GS0146`
1469
+
(see above).
1413
1470
1414
1471
| Code | Severity | Message |
1415
1472
|----|----------|-------------|
1416
1473
| GS0363 | Error | The C# `params` keyword is not supported in G#. Use the canonical variadic spelling `name ...T` (Go-style); inside the function body the parameter has type `[]T`. |
1417
1474
| GS0364 | Error | A function signature may declare at most one variadic parameter. |
1475
+
| GS0365 | Error | A variadic parameter slot in an anonymous function-type clause must use the slice form `[]T`; got `<typeName>`. |
1418
1476
1419
1477
Cause/fix:
1420
1478
1421
1479
-**GS0363 — `params` keyword.** Replace `params values []T` with `values ...T`. The lowering and call-site behaviour are identical; this is purely a spelling decision (ADR-0101 §"Structural rules" explains why the alias was rejected).
1422
1480
-**GS0364 — multiple variadic parameters.** Pick the one parameter that should accept the parameter pack and drop the `...` from the others. The remaining variadic must be the last parameter (`GS0145`).
1481
+
-**GS0365 — variadic slot in `(...)-> R` is not a slice.** In an
1482
+
anonymous function-type clause the `...` marker turns the parameter
1483
+
slot into a pack/passthrough call site, so the slot's element type
1484
+
must be a slice. Spell it `(...[]T) -> R`, not `(...T) -> R`. The
1485
+
body-side spelling on a real declaration (`func f(values ...T)`) is
1486
+
unchanged.
1423
1487
1424
1488
Caller-side semantics — the binder packs trailing positional arguments
1425
1489
into a fresh `[]T` array; if the caller supplies exactly one trailing
@@ -1431,9 +1495,10 @@ VB consumers see it as `params T[]`.
Copy file name to clipboardExpand all lines: website/docs/release-notes.md
+86-5Lines changed: 86 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,91 @@ draft: false
5
5
6
6
# Release notes
7
7
8
-
G# is pre-1.0. The repository's version base is currently `0.1`, and product versions are derived by Nerdbank.GitVersioning from that base and the Git commit. Until the project reaches a stable compatibility promise, release notes should be read as implementation status notes rather than a long-term compatibility contract.
9
-
10
-
## Unreleased
11
-
12
-
The G# compiler, language server, and VS Code extension absorbed a large stack of additions this cycle. The summary below groups them by area; each item links to the design decision (ADR) or implementation reference.
8
+
G# is pre-1.0. The repository's version base is currently `0.2`, and product versions are derived by Nerdbank.GitVersioning from that base and the Git commit. Until the project reaches a stable compatibility promise, release notes should be read as implementation status notes rather than a long-term compatibility contract.
9
+
10
+
## 0.2
11
+
12
+
The second pre-1.0 line ("Oats" sweep, parent epic #706). v0.2 is a
13
+
syntax-and-ergonomics release: the parser, binder, and emitter all
14
+
absorbed substantial additions, several legacy Go-flavored spellings
15
+
were retired in favour of canonical G# forms, and the native-interop
16
+
and default-interface-method surfaces shipped end-to-end. This release
17
+
also formally introduces docs versioning — the `0.1` snapshot is
18
+
removed and a fresh `0.2` snapshot is cut from the live docs.
19
+
20
+
### Highlights
21
+
22
+
-**New language surface.**`while` / `do…while` + labeled
GS0288–GS0366. The [Diagnostics reference](./ref/diagnostics.md)
92
+
has the per-ID cause/fix detail.
13
93
14
94
### Added
15
95
@@ -35,6 +115,7 @@ The G# compiler, language server, and VS Code extension absorbed a large stack o
35
115
- The website spec, feature matrix, FAQ, bridges page, guide pages, and design-decisions index were refreshed to match the compiler ground truth — most visibly, "Parameters do not have default-value syntax" and "Named arguments — Partial" are no longer correct and were rewritten.
36
116
- The repo `docs/lexical.md` block-comment paragraph (which incorrectly claimed block comments were not implemented) is corrected, and a documentation-comments subsection was added.
37
117
- The VS Code TextMate grammar adds the missing contextual keywords (`data`, `inline`, `record`, `delegate`, `event`, `prop`, `init`, `shared`, `scoped`, accessor names `get`/`set`/`add`/`remove`/`raise`, ref-kinds `ref`/`out`), operators (`:=`, `?.`, `??`, `?`/`:`, `!!`, `...`, `=>`), an `@Annotation` scope, and a `///` documentation-comment scope with `@tag` highlighting. The VS Code snippet set was rewritten to match current grammar.
118
+
- The Docusaurus site cuts a new `0.2` snapshot from the live docs and retires the `0.1` snapshot. The version dropdown lists `0.2` and `Next`; the `0.1` URL space is no longer served.
0 commit comments