Skip to content

Do not treat replaceable TypeVariableNode instances as noops - #1722

Closed
HT154 wants to merge 1 commit into
apple:mainfrom
HT154:alias-type-var-not-noop
Closed

Do not treat replaceable TypeVariableNode instances as noops#1722
HT154 wants to merge 1 commit into
apple:mainfrom
HT154:alias-type-var-not-noop

Conversation

@HT154

@HT154 HT154 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This also fixes TypeAliasTypeNode always performing lazy type checks even when they should be eager.

Resolves #1710
Resolves #1716
Supersedes #1717

@HT154
HT154 force-pushed the alias-type-var-not-noop branch from 41d2489 to 65e7141 Compare July 2, 2026 06:10
// if in a type alias, this node will be replaced by another TypeNode that may not be a noop
// so we return false so that containing TypeNodes don't skip checks erroneously
// this is slightly less efficient if the replacement _is_ a noop, but only inside typealiases
return !isInTypeAlias;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never hit the case where isNoopTypeCheck() is called when this is inside a typealias, because these nodes should be replaced before the alias can ever run.

Also: I feel that we should replace the usage of TypeVariableNode in other positions (e.g. function <T>(foo: T)) with TypeNode.Unknown, at least until we have support for type arguments there. Probably would be better if TypeVariableNode never gets fired.

@HT154 HT154 closed this Jul 2, 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

2 participants