Cyclic dependencies in constants cause stack overflow #40

Closed
opened 2026-06-12 13:42:58 +00:00 by Furkan · 1 comment

Expected behaviour: detect cycles and report error

Code to reproduce

const {
	x = z - 8
	y = x + 2
	z = y * 3
}

main() {
	assert x == 1
	assert y == 3
	assert z == 9
}
Expected behaviour: detect cycles and report error Code to reproduce ``` const { x = z - 8 y = x + 2 z = y * 3 } main() { assert x == 1 assert y == 3 assert z == 9 } ```
ed self-assigned this 2026-06-12 13:55:34 +00:00
Owner

Fixed in 32c308910d.
Ideally this detection would work for constant definitions even without triggering lazy evaluation.
But for now this is good enough. The cycle is detected during lazy evaluation only.

Fixed in https://git.urbach.dev/cli/q/commit/32c308910de1663fab593d645b1abcfab6199ca1. Ideally this detection would work for constant definitions even without triggering lazy evaluation. But for now this is good enough. The cycle is detected during lazy evaluation only.
ed added spent time 2026-06-12 15:53:00 +00:00
30 minutes
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Total time spent: 30 minutes
ed
30 minutes
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cli/q#40
No description provided.