Merge pull request #339 from ANtlord/master
Fix determination a type of variable indetified by "auto"
This commit is contained in:
commit
f365f7ad7b
|
@ -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,2 @@
|
||||||
|
struct pair { int a; int b; };
|
||||||
|
pair func(){ return pair(); } int main() { auto var = func(); var. }
|
|
@ -0,0 +1,9 @@
|
||||||
|
identifiers
|
||||||
|
a v
|
||||||
|
alignof k
|
||||||
|
b v
|
||||||
|
init k
|
||||||
|
mangleof k
|
||||||
|
sizeof k
|
||||||
|
stringof k
|
||||||
|
tupleof k
|
|
@ -0,0 +1,2 @@
|
||||||
|
struct pair { int a; int b; };
|
||||||
|
pair[] func(){ return [pair(1,2)]; } int main() { auto arr = func(); arr[0]. }
|
|
@ -0,0 +1,2 @@
|
||||||
|
struct pair { int a; int b; };
|
||||||
|
pair[] func(){ return [pair(1,2)]; } int main() { auto arr = func(); arr[0]. }
|
|
@ -0,0 +1,11 @@
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 implicit_array.d -c108 > actual.txt
|
||||||
|
diff actual.txt expected1.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 excplicit_array.d -c98 > actual.txt
|
||||||
|
diff actual.txt expected1.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 implicit_var.d -c108 > actual.txt
|
||||||
|
diff actual.txt expected1.txt
|
Loading…
Reference in New Issue