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

Parameter detection in "Extract function" is fragile

    XMLWordPrintable

Details

    Description

      1. Create a new Qt Widgets Application using the wizard.
      2. In the main function, select the line
        w.show();
        
      3. From the context menu, select "Refactor" -> "Extract Function".
      4. Type a name for the new function and click "OK".
        You'll either get a function with the required parameter:
        void newFunction(MainWindow w)
        {
            w.show();    
        }
        

        or a function without the parameter which will not compile:

        void newFunction()
        {
            w.show();    
        }
        
      5. Undo the refactoring.
      6. Repeat steps 2 to 4.
        Sometimes you'll get the correct function, sometimes the compile error.

      Refactoring should always result in the same correct code.

      Attachments

        Issue Links

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

          Activity

            People

              kandeler Christian Kandeler
              rlohning Robert Löhning
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes