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

Add match! to structure #5473

Merged
merged 5 commits into from
Sep 7, 2018
Merged

Add match! to structure #5473

merged 5 commits into from
Sep 7, 2018

Conversation

cartermp
Copy link
Contributor

@cartermp cartermp commented Aug 7, 2018

Fixes #5456

image

@cartermp cartermp closed this Aug 7, 2018
@cartermp cartermp reopened this Aug 7, 2018
@@ -259,7 +260,7 @@ module Structure =
| SynExpr.LetOrUse (_,_,bindings, body, _) ->
parseBindings bindings
parseExpr body
| SynExpr.Match (seqPointAtBinding,_expr,clauses,_,r) ->
| SynExpr.Match (seqPointAtBinding,_expr,clauses,_,r) | SynExpr.MatchBang (seqPointAtBinding, _expr, clauses, _, r) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

I’m sure there no such formatting in the whole repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@KevinRansom KevinRansom Sep 6, 2018

Choose a reason for hiding this comment

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

@cartermp,
From a readability perspective, I think we should prefer the fall through match, I agree with @vasily-kirichenko.

It is a certainty that we can, using this repo, point to an example of every type of formatting style that could possibly exist. For sure fall through matches with the separate cases per line is the most common, and I think readable format.
Kevin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change it. I'll also change the other case in the compiler that does this.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks mate

| Some _ -> () // 7
| None -> // 8
let x = () // 9
() // 10
Copy link
Contributor

Choose a reason for hiding this comment

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

The example code is not realistical.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just like the other tests. Do you have a suggested improvement?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe {
    match! Some None with     
    | Some _ ->          
        ()               
    | None ->            
        match None with  
        | Some _ -> ()   
        | None ->        
            let x = ()   
            ()
}                       

@cartermp cartermp changed the title [DO NOT MERGE] Add match! to structure Add match! to structure Aug 15, 2018
@@ -259,7 +260,7 @@ module Structure =
| SynExpr.LetOrUse (_,_,bindings, body, _) ->
parseBindings bindings
parseExpr body
| SynExpr.Match (seqPointAtBinding,_expr,clauses,_,r) ->
| SynExpr.Match (seqPointAtBinding,_expr,clauses,_,r) | SynExpr.MatchBang (seqPointAtBinding, _expr, clauses, _, r) ->
Copy link
Member

@KevinRansom KevinRansom Sep 6, 2018

Choose a reason for hiding this comment

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

@cartermp,
From a readability perspective, I think we should prefer the fall through match, I agree with @vasily-kirichenko.

It is a certainty that we can, using this repo, point to an example of every type of formatting style that could possibly exist. For sure fall through matches with the separate cases per line is the most common, and I think readable format.
Kevin

@KevinRansom
Copy link
Member

Thanks mate.

@cartermp
Copy link
Contributor Author

cartermp commented Sep 6, 2018

Also rebased atop master.

@KevinRansom KevinRansom closed this Sep 7, 2018
@KevinRansom KevinRansom reopened this Sep 7, 2018
@KevinRansom KevinRansom merged commit 114c6d2 into dotnet:master Sep 7, 2018
@cartermp cartermp deleted the structure-fix branch September 7, 2018 22:24
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.

3 participants