1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 415495 - typedef/type alias change code completion proposals

Change-Id: I963ff5fc2ae073f233b04eb6a5a521d0e6610af7
Signed-off-by: Michi <woskimi@yahoo.de>
Reviewed-on: https://git.eclipse.org/r/38029
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Michi 2014-05-14 12:07:29 +02:00 committed by Sergey Prigogin
parent 07dcb970fa
commit 702f5cb4c8
2 changed files with 28 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2013 IBM Corporation and others.
* Copyright (c) 2004, 2014 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
@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNameSpecifier;
@ -328,6 +329,12 @@ public class CPPASTQualifiedName extends CPPASTNameBase
if (fQualifierPos >= 0) {
IBinding binding = fQualifier[fQualifierPos].resolveBinding();
while (binding instanceof ITypedef) {
ITypedef typedef = (ITypedef) binding;
binding = (IBinding) typedef.getType();
}
if (binding instanceof ICPPClassType) {
ICPPClassType classType = (ICPPClassType) binding;
final boolean isDeclaration = getParent().getParent() instanceof IASTSimpleDeclaration;

View file

@ -17,6 +17,11 @@
*******************************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist2;
import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.CONTEXT;
import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.DISPLAY;
import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.ID;
import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.REPLACEMENT;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
@ -36,8 +41,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
import static org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest.CompareType.*;
/**
* A collection of code completion tests.
*
@ -99,6 +102,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// void m1private();
// };
// typedef C1 T1;
// using A1 = C1;
//
// class C2 : public T1 {
// public:
@ -667,8 +671,7 @@ public class CompletionTests extends AbstractContentAssistTest {
//# d/*cursor*/
public void testCompletePreprocessorDirective2() throws Exception {
final String[] expected= { "define " };
assertCompletionResults(fCursorOffset, expected,
REPLACEMENT);
assertCompletionResults(fCursorOffset, expected, REPLACEMENT);
}
//# if d/*cursor*/
@ -691,6 +694,18 @@ public class CompletionTests extends AbstractContentAssistTest {
assertCompletionResults(fCursorOffset, expected, ID);
}
//void f(){T1::~/*cursor*/
public void testTypedefSyntheticMembers_415495() throws Exception {
final String[] expected= {};
assertCompletionResults(fCursorOffset, expected, REPLACEMENT);
}
//void f(){A1::~/*cursor*/
public void testAliasSyntheticMembers_415495() throws Exception {
final String[] expected= {};
assertCompletionResults(fCursorOffset, expected, REPLACEMENT);
}
// struct A {};
//
// template<typename T>