From e5c63d28610c241b1a944968a98bb21a985d2c15 Mon Sep 17 00:00:00 2001 From: Quinton Miller Date: Thu, 18 Feb 2021 15:16:57 +0800 Subject: [PATCH] Print named generic type arguments in docs --- src/compiler/crystal/tools/doc/type.cr | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/compiler/crystal/tools/doc/type.cr b/src/compiler/crystal/tools/doc/type.cr index b0807b9388e0..a66f7e015b55 100644 --- a/src/compiler/crystal/tools/doc/type.cr +++ b/src/compiler/crystal/tools/doc/type.cr @@ -499,6 +499,18 @@ class Crystal::Doc::Type node.type_vars.join(io, ", ") do |type_var| node_to_html type_var, io, links: links end + if (named_args = node.named_args) && !named_args.empty? + io << ", " unless node.type_vars.empty? + named_args.join(io, ", ") do |entry| + if Symbol.needs_quotes_for_named_argument?(entry.name) + entry.name.inspect(io) + else + io << entry.name + end + io << ": " + node_to_html entry.value, io, links: links + end + end io << ')' end