1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for 199598: [content assist] enumeration missing from proposals in qualified name (Patch by Ed Swartz)

This commit is contained in:
Anton Leherbauer 2008-01-11 10:32:19 +00:00
parent da553be6cd
commit f767541c12
3 changed files with 19 additions and 5 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName;
@ -301,7 +302,7 @@ public class CPPASTQualifiedName extends CPPASTNode implements
} else if (bindings[i] instanceof ICPPClassType) {
ICPPClassType type = (ICPPClassType) bindings[i];
if (type.isSameType(classType)) continue;
} else if (!(bindings[i] instanceof IEnumerator) || isDeclaration) {
} else if (!(bindings[i] instanceof IEnumerator || bindings[i] instanceof IEnumeration) || isDeclaration) {
continue;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -221,10 +221,13 @@ public class ContentAssistTests extends BaseUITestCase {
cu = importFile( "strategy.cpp", c2 ); //$NON-NLS-1$
results = getResults( cu, c2.indexOf( "::" ) + 2 ); //$NON-NLS-1$
assertEquals( 3, results.length );
assertEquals( 4, results.length );
assertEquals( "CHEAT", results[0].getDisplayString() ); //$NON-NLS-1$
assertEquals( "IDIOT", results[1].getDisplayString() ); //$NON-NLS-1$
assertEquals( "NORMAL", results[2].getDisplayString() ); //$NON-NLS-1$
// "_Ability" is here due to fix for bug 199598
// Difficult to differentiate between declaration and expression context
assertEquals( "_Ability", results[3].getDisplayString() ); //$NON-NLS-1$
// in a method definition context, constructors and methods should be proposed

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -885,6 +885,16 @@ public class CompletionTests extends AbstractContentAssistTest {
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
}
// void test() {
// C1::/*cursor*/
public void testEnumInClass_bug199598() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=199598
final String[] expected= {
"E2", "e21", "e22"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_ID_STRINGS);
}
// class Union/*cursor*/
public void testElaboratedTypeSpecifierNotClass2_bug208710() throws Exception {
final String[] expected= new String[0];