Fix declaration suggestion for var with different number of components

This commit is contained in:
Alex Beregszaszi
2018-08-04 15:22:22 +01:00
parent 0b20e4fd22
commit 83e6c34526
2 changed files with 18 additions and 0 deletions
+6
View File
@@ -1038,7 +1038,10 @@ string createTupleDecl(vector<ASTPointer<VariableDeclaration>> const& _decls)
vector<string> components;
for (ASTPointer<VariableDeclaration> const& decl: _decls)
if (decl)
{
solAssert(decl->annotation().type, "");
components.emplace_back(decl->annotation().type->toString(false) + " " + decl->name());
}
else
components.emplace_back();
@@ -1056,6 +1059,9 @@ bool typeCanBeExpressed(vector<ASTPointer<VariableDeclaration>> const& decls)
if (!decl)
continue;
if (!decl->annotation().type)
return false;
if (auto functionType = dynamic_cast<FunctionType const*>(decl->annotation().type.get()))
if (
functionType->kind() != FunctionType::Kind::Internal &&