Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(instrumenter): don't break optional chains #3156

Merged
merged 2 commits into from Sep 30, 2021
Merged

fix(instrumenter): don't break optional chains #3156

merged 2 commits into from Sep 30, 2021

Conversation

simondel
Copy link
Member

@simondel simondel commented Sep 24, 2021

Don't break optional chains when a TypeScript NonNullExpression is involved

- input?.id!.toString();
+ stryMutAct_9fa48("1") ? input.id!.toString() : (stryCov_9fa48("1"), input?.id!.toString());

Instead of

- input?.id!.toString();
+ (stryMutAct_9fa48("1") ? input.id : (stryCov_9fa48("1"), input?.id))!.toString();
// breaks optional chain! 馃挜馃敆

Fixes #3080

Copy link
Member

@nicojs nicojs left a comment

Choose a reason for hiding this comment

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

Quick review from my phone 馃こ.

Great to see it's only a small change

@nicojs nicojs enabled auto-merge (squash) September 30, 2021 15:09
@nicojs nicojs merged commit 95e6b69 into master Sep 30, 2021
@nicojs nicojs deleted the 3080-non-null branch September 30, 2021 15:26
@nicojs nicojs changed the title fix(instrumenter): Handle TypeScript NonNullExpression fix(instrumenter): don't break optional chains Sep 30, 2021
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.

Optional chaining mutator fails when followed by TypeScript !
2 participants