Skip to content

Commit

Permalink
Fix void[] initializer and test for it
Browse files Browse the repository at this point in the history
variable was never inserted, so test didn't fail because there was no check that all variables have been covered.
  • Loading branch information
WebFreak001 committed Aug 31, 2021
1 parent 36563f7 commit a29d40a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/dsymbol/conversion/first.d
Original file line number Diff line number Diff line change
Expand Up @@ -1485,14 +1485,11 @@ class InitializerVisitor : ASTVisitor
{
// If the array has any elements, assume all elements have the
// same type as the first element.
if (ai.arrayMemberInitializations)
{
if (ai.arrayMemberInitializations.length)
ai.arrayMemberInitializations[0].accept(this);
else
lookup.breadcrumbs.insert(VOID_SYMBOL_NAME);
if (ai.arrayMemberInitializations.length)
ai.arrayMemberInitializations[0].accept(this);
else
lookup.breadcrumbs.insert(VOID_SYMBOL_NAME);

}
lookup.breadcrumbs.insert(ARRAY_LITERAL_SYMBOL_NAME);
}

Expand Down
1 change: 1 addition & 0 deletions src/dsymbol/tests.d
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void expectSymbolsAndTypes(const string source, const string[][] results,
i++;
}
}
enforce!AssertError(i == results.length, "too many expected results, %s is left".format(results[i .. $]), file, line);
}

@system unittest
Expand Down

0 comments on commit a29d40a

Please sign in to comment.