Skip to content

feat(compiler): Exhaustive checks for switch blocks#66429

Merged
mattrbeck merged 1 commit intoangular:mainfrom
JeanMeche:switch-exhaustive-check
Feb 17, 2026
Merged

feat(compiler): Exhaustive checks for switch blocks#66429
mattrbeck merged 1 commit intoangular:mainfrom
JeanMeche:switch-exhaustive-check

Conversation

@JeanMeche
Copy link
Member

@JeanMeche JeanMeche commented Jan 9, 2026

@switch blocks can now enable exhaustive typechecking by adding @default never; at the end of a @switch block.

fixes #52107

ex:

foo : 1 | 2 = 1;

// --- 

@switch(foo) {
   @case(1) {}
   @default never; // throws 
}

@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: compiler Issues related to `ngc`, Angular's template compiler labels Jan 9, 2026
@ngbot ngbot bot added this to the Backlog milestone Jan 9, 2026
@JeanMeche JeanMeche force-pushed the switch-exhaustive-check branch from f82b235 to 136ab85 Compare January 9, 2026 04:12
@JeanMeche JeanMeche added the target: minor This PR is targeted for the next minor release label Jan 9, 2026
@JeanMeche JeanMeche marked this pull request as draft January 9, 2026 04:13
@JeanMeche JeanMeche force-pushed the switch-exhaustive-check branch 2 times, most recently from b45d357 to 5bbf14e Compare January 9, 2026 04:43
@JeanMeche JeanMeche requested a review from crisbeto January 9, 2026 15:55
@JeanMeche JeanMeche marked this pull request as ready for review January 9, 2026 15:55
@JeanMeche JeanMeche marked this pull request as draft January 12, 2026 19:44
@JeanMeche JeanMeche force-pushed the switch-exhaustive-check branch 17 times, most recently from a160436 to 704a326 Compare January 20, 2026 13:39
@JeanMeche JeanMeche force-pushed the switch-exhaustive-check branch 2 times, most recently from ff75364 to f995a1e Compare February 5, 2026 13:09
@JeanMeche JeanMeche force-pushed the switch-exhaustive-check branch 4 times, most recently from 2a6af1c to d3cb3bf Compare February 10, 2026 17:02
@JeanMeche JeanMeche force-pushed the switch-exhaustive-check branch from d3cb3bf to 16a0c2f Compare February 12, 2026 17:58
@JeanMeche JeanMeche marked this pull request as ready for review February 12, 2026 17:59
@JeanMeche JeanMeche force-pushed the switch-exhaustive-check branch 2 times, most recently from 0a9e0b0 to b45fb26 Compare February 13, 2026 10:22
@JeanMeche JeanMeche added the action: merge The PR is ready for merge by the caretaker label Feb 13, 2026
`@switch` blocks can now enable exhaustive typechecking by adding `@default(never);` at the end of a `@switch` block.
@mattrbeck mattrbeck force-pushed the switch-exhaustive-check branch from b45fb26 to ca2e8be Compare February 17, 2026 16:55
@mattrbeck
Copy link
Member

G3 tests are passing after rerunning flakes. Looks like the GHA test failure is the language server timeout. Merging.

@mattrbeck mattrbeck merged commit 95b3f37 into angular:main Feb 17, 2026
21 of 25 checks passed
@mattrbeck
Copy link
Member

This PR was merged into the repository. The changes were merged into the following branches:

@JeanMeche JeanMeche deleted the switch-exhaustive-check branch February 17, 2026 18:25
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exhaustive @switch type-checking

3 participants