TS8075
Front-end code UNASSIGNED_READ
A read of a local before it is assigned on every path (Rule 7.6), by TypeScript's rule for its TS2454. An argument is a read, and no call assigns the caller's local. The editor shows this code where TypeScript reports TS2454.
The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.
The registry text and every compiler message on these pages are the compiler's own English.
Example
"use typeshade"
@fragmentexport function main(uv: location<0, vec2>): vec4 { let g: f32 if (uv.x > 0.5) { g = 1. } return vec4(g, g, g, 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8075 error, line 9: "g" is read here before it is assigned on every path. Assign it before this read, or declare it with a value (Rule 7.6).
TS8075 error, line 9: "g" is read here before it is assigned on every path. Assign it before this read, or declare it with a value (Rule 7.6).
TS8075 error, line 9: "g" is read here before it is assigned on every path. Assign it before this read, or declare it with a value (Rule 7.6).
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
@fragmentexport function main(uv: location<0, vec2>): vec4 { let g: f32 if (uv.x > 0.5) { g = 1. } else { g = 0.25 } return vec4(g, g, g, 1.)}The rules this enforces
- Rule 7.6 Test
- A read of a local before it is assigned on every path must be refused (
TS8075), by TypeScript’s rule for its TS2454; an argument is a read, as TypeScript reads it, and no call assigns the caller’s local (change 0142); every target starts a local declared with no initializer at the zero of its type. - Rule 12.7 Test
- The language service and the compiler must name one vocabulary: the ambient library’s declarations are derived from the compiler’s own tables and never retyped, a builtin’s overloads from Tint’s
core.defthrough the TypeShade overlay, and a program the compiler accepts must draw no error in the editor or intshc check.
See also
Source
Where the compiler raises this code at commit af54ddad5, one line per file: