Fixed determination of type of array identified by auto
This commit is contained in:
parent
2d02a7f01e
commit
44bcaf46f7
|
@ -801,9 +801,20 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
|
||||||
|
|
||||||
if (shouldSwapWithType(completionType, symbols[0].kind, 0, tokens.length - 1))
|
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)
|
if (symbols.length == 0)
|
||||||
return [];
|
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++)
|
loop: for (size_t i = 1; i < tokens.length; i++)
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
identifiers
|
||||||
|
alignof k
|
||||||
|
init k
|
||||||
|
mangleof k
|
||||||
|
max k
|
||||||
|
min k
|
||||||
|
sizeof k
|
||||||
|
stringof k
|
|
@ -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
|
|
@ -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. }
|
|
@ -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…
Reference in New Issue