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

Already on GitHub? Sign in to your account

Keeping error context for tuple length mismatch #14003

Merged
merged 42 commits into from
Oct 25, 2022

Conversation

0101
Copy link
Contributor

@0101 0101 commented Sep 30, 2022

Followup for #13347

When a tuple length mismatch happens within a situation where we keep additional context, we show a context-aware error message. E.g.

let f1(a, b: string, c) =
    if true then (1, 2) else (a, b, c)
All branches of an 'if' expression must return values implicitly convertible to the type of the first branch, which here is a tuple of length 2 of type
    int * int    
This branch returns a tuple of length 3 of type
    'a * string * 'b 

edgarfgp and others added 27 commits August 7, 2022 09:53
…b.com:edgarfgp/fsharp into wrong-type-is-reported-in-type-mismatch-error
@0101 0101 changed the title [WIP] Tuple length mismatch context [WIP] Keeping error context for tuple lenght mismatch Sep 30, 2022
@0101 0101 changed the title [WIP] Keeping error context for tuple lenght mismatch [WIP] Keeping error context for tuple length mismatch Sep 30, 2022
@0101 0101 changed the title [WIP] Keeping error context for tuple length mismatch Keeping error context for tuple length mismatch Oct 18, 2022
@0101 0101 marked this pull request as ready for review October 18, 2022 08:58
@T-Gro
Copy link
Member

T-Gro commented Oct 24, 2022

Can we merge here or is it still waiting?
IMO this is already an improvement for the "Simple F#" theme.

T-Gro
T-Gro previously approved these changes Oct 24, 2022
@0101
Copy link
Contributor Author

0101 commented Oct 24, 2022

@T-Gro this can be merged after it's reviewed.

Copy link
Member

@abonie abonie left a comment

Choose a reason for hiding this comment

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

Looks like a great step towards better compiler error messages 👍

src/Compiler/FSComp.txt Show resolved Hide resolved
@0101 0101 merged commit 4ad5615 into dotnet:main Oct 25, 2022
@0101 0101 deleted the tuple-length-mismatch-context branch October 25, 2022 15:45
@vzarytovskii vzarytovskii added this to the October-2022 milestone Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants