Skip to content

Regression on PR 31 for cascading assignments #38

Closed

Description

@Rassi

PR 31 introduced regressions for cascading assignments, not indenting them past the second assignment.

#31 (comment)

Expected versus output diff:

diff --git "a/C:\\dev\\uncrustify\\tests\\output\\staging\\60038-UNI-30088.cpp" "b/C:\\dev\\uncrustify\\tests\\results\\staging\\60038-UNI-30088.cpp"
index 1fd5c1f..9c9fa4f 100644
--- "a/C:\\dev\\uncrustify\\tests\\output\\staging\\60038-UNI-30088.cpp"
+++ "b/C:\\dev\\uncrustify\\tests\\results\\staging\\60038-UNI-30088.cpp"
@@ -1,9 +1,9 @@
 void Foo(int value)
 {
     m_Foo[0].prop
         = m_Foo[1].prop
-            = m_Foo[2].prop
+                = m_Foo[2].prop
                 = m_Foo[3].prop
-                    = m_Foo[4].prop
-                        = m_Foo[5].prop = value;
+                = m_Foo[4].prop
+                = m_Foo[5].prop = value;
 }

Debug support files:

60038-UNI-30088.cpp
60038-UNI-30088.cpp.log
60038-UNI-30088.cpp.unc
UNI-30088.cfg
UNI-30088.cpp

Disclaimer:

Note: This is a generated issue from our internal issue tracker.
Expect a dry description which could be insufficient to properly understand the issue.
On the other hand, the support files should be sufficient to easily reproduce and debug the issue,
but please comment if it's still unclear and I will get back with clarifications.
See main discussion thread here uncrustify#1223.

Activity

  1. spuppala-rythmos commented on Nov 1, 2017

    @spuppala-rythmos

    we checked out the code before the fix went into master and ran the test case.
    we still see the issue and concluded that this is not a Regression on PR 31,
    hence it will be better if new issue is created for this in the upstream.

    Expected versus output diff before PR-31

    diff --git a/ip.cpp b/op
    index ef3612d8..c095998a 100644
    --- a/ip.cpp
    +++ b/op
    @@ -1,9 +1,9 @@
     void Foo(int value)
     {
         m_Foo[0].prop
    -        = m_Foo[1].prop
    -            = m_Foo[2].prop
    -                = m_Foo[3].prop
    -                    = m_Foo[4].prop
    -                        = m_Foo[5].prop = value;
    +       = m_Foo[1].prop^M
    +               = m_Foo[2].prop^M
    +                       = m_Foo[3].prop^M
    +                               = m_Foo[4].prop^M
    +                                       = m_Foo[5].prop = value;^M
     }
  2. Rassi commented on Nov 1, 2017

    @Rassi
    Author

    You are correct, the test still fails before #31 (eb15b2d), but it does show that the cascading is better than after #31 (a9036c7).

    I've corrected the test in master (b89e8ec) so that it succeeds in eb15b2d, and it fails after merge of #31 (a9036c7):

    diff --git a/output/staging/60038-UNI-30088.cpp b/results/staging/60038-UNI-30088.cpp
    index d6a81b4c..9c9fa4f4 100644
    --- a/output/staging/60038-UNI-30088.cpp
    +++ b/results/staging/60038-UNI-30088.cpp
    @@ -3,7 +3,7 @@ void Foo(int value)
         m_Foo[0].prop
             = m_Foo[1].prop
                     = m_Foo[2].prop
    -                        = m_Foo[3].prop
    -                                = m_Foo[4].prop
    -                                        = m_Foo[5].prop = value;
    +                = m_Foo[3].prop^M
    +                = m_Foo[4].prop^M
    +                = m_Foo[5].prop = value;^M
     }
  3. agandavarapu-rythmos commented on Nov 1, 2017

    @agandavarapu-rythmos

    Yes, We understand the issue,
    initially it was doing wrong indentation although it looked better (1 extra indent for the first line and 2 extra indents for the 3rd and below lines, which i dont think we want it like that,). We have a fix to get everything to one extra indentation for each line from the above line. The fix (the logic which was not working properly previously was fixed here.) we did was applying to only = before a newline,but including = after newline will fix everything.

  4. mihaipopescu commented on Nov 1, 2017

    @mihaipopescu

    will fix everything

    @aneesh1127 I like your optimism 👍

    jokes aside ... what I think we expect is a single level of indentation (4 spaces) like in your test @satishp87 here.

  5. Rassi commented on Nov 1, 2017

    @Rassi
    Author

    If you're saying there's another issue which covers this, then feel free to reference it and close this issue.

  6. mihaipopescu commented on Nov 1, 2017

    @mihaipopescu

    We've discussed here with @Rassi and there was a misunderstanding on what we what this issue represents and how should it be fixed, namely the what what regression means.

    If we note your fix with F which was merged into master, it contains a good partial fix, noted G and a regression: F = G + R. What we wanted is you do another fix H which will contain the removal of the regression and the complete fix C, leaving us with: F' = F + H = (G + R) + (-R + C) = G + C.

    For that, Rasmus pushed a new updated test on master where he asserts that we expect the regression to be fixed first, that is removing the bad effects entirely from the source and getting back to the double indentation as it was before.

    To be clear, in the end we still want the one level of indentation as it was before the update here but it's a matter of process.

    It's your choice if you want to do one PR removing the regression and the second one doing the proper fix for this case as well, or doing them both in one PR. It's up to you.

    Sorry for the confusion, I hope this clarifies the problem a bit more.

  7. added a commit that references this issue on Nov 1, 2017
  8. agandavarapu-rythmos commented on Dec 5, 2017

    @agandavarapu-rythmos

    merged under PR #57.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions