From 5189876f064d3c53ef6e7bbca80b7a0fd23a46da Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Sat, 11 May 2013 21:37:53 -0400 Subject: [PATCH] Bug 407807 - [Content Assist] No completion for members of object that shadows object in base class Change-Id: I30bf6064de788f766f871cdea1776d849c8284c5 Reviewed-on: https://git.eclipse.org/r/12733 Reviewed-by: Sergey Prigogin IP-Clean: Sergey Prigogin Tested-by: Sergey Prigogin --- .../parser/cpp/semantics/CPPSemantics.java | 5 ++++- .../text/contentassist2/CompletionTests.java | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java index ee7f8c4d3a4..e7c5e703a14 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java @@ -2274,7 +2274,10 @@ public class CPPSemantics { return true; } IIndexFileSet indexFileSet = ast.getIndexFileSet(); - return indexFileSet != null && indexFileSet.containsDeclaration(indexBinding); + IIndexFileSet astFileSet = ast.getASTFileSet(); + return indexFileSet != null && + (indexFileSet.containsDeclaration(indexBinding) || + astFileSet.containsDeclaration(indexBinding)); } /** diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java index 2b251130613..2be7627edb0 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java @@ -1380,4 +1380,25 @@ public class CompletionTests extends AbstractContentAssistTest { final String[] expected= { "typename" }; assertContentAssistResults(fCursorOffset, 0, expected, true, false, false, COMPARE_REP_STRINGS); } + + // class Base { + // int c; + // }; + // + // struct Cat { + // void meow(); + // }; + // + // struct Derived : Base { + // void foo() { + // c./*cursor*/ + // } + // + // Cat c; + // }; + public void testShadowingBaseClassMember_Bug407807() throws Exception { + final String[] expected = { "Cat", "meow(void)" }; + assertContentAssistResults(fCursorOffset, expected, true, COMPARE_ID_STRINGS); + } + } \ No newline at end of file