TS8007
Front-end code LOOP_INFINITE
A loop that certainly never ends: a while (true) or a for with no condition, written or folded from constants, with no break or return, or a for with constant bounds whose step does not move the counter toward its bound.
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 = uv.x while (true) { g = g * 0.5 } return vec4(g, g, g, 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8007 error, line 6: while (true) has no break or return in its body, so it never ends. Leave it with a break, or write the exit into the condition.
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 = uv.x for (let i = 0; i < 4; i++) { g = g * 0.5 } return vec4(g, g, g, 1.)}The rule this enforces
- Rule 7.5 Test
- A
forloop means what it means in TypeScript: its initializer runs once, its condition (truewhen it has none) is tested before each trip, and its update runs after each trip and at eachcontinue(change 0136).
See also
Source
Where the compiler raises this code at commit af54ddad5, one line per file: