mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Content assist displays anonymous types, bug 204758.
This commit is contained in:
parent
8e3a44eafe
commit
0fcdd959b4
4 changed files with 27 additions and 8 deletions
|
@ -110,7 +110,9 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase
|
|||
IParameter[] pars= f.getParameters();
|
||||
assertEquals(1, pars.length);
|
||||
IType type= pars[0].getType();
|
||||
assertTrue(type instanceof ICompositeType);
|
||||
assertInstance(type, ITypedef.class);
|
||||
type= ((ITypedef) type).getType();
|
||||
assertInstance(type, ICompositeType.class);
|
||||
}
|
||||
|
||||
// typedef enum {
|
||||
|
@ -130,9 +132,10 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase
|
|||
IParameter[] pars= f.getParameters();
|
||||
assertEquals(1, pars.length);
|
||||
IType type= pars[0].getType();
|
||||
assertInstance(type, ITypedef.class);
|
||||
type= ((ITypedef) type).getType();
|
||||
assertInstance(type, IEnumeration.class);
|
||||
assertTrue(type instanceof IEnumeration);
|
||||
// type= ((ITypedef) type).getType();
|
||||
// assertTrue(type instanceof IEnumeration);
|
||||
}
|
||||
|
||||
// int globalVar;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
|||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.index.IIndexFile;
|
||||
import org.eclipse.cdt.internal.core.Util;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
|
||||
|
@ -60,8 +59,6 @@ class PDOMCParameter extends PDOMNamedNode implements IParameter, IIndexFragment
|
|||
try {
|
||||
if(!(param instanceof IProblemBinding)) {
|
||||
IType type = param.getType();
|
||||
while(type instanceof ITypedef)
|
||||
type = ((ITypedef)type).getType();
|
||||
if (type != null) {
|
||||
PDOMNode typeNode = getLinkageImpl().addType(this, type);
|
||||
db.putInt(record + TYPE, typeNode != null ? typeNode.getRecord() : 0);
|
||||
|
|
|
@ -157,6 +157,8 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
// struct {int a3;} a4;
|
||||
// int b;
|
||||
// };
|
||||
// typedef enum {__nix} _e204758;
|
||||
// void _f204758(_e204758 x);
|
||||
|
||||
|
||||
public CompletionTests(String name) {
|
||||
|
@ -1166,4 +1168,10 @@ public class CompletionTests extends AbstractContentAssistTest {
|
|||
final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b", "s206450"};
|
||||
assertCompletionResults(expected);
|
||||
}
|
||||
|
||||
// void test() {_f204758/*cursor*/
|
||||
public void testTypedefToAnonymous_Bug204758() throws Exception {
|
||||
final String[] expected= {"_f204758(_e204758 x) : void"};
|
||||
assertCompletionResults(fCursorOffset, expected, COMPARE_DISP_STRINGS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* Markus Schorn (Wind River Systems)
|
||||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist2;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
@ -142,6 +141,10 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
|||
// struct {int a3;} a4;
|
||||
// int b;
|
||||
// };
|
||||
// #ifdef bug204758
|
||||
// typedef enum {__nix} _e204758;
|
||||
// void _f204758(_e204758 x);
|
||||
// #endif
|
||||
|
||||
//{DisturbWith.c}
|
||||
// int gTemp;
|
||||
|
@ -951,4 +954,12 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
|||
final String[] expected= {"a1", "a2", "u1", "u2", "a4", "b"};
|
||||
assertCompletionResults(expected);
|
||||
}
|
||||
|
||||
// #define bug204758
|
||||
///*include*/
|
||||
// void test() {_f204758/*cursor*/
|
||||
public void testTypedefToAnonymous_Bug204758() throws Exception {
|
||||
final String[] expected= {"_f204758(_e204758)"};
|
||||
assertCompletionResults(expected);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue