mirror of
https://github.com/dlang-community/DCD.git
synced 2025-04-26 21:29:58 +03:00
Fixed determination of type of array identified by auto
This commit is contained in:
parent
2d02a7f01e
commit
44bcaf46f7
5 changed files with 46 additions and 1 deletions
|
@ -801,9 +801,20 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
|||
|
||||
if (shouldSwapWithType(completionType, symbols[0].kind, 0, tokens.length - 1))
|
||||
{
|
||||
symbols = symbols[0].type is null || symbols[0].type is symbols[0] ? [] : [symbols[0].type];
|
||||
if (symbols.length == 0)
|
||||
return [];
|
||||
if (symbols[0].type is null || symbols[0].type is symbols[0])
|
||||
{
|
||||
symbols = [];
|
||||
}
|
||||
else if (symbols[0].type.kind == CompletionKind.functionName)
|
||||
{
|
||||
symbols = [symbols[0].type.type];
|
||||
}
|
||||
else
|
||||
{
|
||||
symbols = [symbols[0].type];
|
||||
}
|
||||
}
|
||||
|
||||
loop: for (size_t i = 1; i < tokens.length; i++)
|
||||
|
|
8
tests/tc038/expected1.txt
Normal file
8
tests/tc038/expected1.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
identifiers
|
||||
alignof k
|
||||
init k
|
||||
mangleof k
|
||||
max k
|
||||
min k
|
||||
sizeof k
|
||||
stringof k
|
12
tests/tc038/expected2.txt
Normal file
12
tests/tc038/expected2.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
identifiers
|
||||
alignof k
|
||||
dup k
|
||||
idup k
|
||||
init k
|
||||
length k
|
||||
mangleof k
|
||||
ptr k
|
||||
reverse k
|
||||
sizeof k
|
||||
sort k
|
||||
stringof k
|
3
tests/tc038/file.d
Normal file
3
tests/tc038/file.d
Normal file
|
@ -0,0 +1,3 @@
|
|||
int[] func(){ return [1,2]; } int main() { auto arr = func(); arr[0]. }
|
||||
int[] func(){ return [1,2]; } int main() { int[] arr = func(); arr[0]. }
|
||||
struct pair { int a; int b; }; pair func(){ return pair(); } int main() { auto var = func(); var. }
|
11
tests/tc038/run.sh
Executable file
11
tests/tc038/run.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
set -e
|
||||
set -u
|
||||
|
||||
../../bin/dcd-client $1 file.d -c70 > actual.txt
|
||||
diff actual.txt expected1.txt
|
||||
|
||||
../../bin/dcd-client $1 file.d -c143 > actual.txt
|
||||
diff actual.txt expected1.txt
|
||||
|
||||
../../bin/dcd-client $1 file.d -c242 > actual.txt
|
||||
diff actual.txt expected2.txt
|
Loading…
Add table
Add a link
Reference in a new issue