diff --git a/src/autocomplete.d b/src/autocomplete.d index 7ea59b03..50b975c3 100644 --- a/src/autocomplete.d +++ b/src/autocomplete.d @@ -278,6 +278,7 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, case tok!")": case tok!"]": case tok!"this": + case tok!"super": auto allocator = scoped!(CAllocatorImpl!(BlockAllocator!(1024*16))); Scope* completionScope = generateAutocompleteTrees(tokenArray, allocator); scope(exit) typeid(Scope).destroy(completionScope); @@ -387,6 +388,8 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens, case tok!"uintLiteral": case tok!"ulongLiteral": case tok!"wstringLiteral": + case tok!"this": + case tok!"super": case tok!")": case tok!"]": auto allocator = scoped!(CAllocatorImpl!(BlockAllocator!(1024 * 16)))(); @@ -685,6 +688,7 @@ ACSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope, case tok!"ireal": case tok!"creal": case tok!"this": + case tok!"super": symbols = symbols[0].getPartsByName(internString(str(tokens[i].type))); if (symbols.length == 0) break loop; @@ -952,6 +956,7 @@ private enum TYPE_IDENT_AND_LITERAL_CASES = q{ case tok!"ireal": case tok!"creal": case tok!"this": + case tok!"super": case tok!"identifier": case tok!"stringLiteral": case tok!"wstringLiteral": diff --git a/src/conversion/third.d b/src/conversion/third.d index 2f0200eb..a64c5bb1 100644 --- a/src/conversion/third.d +++ b/src/conversion/third.d @@ -152,6 +152,7 @@ private: void resolveInheritance(SemanticSymbol* currentSymbol) { + import std.algorithm : filter; outer: foreach (istring[] base; currentSymbol.baseClasses) { ACSymbol* baseClass; @@ -170,8 +171,16 @@ private: continue outer; baseClass = symbols[0]; } - currentSymbol.acSymbol.parts.insert(baseClass.parts[]); - symbolScope.symbols.insert(baseClass.parts[]); + currentSymbol.acSymbol.parts.insert(baseClass.parts[].filter!( + a => a.name.ptr != CONSTRUCTOR_SYMBOL_NAME.ptr)); + symbolScope.symbols.insert(baseClass.parts[].filter!( + a => a.name.ptr != CONSTRUCTOR_SYMBOL_NAME.ptr)); + if (baseClass.kind == CompletionKind.className) + { + auto s = allocate!ACSymbol(symbolAllocator, + SUPER_SYMBOL_NAME, CompletionKind.variableName, baseClass); + symbolScope.symbols.insert(s); + } } } diff --git a/tests/tc009/expected1.txt b/tests/tc009/expected1.txt new file mode 100644 index 00000000..c372e97a --- /dev/null +++ b/tests/tc009/expected1.txt @@ -0,0 +1,2 @@ +calltips +this(int x) diff --git a/tests/tc009/expected2.txt b/tests/tc009/expected2.txt new file mode 100644 index 00000000..bf95158a --- /dev/null +++ b/tests/tc009/expected2.txt @@ -0,0 +1,2 @@ +calltips +this(int x, int y) diff --git a/tests/tc009/expected3.txt b/tests/tc009/expected3.txt new file mode 100644 index 00000000..bf95158a --- /dev/null +++ b/tests/tc009/expected3.txt @@ -0,0 +1,2 @@ +calltips +this(int x, int y) diff --git a/tests/tc009/file.d b/tests/tc009/file.d new file mode 100644 index 00000000..41cb77e1 --- /dev/null +++ b/tests/tc009/file.d @@ -0,0 +1,18 @@ +class Alpha +{ + this(int x); +} + +class Beta : Alpha +{ + this(int x, int y) + { + super(); + this(); + } +} + +void main(string[] args) +{ + auto b = new Beta(); +} diff --git a/tests/tc009/run.sh b/tests/tc009/run.sh new file mode 100755 index 00000000..d7f0c871 --- /dev/null +++ b/tests/tc009/run.sh @@ -0,0 +1,9 @@ +set -e +set -u + +dcd-client file.d -c83 > actual1.txt +dcd-client file.d -c93 > actual2.txt +dcd-client file.d -c148 > actual3.txt +diff actual1.txt expected1.txt +diff actual2.txt expected2.txt +diff actual3.txt expected3.txt