Update pattern matching error message.#5007
Merged
KevinRansom merged 4 commits intodotnet:masterfrom May 26, 2018
Merged
Conversation
Contributor
|
Excellent, the message has always been tricky to understand. |
vasily-kirichenko
approved these changes
May 25, 2018
cartermp
approved these changes
May 25, 2018
Contributor
cartermp
left a comment
There was a problem hiding this comment.
I like this change a lot.
forki
approved these changes
May 25, 2018
Contributor
|
@isaacabraham I'll take care of the errors. |
| /// (Originally from ../FSComp.txt:24) | ||
| static member elseBranchHasWrongType(a0 : System.String, a1 : System.String) = (GetStringFunc("elseBranchHasWrongType",",,,%s,,,%s,,,") a0 a1) | ||
| /// All branches of a pattern match expression must have the same type. This expression was expected to have type '%s', but here has type '%s'. | ||
| /// All branches of a pattern match expression must return values of the same type. The first branch returned a value of type '%s', but this branch returned a value of type '%s'. |
Contributor
There was a problem hiding this comment.
shouldn't it still be return expressions and returned an expression ?
Contributor
Author
There was a problem hiding this comment.
Hmmmm. I'm not sure :-)
Contributor
Author
|
@KevinRansom I'm not sure what the error is anyway - can you explain for future reference? Thanks! |
Contributor
|
The error is: The fix is to run : |
Contributor
|
@isaacabraham The expected text needs updating |
Contributor
|
@dotnet-bot test Ubuntu16.04 Release_default Build please |
KevinRansom
approved these changes
May 26, 2018
Contributor
|
Thank you. |
Contributor
Author
|
Thank you for fixing the tests. Next time I'll check that stuff myself, now that I know what's needed! |
Contributor
|
Thank for the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a small change that (IMO) improves the error message displayed when different branches of a pattern match return values of different types.
Before
All branches of a pattern match expression must have the same type. This expression was expected to have type 'string', but here has type 'int'.
After
All branches of a pattern match expression must return values of the same type. The first branch returned a value of type 'string', but this branch returned a value of type 'int'."