Print function types simpler when they have only 1 argument

This commit is contained in:
Nikita Lisitsa 2025-12-18 16:31:02 +03:00
parent af815e215a
commit f22cd63a2a

View file

@ -80,6 +80,14 @@ namespace pslang::type
void print_impl(std::ostream & out, function_type const & type) void print_impl(std::ostream & out, function_type const & type)
{ {
if (type.arguments.size() == 1)
{
print(out, *type.arguments.front());
out << " -> ";
print(out, *type.result);
return;
}
out << '('; out << '(';
bool first = true; bool first = true;
for (auto const & argument : type.arguments) for (auto const & argument : type.arguments)