Rule 10.1
Chapter 10, Extensions and capabilities Test
A "use typeshade" file must not spell a WGSL enable or requires statement. A capability comes from the shape the file writes; an extension the shape cannot imply is turned on with a string directive beside "use typeshade", "enable <ext>", one WGSL extension name per directive, from the WGSL backend’s capability profile. A built-in value that needs an extension derives it (@builtin("clip_distances") derives enable clip_distances;), and a requires directive is emitted by the compiler, never written.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
the shape already says what the module needs, and a directive that says more than the shape uses can fail pipeline creation on a device that lacks the feature; the string directive covers the extensions no shape can imply, and names only what the writer can emit.
Derives from
Directives, Enable Extensions, Language Extensions; src/compiler/ts/texture-wgsl-only.test.ts (“the capability comes from the shape, never from enables”); surface §50. #168 changed this rule (closing #146), which had left no author spelling at all.
How it is verified
Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.
Where the rule says the compiler enforces it:
enable f16; in a shader file is a parse error (TS8030); "enable <ext>" with a name outside the profile is TS8050, naming the profile; the derived and declared extensions are src/compiler/ts/builtin-values.test.ts.
The files that verify it at commit 26de7be8, each at the first line that names the rule:
Explained in
The sections of the surface document that explain this rule, at commit 26de7be8:
Error codes that enforce it
The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:
-
TS8030SYNTAX - A TypeScript parse error (an unclosed parenthesis, a missing brace, an unexpected token) in a
"use typeshade"file, carried through as a TypeShade diagnostic so acompile()caller sees it without runningtsc. -
TS8050ENABLE_NAME - A file-level
"enable <extension>";directive (§50) naming an extension outside the vocabulary the WGSL backend's capability profile carries a directive for (clip_distances,dual_source_blending,f16,primitive_index,subgroups).
See also
- Rule 9.8 Test
- Rule 10.2 Test
- Design rules
- Error codes
Source
The rule at commit 26de7be8:
docs/language-design.md:1084(the design document)reqs/rules/RULE-1001.md(its traceability item)