Skip to content

Type resolver experiement - #10701

Closed
Timothee Guerin (timotheeguerin) wants to merge 9 commits into
microsoft:mainfrom
timotheeguerin:type-resolver
Closed

Timothee Guerin (timotheeguerin) wants to merge 9 commits into
microsoft:mainfrom
timotheeguerin:type-resolver

Conversation

@timotheeguerin

Copy link
Copy Markdown
Member

No description provided.

…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

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

❌ 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

pkg-pr-new Bot commented May 15, 2026

Copy link
Copy Markdown

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

@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Jun 4, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Hi @Timothee Guerin (@timotheeguerin). Your PR has had no update for 14 days and it is marked as a stale PR. If it is not updated within 14 additional days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Hi @Timothee Guerin (@timotheeguerin). The PR will be closed since the PR has no update for 28 days. If this is still relevant please reopen.

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 stale Mark a PR that hasn't been recently updated and will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant