SymbolDatabase: Better valuetype handling of container addition

This commit is contained in:
Daniel Marjamäki 2019-10-23 12:42:46 +02:00
parent f131a99ae3
commit 87f65230ae
2 changed files with 6 additions and 0 deletions

View File

@ -5348,6 +5348,11 @@ void SymbolDatabase::setValueType(Token *tok, const ValueType &valuetype)
setValueType(parent, *vt1);
return;
}
if (parent->str() == "+" && vt1->type == ValueType::Type::CONTAINER && vt2 && vt2->type == ValueType::Type::CONTAINER && vt1->container == vt2->container) {
setValueType(parent, *vt1);
return;
}
}
if (vt1->isIntegral() && vt1->pointer == 0U &&

View File

@ -6619,6 +6619,7 @@ private:
set.library.containers["test::string"] = string;
ASSERT_EQUALS("signed int", typeOf("Vector<int> v; v[0]=3;", "[", "test.cpp", &set));
ASSERT_EQUALS("container(test :: string)", typeOf("void foo(Vector<test::string> v) { for (auto s: v) { x=s+s; } }", "s", "test.cpp", &set));
ASSERT_EQUALS("container(test :: string)", typeOf("void foo(Vector<test::string> v) { for (auto s: v) { x=s+s; } }", "+", "test.cpp", &set));
}
// new