Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331985 - Failing refactoring test
Summary: Failing refactoring test
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Emanuel Graf CLA
QA Contact: Emanuel Graf CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-07 03:02 EST by Emanuel Graf CLA
Modified: 2010-12-07 09:43 EST (History)
2 users (show)

See Also:


Attachments
Fix and test case for Markus's example (4.14 KB, patch)
2010-12-07 08:24 EST, Emanuel Graf CLA
emanuel: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuel Graf CLA 2010-12-07 03:02:46 EST
Some changes caused 2 tests to fail.
Comment 1 Emanuel Graf CLA 2010-12-07 05:12:55 EST
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?
Comment 2 Markus Schorn CLA 2010-12-07 07:26:39 EST
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();
Comment 3 Emanuel Graf CLA 2010-12-07 08:24:03 EST
Created attachment 184715 [details]
Fix and test case for Markus's example
Comment 5 Emanuel Graf CLA 2010-12-07 09:43:22 EST
Fixed in HEAD > 20101207