Skip to content

chore: split _allTypeReferencesAreValid into collecting and checking - #3406

Open
momo-bee wants to merge 1 commit into
aws:preview/v7.1from
momo-bee:simplify-type-references-valid
Open

momo-bee wants to merge 1 commit into
aws:preview/v7.1from
momo-bee:simplify-type-references-valid

Conversation

@momo-bee

@momo-bee momo-bee commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

_allTypeReferencesAreValid in the validator had a cyclomatic complexity of 27. One body collected every named type the assembly refers to, found the syntax for each, and checked each one.

The collecting is now done by collectNamedTypes (named types in collections and unions) and declarationReferences (a type's base class, initializer parameters and interfaces). The check is done by _reportUnknownTypeReference, which reports JSII3000, JSII9000 and JSII9001. The references are collected and reported in the same order as before. The highest complexity is now 12.

  • Full jest passes on Node 26 with coverage (functions 96.76%).
  • jsii-calc and aws-cdk-lib (plain, --add-deprecation-warnings, --strip-deprecated) are byte-identical.
  • aws-cdk-lib, 4 paired runs: median 51.69s -> 50.98s (gaps +1.12, -1.30, -0.71, -0.95s), the same within noise.

@momo-bee momo-bee closed this Dec 5, 2026
@momo-bee momo-bee reopened this Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant