mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
201177: apply fix + add test from Sergey
This commit is contained in:
parent
8629e6b5d1
commit
1be0d21863
5 changed files with 51 additions and 6 deletions
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Ferguson (Symbian) - Initial implementation
|
* Andrew Ferguson (Symbian) - Initial implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.index.tests;
|
package org.eclipse.cdt.internal.index.tests;
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||||
|
@ -61,6 +63,45 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
suite.addTest(suite(ProjectWithDepProj.class));
|
suite.addTest(suite(ProjectWithDepProj.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// namespace ns { class A; enum E {E1}; typedef int T; }
|
||||||
|
//
|
||||||
|
// class B {
|
||||||
|
// public:
|
||||||
|
// void m(ns::A* a);
|
||||||
|
// void n(ns::E* a);
|
||||||
|
// void o(ns::T* a);
|
||||||
|
// void p(ns::E a);
|
||||||
|
// };
|
||||||
|
|
||||||
|
// namespace ns {
|
||||||
|
// class A {};
|
||||||
|
// typedef int T;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// using ns::A;
|
||||||
|
// using ns::E;
|
||||||
|
// using ns::T;
|
||||||
|
// using ns::E1;
|
||||||
|
//
|
||||||
|
// void B::m(A* a) {}
|
||||||
|
// void B::n(E* a) {}
|
||||||
|
// void B::o(T* a) {}
|
||||||
|
// void B::p(E a) {}
|
||||||
|
//
|
||||||
|
// void usage() {
|
||||||
|
// B b;
|
||||||
|
// b.p(E1);
|
||||||
|
// }
|
||||||
|
public void testUsingTypeDirective_201177() {
|
||||||
|
IBinding b0= getBindingFromASTName("B::m", 4);
|
||||||
|
IBinding b1= getBindingFromASTName("B::n", 4);
|
||||||
|
IBinding b2= getBindingFromASTName("B::o", 4);
|
||||||
|
IBinding b3= getBindingFromASTName("p(E1)", 1);
|
||||||
|
assertInstance(b0, ICPPMethod.class);
|
||||||
|
assertInstance(b1, ICPPMethod.class);
|
||||||
|
assertInstance(b2, ICPPMethod.class);
|
||||||
|
}
|
||||||
|
|
||||||
// namespace n { class A{}; class B{}; class C{}; }
|
// namespace n { class A{}; class B{}; class C{}; }
|
||||||
|
|
||||||
// namespace m {
|
// namespace m {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
/*
|
/*
|
||||||
* Created on Nov 29, 2004
|
* Created on Nov 29, 2004
|
||||||
|
@ -794,10 +795,10 @@ public class CPPClassType extends PlatformObject implements ICPPClassType, ICPPI
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
||||||
*/
|
*/
|
||||||
public boolean isSameType( IType type ) {
|
public boolean isSameType( IType type ) {
|
||||||
if( type == this )
|
if (type == this)
|
||||||
return true;
|
return true;
|
||||||
if( type instanceof ITypedef || type instanceof IIndexType)
|
if (type instanceof ITypedef || type instanceof IIndexType || type instanceof ICPPDelegate)
|
||||||
return type.isSameType( this );
|
return type.isSameType(this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -188,7 +189,7 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
|
||||||
public boolean isSameType( IType type ) {
|
public boolean isSameType( IType type ) {
|
||||||
if( type == this )
|
if( type == this )
|
||||||
return true;
|
return true;
|
||||||
if( type instanceof ITypedef || type instanceof IIndexType)
|
if( type instanceof ITypedef || type instanceof IIndexType || type instanceof ICPPDelegate)
|
||||||
return type.isSameType( this );
|
return type.isSameType( this );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
@ -129,7 +130,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSameType(IType type) {
|
public boolean isSameType(IType type) {
|
||||||
if (type instanceof ITypedef) {
|
if (type instanceof ITypedef || type instanceof ICPPDelegate) {
|
||||||
return type.isSameType(this);
|
return type.isSameType(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ class PDOMCPPEnumeration extends PDOMCPPBinding
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSameType(IType type) {
|
public boolean isSameType(IType type) {
|
||||||
if (type instanceof ITypedef) {
|
if (type instanceof ITypedef || type instanceof ICPPDelegate) {
|
||||||
return type.isSameType(this);
|
return type.isSameType(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue