Skip to content

Type resolver experiement#10701

Draft
timotheeguerin wants to merge 9 commits into
microsoft:mainfrom
timotheeguerin:type-resolver
Draft

Type resolver experiement#10701
timotheeguerin wants to merge 9 commits into
microsoft:mainfrom
timotheeguerin:type-resolver

Conversation

@timotheeguerin
Copy link
Copy Markdown
Member

No description provided.

timotheeguerin and others added 7 commits May 15, 2026 08:50
…le detection

Add a centralized request-based type resolver (inspired by Swift's Evaluator)
that provides:
- Stack-based cycle detection with full cycle chain visibility
- Result caching per (sym, kind) pair
- Rich cycle diagnostics showing the complete dependency chain
- Unified resolution lifecycle management

This is Phase 1 of the checker circularity rearchitecture. The TypeResolver
will progressively replace the scattered pendingResolutions pattern.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate the TypeResolver into the checker for model extends/is, scalar
extends, and operation is resolution. The TypeResolver provides stack-based
cycle detection with full cycle chain visibility in non-template contexts.

The old pendingResolutions flat set is retained for template contexts where
the same model statement is legitimately re-entered with different type
arguments. Both systems run in parallel during this migration phase.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Resolver

Add TypeResolver tracking alongside pendingResolutions for:
- Alias type resolution (AliasTarget kind)
- Const value resolution (ConstValue kind)
- Model property type resolution (PropertyType kind)

The TypeResolver stack now tracks these resolutions, building toward
full cycle chain diagnostics. The old pendingResolutions remains for
backward compatibility during the migration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add TypeResolver tracking for template constraint resolution (Constraint
kind). The stack-based resolver now tracks constraint resolution in
non-template contexts alongside the existing pendingResolutions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
All pendingResolutions usage sites now have corresponding TypeResolver
tracking. The TypeResolver stack now covers:
- BaseType (model extends/is, scalar extends, operation is)
- AliasTarget (alias resolution, template container resolution)
- ConstValue (const value resolution)
- Constraint (template parameter constraints)
- PropertyType (model property type resolution)

The old PendingResolutions is retained for template-context cycle detection
where flat-set semantics are needed. Both systems run in parallel.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… late-bound member resolution

- Phase 6: ensureResolved now tracks deferred completions in TypeResolver
  for better debugging and diagnostics. assertNoPendingResolutions reports
  unresolved deferred completions.
- Phase 7: getCanonicalResolvedMemberSymbol now tracks MemberType resolution
  in TypeResolver when triggering lateBindMembers, with cycle detection.
- Phase 8: Full compiler test suite passes (3915 tests).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	packages/compiler/src/core/checker.ts
@microsoft-github-policy-service microsoft-github-policy-service Bot added compiler:core Issues for @typespec/compiler emitter:client:python Issue for the Python client emitter: @typespec/http-client-python labels May 15, 2026
@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
  • @typespec/http-client-python
Show changes

@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@10701
npm i https://pkg.pr.new/@typespec/http-client-python@10701

commit: b167ff6

@azure-sdk-automation
Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

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 emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant