Merge pull request #339 from ANtlord/master

Fix determination a type of variable indetified by "auto"
This commit is contained in:
Brian Schott 2016-08-01 01:05:59 -07:00 committed by GitHub
commit f365f7ad7b
6 changed files with 38 additions and 1 deletions

View File

@ -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++)

View File

@ -0,0 +1,2 @@
struct pair { int a; int b; };
pair func(){ return pair(); } int main() { auto var = func(); var. }

View File

@ -0,0 +1,9 @@
identifiers
a v
alignof k
b v
init k
mangleof k
sizeof k
stringof k
tupleof k

View File

@ -0,0 +1,2 @@
struct pair { int a; int b; };
pair[] func(){ return [pair(1,2)]; } int main() { auto arr = func(); arr[0]. }

View File

@ -0,0 +1,2 @@
struct pair { int a; int b; };
pair[] func(){ return [pair(1,2)]; } int main() { auto arr = func(); arr[0]. }

11
tests/tc038/run.sh Executable file
View File

@ -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