| Summary: | Failing refactoring test | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Emanuel Graf <emanuel> | ||||
| Component: | cdt-refactoring | Assignee: | Emanuel Graf <emanuel> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Emanuel Graf <emanuel> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cdtdoug, mschorn.eclipse | ||||
| Version: | 8.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Emanuel Graf
The failing tests are caused by a change in CPPASTIdExpression.getExpressionType(). The type for this example was "CPPTypedef foo" and now is "CompositeCPPClassInstance std::basic_string<char,std::char_traits<char>,std::allocator<char>>"
#include <string>
typedef std::string foo;
int main() {
foo s = "foo";
s =
"<" + s + ">"; //Expression of interest
return 0;
}
Markus can you point me to an solution for this?
The typedef is expanded, because the type of the id-expression can be different to the type of the variable. E.g.:
typedef int& foo;
int test(foo s) {
int a= s + 1; // type of id-expression 's' is int, not 'foo' or 'int&'
}
The original type of the variable can be obtained via
IBinding b= IASTIdExpression.getName().resolveBinding();
IType varType= ((IVariable) b).getType();
Created attachment 184715 [details]
Fix and test case for Markus's example
*** cdt cvs genie on behalf of egraf *** Bug 331985: Failing refactoring test Fix and test case [*] ExtractExpression.java 1.14 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractfunction/ExtractExpression.java?root=Tools_Project&r1=1.13&r2=1.14 [*] ExtractExpression.rts 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractExpression.rts?root=Tools_Project&r1=1.6&r2=1.7 Fixed in HEAD > 20101207 |