| Summary: | Rename does not rename methods with const parameters | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Marc-André Laperle <malaperle> | ||||||
| Component: | cdt-refactoring | Assignee: | Markus Schorn <mschorn.eclipse> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Emanuel Graf <emanuel> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | cdtdoug | ||||||
| Version: | 6.0 | ||||||||
| Target Milestone: | 7.0.2 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 183021 [details]
Test
I can also reproduce this with 6.0 and 7.0.1. The method ASTManager.isSameType(IType t1, IType t2) returns false, it probably shouldn't. t1 is a CPPQualifierType and t2 is a CPPBasicType. Maybe a problem in the parser? Created attachment 183372 [details]
fix
The type comparison is correct, however the type of the IParameter binding can differ from the corresponding element in the function-type. (The 'const int' is adjusted to an 'int'). So to compare two functions, the function type has to be used.
Fixed in 8.0 > 20101118. *** cdt cvs genie on behalf of mschorn *** Bug 330123: Rename refactoring and const parameters. [*] ASTManager.java 1.25 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/ASTManager.java?root=Tools_Project&r1=1.24&r2=1.25 (In reply to comment #5) > Fixed in 8.0 > 20101118. Awesome, thanks! I think this change can be applied to 7.0.2 also? And would it be possible to add the test? It passes now with the patch applied. (In reply to comment #7) > (In reply to comment #5) > > Fixed in 8.0 > 20101118. > Awesome, thanks! I think this change can be applied to 7.0.2 also? And would it > be possible to add the test? It passes now with the patch applied. Sorry, I forgot to commit your testcase. I can also port the fix to 7.0.2. Fixed in 7.0.2 > 20101124. *** cdt cvs genie on behalf of mschorn *** Bug 330123: Testcase for renaming function with const parameter. [*] RenameFunctionTests.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/rename/RenameFunctionTests.java?root=Tools_Project&r1=1.2&r2=1.3 [*] ASTManager.java 1.16.2.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/ASTManager.java?root=Tools_Project&r1=1.16.2.1&r2=1.16.2.2 [*] RenameFunctionTests.java 1.2.6.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/rename/RenameFunctionTests.java?root=Tools_Project&r1=1.2&r2=1.2.6.1 |
Using CDT 8.0.0.201011111203 (hudson build #412). TestRename.h: #ifndef TESTRENAME_H_ #define TESTRENAME_H_ class TestRename { void foo(const int bar); }; #endif TestRename.cpp #include "TestRename.h" void TestRename::foo(const int bar) { } Try renaming foo, it won't change the other one. Removing the const works.