Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-8661

Function signature refactoring is a bit overeager

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P4: Low
    • None
    • Qt Creator 2.7.0, Qt Creator 4.7.1
    • C/C++/Obj-C++ Support
    • None

    Description

      Consider the following function:

      QString joinWithDots(const QString &s1, const QString &s2, const QString &s3)
      {
          return s1 + '.' + s2 + '..' + s3;
      }
      

      Let there also be a declaration of it at some other place, e.g. a header file.
      Now let's say I want to wrap these parameters in a struct, and I change the signature in the declaration accordingly:

      struct strings {
          QString s1, s2, s3;
      };
      QString joinWithDots(const strings &s);
      

      When I tell Qt Creator to apply the signature change, it also changes the function body thusly:

      return s + '.' + s2 + '..' + s3;
      

      I can see how such behavior makes sense if only the name of a parameter changes, but this is clearly not a 1:1 mapping, since the number of parameters has changed, as well as the type of the first parameter. In such a case, the current behavior most likely does not match users' expectations.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            kandeler Christian Kandeler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes