Skip to content

Eliminate special case for extracting from a binary operator chain#18831

Merged
amcasey merged 1 commit into
microsoft:masterfrom
amcasey:AdditionSpecialCase
Sep 29, 2017
Merged

Eliminate special case for extracting from a binary operator chain#18831
amcasey merged 1 commit into
microsoft:masterfrom
amcasey:AdditionSpecialCase

Conversation

@amcasey
Copy link
Copy Markdown
Member

@amcasey amcasey commented Sep 28, 2017

  1. It assumed left-associativity and was, therefore, wrong for (e.g.) exponentiation.
  2. Arguably, if a user selects a + |b + c|, they want to extract b + c, not a + b + c. Not being able to do so is surprising (and we may eventually want to allow it), but so is having the rest of the least-common subtree extracted.

Fixes #18268

1) It assumed left-associativity and was, therefore, wrong for (e.g.)
exponentiation.
2) Arguably, if a user selects `a + |b + c|`, they want to extract `b +
c`, not `a + b + c`.  Not being able to do so is surprising (and we may
eventually want to allow it), but so is having the rest of the
least-common subtree extracted.

Fixes microsoft#18268
@DanielRosenwasser
Copy link
Copy Markdown
Member

Why not continue allowing it for associative operators like + and *?

@amcasey
Copy link
Copy Markdown
Member Author

amcasey commented Sep 29, 2017

@DanielRosenwasser I think it would be great to support that, but I'd want it to extract the range I specified - not an expanded range. Do you want to file a suggestion to that effect?

@amcasey
Copy link
Copy Markdown
Member Author

amcasey commented Sep 29, 2017

Offline, @DanielRosenwasser and I agreed that implementing the desired behavior is a separate issue.

@amcasey amcasey merged commit 7aee3a1 into microsoft:master Sep 29, 2017
@amcasey amcasey deleted the AdditionSpecialCase branch September 29, 2017 20:10
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants