mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 14:25:37 +02:00
Missing type proposals in qualified names, bug 255898
This commit is contained in:
parent
cec0ba6d45
commit
60311183ca
3 changed files with 35 additions and 19 deletions
|
@ -24,9 +24,9 @@ import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
|||
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.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
|
@ -314,25 +314,28 @@ public class CPPASTQualifiedName extends CPPASTNameBase
|
|||
|
||||
try {
|
||||
for (int i = 0; i < bindings.length; i++) {
|
||||
if (bindings[i] instanceof IField) {
|
||||
IField field = (IField) bindings[i];
|
||||
if (!field.isStatic()) continue;
|
||||
} else if (bindings[i] instanceof ICPPMethod) {
|
||||
ICPPMethod method = (ICPPMethod) bindings[i];
|
||||
if (method.isImplicit()) continue;
|
||||
if (method.isDestructor() || method instanceof ICPPConstructor) {
|
||||
if (!isDeclaration) continue;
|
||||
} else if (!method.isStatic() && !isDeclaration) {
|
||||
final IBinding binding = bindings[i];
|
||||
if (binding instanceof IField) {
|
||||
IField field = (IField) binding;
|
||||
if (!field.isStatic())
|
||||
continue;
|
||||
} else if (binding instanceof ICPPMethod) {
|
||||
ICPPMethod method = (ICPPMethod) binding;
|
||||
if (method.isImplicit())
|
||||
continue;
|
||||
if (!isDeclaration) {
|
||||
if (method.isDestructor() || method instanceof ICPPConstructor || !method.isStatic())
|
||||
continue;
|
||||
}
|
||||
} else if (bindings[i] instanceof ICPPClassType) {
|
||||
ICPPClassType type = (ICPPClassType) bindings[i];
|
||||
if (type.isSameType(classType)) continue;
|
||||
} else if (!(bindings[i] instanceof IEnumerator || bindings[i] instanceof IEnumeration) || isDeclaration) {
|
||||
continue;
|
||||
}
|
||||
|
||||
filtered.add(bindings[i]);
|
||||
} else if (binding instanceof IEnumerator || binding instanceof IEnumerator) {
|
||||
if (isDeclaration)
|
||||
continue;
|
||||
} else if (binding instanceof IType) {
|
||||
IType type = (IType) binding;
|
||||
if (type.isSameType(classType))
|
||||
continue;
|
||||
}
|
||||
filtered.add(binding);
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
}
|
||||
|
|
|
@ -252,9 +252,10 @@ public class ContentAssistTests extends BaseUITestCase {
|
|||
cu = importFile( "strategy.cpp", c2 ); //$NON-NLS-1$
|
||||
|
||||
results = getResults( cu, c2.indexOf( "::" ) + 2 ); //$NON-NLS-1$
|
||||
assertEquals( 2, results.length );
|
||||
assertEquals( 3, results.length );
|
||||
assertEquals( "getAbility(void) : enum _Ability", results[1].getDisplayString() ); //$NON-NLS-1$
|
||||
assertEquals( "Strategy(enum _Ability a)", results[0].getDisplayString() ); //$NON-NLS-1$
|
||||
assertEquals( "_Ability", results[2].getDisplayString() ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void testBug72559() throws Exception {
|
||||
|
|
|
@ -1187,4 +1187,16 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
final String[] expected= {"var : float"};
|
||||
assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS);
|
||||
}
|
||||
|
||||
// struct X {
|
||||
// typedef int TInt;
|
||||
// };
|
||||
// void main() {
|
||||
// X::T/*cursor*/ // content assist does not propose TInt
|
||||
// }
|
||||
public void testNestedTypesInQualifiedNames_Bug255898() throws Exception {
|
||||
final String[] expected= {"TInt"};
|
||||
assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue