Skip to content

Add features to offer using conditional expressions ?: over explicit if-statement flows.#26236

Merged
ivanbasov merged 122 commits intodotnet:masterfrom
CyrusNajmabadi:useConditionalExpressionActualFeature
May 3, 2018
Merged

Add features to offer using conditional expressions ?: over explicit if-statement flows.#26236
ivanbasov merged 122 commits intodotnet:masterfrom
CyrusNajmabadi:useConditionalExpressionActualFeature

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Apr 18, 2018

Note: this PR depends on #25865. It should not be reviewed until that dependent PR is reviewed.

For example, with:

image

We offer:

image

Todo:

  • VB
  • Tests
  • Better formatting for large or multi-line clauses in the ?: expression.
  • Support this for if-statements with return statements in their bodies.

For the last one, this means recognizing:

if (expr) {
    return a;
} else {
    return b;
}

// as well as

if (expr) {
    return a;
}

return b;

and offering to convert to:

return expr ? a : b;

[jcouv edited] Fixes #26539

@ivanbasov
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi , thank you! I prefer reviewing such great PR using CodeFlow not just browser view. However, CodeFlow supports up to 64 commits and the current PR contains 114 ones. Do you see any options to squeeze or to split the PR? Thanks!

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Do you see any options to squeeze or to split the PR? Thanks!

That's problematic. I often branch off of these PRs, and squeezing/squashing things ends up making life very painful across those branches :(

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Let me see if there's anything i can pull out here...

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Darn... i'm not seeing anything conducive to pulling out. I kept this PR pretty self contained.

@KirillOsenkov Do you know why CodeFlow has a 64 commit limit? Is htat something that can be changed?

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Actually, i guess i could make a squashed PR from anotehr branch and have you review that. i'd then make the changes here and merge that back into the other branch. let me try that out.

@KirillOsenkov
Copy link
Copy Markdown
Member

It’s not a CodeFlow problem, it’s GitHub rate limits.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@ivanbasov can you sign off on this one?

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@KirillOsenkov That's a pity. Could it lazily be pulled in in the BG at some acceptable rate?

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@jinujoseph Can this be merged in? @ivanbasov signed off on #26572 which is the squashed version of this. That was create for him because of codeflow issues. However, i would like to merge this in as i have several downstream branches and it will be a pain if they have to deal with the rebased/squashed PR.

@jinujoseph
Copy link
Copy Markdown
Contributor

Approved to merge for 15.8.Preview2 ( once ivan signs of)

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@ivanbasov can you sign off plz? Thanks!

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@ivanbasov @jinujoseph for merging.

@ivanbasov ivanbasov merged commit 0949463 into dotnet:master May 3, 2018
@ivanbasov
Copy link
Copy Markdown
Contributor

Thank you very much, @CyrusNajmabadi, for you help!

@CyrusNajmabadi CyrusNajmabadi deleted the useConditionalExpressionActualFeature branch May 3, 2018 19:58
@sharwell sharwell added this to the 15.8 milestone Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants