mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
bug 525288 - resolve partial template specializations in
CSourceHover/OpenDeclaration Change-Id: I61c06fc453499ddc2b1af73a8a69d4b648d473c3 Signed-off-by: Michael Woski <woskimi@yahoo.de>
This commit is contained in:
parent
89ebafa72e
commit
a7be934ba2
2 changed files with 30 additions and 3 deletions
|
@ -512,7 +512,7 @@ public class HeuristicResolver {
|
||||||
*/
|
*/
|
||||||
public static IBinding[] resolveUnknownBinding(ICPPUnknownBinding binding) {
|
public static IBinding[] resolveUnknownBinding(ICPPUnknownBinding binding) {
|
||||||
if (binding instanceof ICPPDeferredClassInstance) {
|
if (binding instanceof ICPPDeferredClassInstance) {
|
||||||
return new IBinding[] { ((ICPPDeferredClassInstance) binding).getClassTemplate() };
|
return new IBinding[] { chooseTemplateForDeferredInstance((ICPPDeferredClassInstance) binding) };
|
||||||
} else if (binding instanceof ICPPUnknownMember) {
|
} else if (binding instanceof ICPPUnknownMember) {
|
||||||
Set<HeuristicLookup> lookupSet = new HashSet<>();
|
Set<HeuristicLookup> lookupSet = new HashSet<>();
|
||||||
return lookInside(((ICPPUnknownMember) binding).getOwnerType(), false,
|
return lookInside(((ICPPUnknownMember) binding).getOwnerType(), false,
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.FileManager;
|
import org.eclipse.cdt.core.testplugin.FileManager;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
|
import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
|
||||||
|
|
||||||
|
@ -1364,4 +1365,30 @@ public class CPPSelectionTestsNoIndexer extends BaseSelectionTests {
|
||||||
assertInstance(target, IASTName.class);
|
assertInstance(target, IASTName.class);
|
||||||
assertEquals("AA", ((IASTName) target).toString());
|
assertEquals("AA", ((IASTName) target).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<char T>
|
||||||
|
// struct A {};
|
||||||
|
//
|
||||||
|
// template<>
|
||||||
|
// struct A<0> {};
|
||||||
|
//
|
||||||
|
// void test(){
|
||||||
|
// A<0> a0;
|
||||||
|
// A<1> a1;
|
||||||
|
// }
|
||||||
|
public void testPartialSpecializationResolution_525288() throws Exception {
|
||||||
|
CPPASTNameBase.sAllowNameComputation = true;
|
||||||
|
String code = getAboveComment();
|
||||||
|
IFile file = importFile("testBug525288.cpp", code);
|
||||||
|
|
||||||
|
int offset = code.indexOf("a0") - 5;
|
||||||
|
IASTNode target = testF3(file, offset);
|
||||||
|
assertInstance(target, IASTName.class);
|
||||||
|
assertEquals("A<0>", ((IASTName) target).toString());
|
||||||
|
|
||||||
|
offset = code.indexOf("a1") - 5;
|
||||||
|
target = testF3(file, offset);
|
||||||
|
assertInstance(target, IASTName.class);
|
||||||
|
assertEquals("A", ((IASTName) target).toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue