cquery-project / vscode-cquery

cquery plugin for Visual Studio Code
54 stars 16 forks source link

Rename picked up wrong target when renaming class object reference #32

Closed Esgariot closed 6 years ago

Esgariot commented 6 years ago

I used F2 to rename connector_rst reference here:

// my code
#include <systemc.h>
int sc_main(int argc, char* argv[])
{                    //   V cursor was here when pressing F2 to rename reference
    sc_signal<sc_logic> connector_rst, connector_clock;
// ... skipped
DUT.rst_i(connector_rst);
}

and instead of renaming connector_rst, cquery changed constructor in sc_signal class from <systemc.h> include from this:

// sc_signal.h from systemc.h library
// ...
public:

    sc_signal() // <--- constructor before "rename reference"
      : base_type( sc_gen_unique_name( "signal" ), value_type() )
      , m_negedge_event_p( 0 ) , m_posedge_event_p( 0 )
    {}

// ...

to this:

// sc_signal.h from systemc.h library
// ...
public:

    connector_rst() // <--- constructor after "rename reference"
      : base_type( sc_gen_unique_name( "signal" ), value_type() )
      , m_negedge_event_p( 0 ) , m_posedge_event_p( 0 )
    {}

// ...

Sadly I couldn't reproduce this issue, but as it was highly unexpected I thought I'd mention it anyway

jacobdufault commented 6 years ago

Is there an implicit ctor // did you do the rename very quickly after editing the file? It could be that the rename used an out of date index.

Closing since you can't repro.