Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 51841

Summary: [Content Assist] Context-specifics are not considered when completion list is requested
Product: [Tools] CDT Reporter: James Ciesielski <jciesiel>
Component: cdt-parserAssignee: John Camelon <john.camelon>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: aniefer
Version: 2.0   
Target Milestone: 2.0   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on:    
Bug Blocks: 50807, 57692, 57898    

Description James Ciesielski CLA 2004-02-12 10:30:07 EST
Eclipse 3.0M6
CDT Build 2.0.0.0031
Sun JDK 1.4.2_02

Test case:
1. Create a managed make C++ project.
2. Add a file, call it main.cpp.
3. Insert the following code into main.cpp:

	class CMine {
	  public:	
		CMine() {}
		int getMyInt()	{ return m_nMyInt; }
		
	  private:
		int m_nMyInt;
	};
	
	int
	main(int argc, char **argv) {
		CMine cm;
		cm->[^SPC]; // ** (A) **
	}

4. Execute Content Assist on line (A) using the prefix "cm" and the "->" reference.

Expected: I expected to receive a message indicating that the refernce "->" was
being used incorrectly.  Instead the "getMyInt()" method was inserted, leaving
the user with code that will generate a compilation error.
Comment 1 John Camelon CLA 2004-02-12 10:33:54 EST
Agreed, this is happening because we are passing back an IASTTypeSpecifier as 
the context rather than the actual raw type of the object ... an 
IASTAbstactDeclaration (with pointer modifiers).  

Comment 2 John Camelon CLA 2004-04-06 14:26:05 EDT
Update summary to add [Content Assist] tag for easy searching.  
Comment 3 John Camelon CLA 2004-04-06 15:26:29 EDT
Andrew, I will fix the factory/parser to return the right IASTNode ... but I 
also think that this may require some updates to ASTNode.lookup() : I'll 
assign it your way if that is the case.  

Consider yourself forewarned!
Comment 4 John Camelon CLA 2004-04-25 17:57:42 EDT
This has been fixed in HEAD.  
Comment 5 Pixy CLA 2004-06-08 10:45:08 EDT
This is verified on Eclipse build 20040603 and CDT build 200406030301, and it 
passes.

Pixy.
Comment 6 Kleo Hapitas CLA 2004-07-07 18:46:23 EDT
marking it verified