Skip to content

Read a template declared by the key of an array shape's unsealed type - #353

Merged
ondrejmirtes merged 1 commit into
2.5.xfrom
unsealed-template-declaration
Nov 28, 2026
Merged

ondrejmirtes merged 1 commit into
2.5.xfrom
unsealed-template-declaration

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

Follow-up to #352. array{a: int, ...<K of key-of<Config>|int, Config[K]>} now parses: the key of the unsealed type may be a TemplateDeclarationTypeNode, like the first argument of array<K of ..., V>.

A declared template is always a key, so the value type has to follow it: ...<K of int> is a parse error. ...<of, string> (a key type named of) reads as before. The grammar describes the same.

array{a: int, ...<K of key-of<Config>|int, Config[K]>} declares K in the key
of whatever the shape leaves over, the way array<K of ..., V> does. A declared
template is always a key, so the value has to follow it: ...<K of int> is an
error.

Amp-Thread-ID: https://ampcode.com/threads/T-01a22165-e448-7588-8b56-bc4dd19cc3a4
@ondrejmirtes
ondrejmirtes merged commit 839c252 into 2.5.x Nov 28, 2026
64 of 67 checks passed
@ondrejmirtes
ondrejmirtes deleted the unsealed-template-declaration branch November 28, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant