Skip to content

Add test which would fail if SFT behavior differs in variance checking #54756

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

weswigham
Copy link
Member

While looking at #54542, since the issue doesn't reproduce when strict function types isn't enabled, it was pretty easy to fall into the trap of thinking that maybe variance checking should just have strict function types enabled all the time.

However, working through it, you can come up with some pretty simple examples that divergent behavior of that sort would break, which, amazingly, aren't covered at all in our test suite (so you can actually make a PR that locks SFT to on during variance checking and all the tests pass, even though it breaks some pretty simple stuff!).

So this is just to improve our test coverage, so the next time someone (like me) starts thinking this way, this test can quickly point out why that's not really a viable solution.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 23, 2023
@@ -0,0 +1,28 @@
// @strict: false
// @strictFunctionTypes: false
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it'd be better to do false, true for these?

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have tests covering the true case (as part of much larger tests - basically any variance-related test), just not the false.

@weswigham weswigham merged commit aec9e23 into microsoft:main Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants