Skip to content

Check queue experiment#10708

Draft
timotheeguerin wants to merge 11 commits into
microsoft:mainfrom
timotheeguerin:check-queue
Draft

Check queue experiment#10708
timotheeguerin wants to merge 11 commits into
microsoft:mainfrom
timotheeguerin:check-queue

Conversation

@timotheeguerin
Copy link
Copy Markdown
Member

No description provided.

timotheeguerin and others added 4 commits May 15, 2026 08:03
Add DeferralSignal class for stack-unwinding deferral, global-retry
fixpoint loop in processUntilFixpoint, PendingResolutions snapshot/restore,
and maybeDeferOnQueuedDeclaration helper. Infrastructure is ready but not
yet wired to cycle detection points (needs incremental activation).

- DeferralSignal thrown when check encounters unresolved dependency
- activeItem tracking on CheckQueue for queue-aware checks
- Global retry: re-queues all deferred items when progress is made
- PendingResolutions snapshot/restore for clean rollback on deferral
- markError accepts Deferred items for force-checking cycles
- 33 queue unit tests, 1390 checker tests pass

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When the check queue reaches fixpoint with remaining deferred items,
use Tarjan's SCC analysis to identify cycle groups and report a
'circular-dependency-cycle' diagnostic listing all participants before
force-checking them for per-site error diagnostics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add infrastructure for the two-pass (shell creation + population) type
checking approach. This is preparatory work for enabling queue-based
deferral:

- Add allItems() iterator to CheckQueue for traversing all registered items
- Add createDeclarationShells() with per-type shell creation functions
  (Model, Scalar, Interface, Union, Operation, Enum)
- Shells are minimal type objects created via createType() with creating=true
  that can be referenced before full population

NOTE: Shell creation is currently DISABLED (commented out in checkProgram)
because it breaks the existing pendingResolutions-based cycle detection.
When shells exist, cross-references resolve immediately via
symbolLinks.declaredType without triggering DFS into the target's check
function, so pendingResolutions tracking never fires for the target.

Activating this requires redesigning cycle detection to work across
queue iterations rather than within a single DFS call stack. Options:
1. Track extends/is chains explicitly in the queue
2. Use the queue's SCC analysis as the primary cycle detector
3. Add a pre-check AST dependency analysis pass

All 1390 checker tests + 33 queue tests continue to pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the compiler:core Issues for @typespec/compiler label May 15, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 15, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/compiler@10708

commit: ce780f5

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @typespec/compiler
Show changes

@azure-sdk-automation
Copy link
Copy Markdown

azure-sdk-automation Bot commented May 15, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

…references

When a member access (e.g., A.t) targets a model that is still being
checked (creating=true), defer the resolution using the existing
waitingForResolution callback mechanism instead of emitting an error.

When the container type finishes checking, the callback re-resolves
the member via late-bound symbols and updates the property type.

This enables patterns like:
  model Template<T> {...T}
  model A is Template<{t: B}>;
  model B { a: A.t; }

Where B.a references A.t which only becomes available after A's
template instantiation completes.
@timotheeguerin timotheeguerin added the int:azure-specs Run integration tests against azure-rest-api-specs label May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler int:azure-specs Run integration tests against azure-rest-api-specs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant