Repository navigation
Keep root source files when project references form a cycle - #65633
zzy (zzy2008) wants to merge 1 commit into
Conversation
|
zzy (@zzy2008) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the fix preserving root-project source checking in cyclic project references.
No open issues 🎉
What changed in this PR
Fixes #65358 by preserving root-project source checking when project references form a cycle, preventing tsc --noEmit from silently succeeding despite type errors.
Changes:
- Identifies the root configuration by normalized path rather than parsed-object identity.
- Adds CLI regression tests for self-references and two-project cycles.
- Adds baselines confirming TS2322 diagnostics and unsuccessful exits in both cases.
| File | Description |
|---|---|
tsc/testdata/baselines/reference/tsc/projectReferences/noEmit-checks-source-files-when-the-project-references-itself.js |
Records source diagnostics for a self-reference. |
tsc/testdata/baselines/reference/tsc/projectReferences/noEmit-checks-source-files-when-a-referenced-project-references-the-root-project.js |
Records source diagnostics for a two-project cycle. |
tsc/internal/execute/tsctests/tsc_test.go |
Adds both circular-reference regression cases. |
tsc/internal/compiler/projectreferenceparser.go |
Excludes the root configuration from reference mappings using its path. |
Review effort: Balanced
Fixes #65358.
When project references lead back to the root config, the parser can create a second config object for the same project. Comparing the objects by identity lets the root's sources into the project-reference redirect map. The compiler can then skip those sources and return success.
Compare the normalized config path instead. The CLI baselines cover both a self-reference and two projects referencing each other. In both cases,
tsc -p project --noEmitreports TS2322 and exits 2. Build mode reports the cycle as TS6202 and exits 4.Validation
go -C ./tsc test -run='^TestTscProjectReferences$' ./internal/execute/tsctestsnpx hereby validate --allnpx hereby tidygit diff --exit-code