Correct distinct printing

This commit is contained in:
gingerBill
2022-01-17 19:23:24 +00:00
parent 0d4642825f
commit 2ca2dbcc92
@@ -370,7 +370,7 @@ write_type :: proc(using writer: ^Type_Writer, type: doc.Type, flags: Write_Type
fmt.wprintf(w, `<span>`) fmt.wprintf(w, `<span>`)
tn_pkg := files[e.pos.file].pkg tn_pkg := files[e.pos.file].pkg
if tn_pkg != pkg { if tn_pkg != pkg {
fmt.wprintf(w, `%s.`, str(pkgs[pkg].name)) fmt.wprintf(w, `%s.`, str(pkgs[tn_pkg].name))
} }
fmt.wprintf(w, `<a class="code-typename" href="/core/{0:s}/#{1:s}">{1:s}</a></span>`, pkg_to_path[&pkgs[tn_pkg]], name) fmt.wprintf(w, `<a class="code-typename" href="/core/{0:s}/#{1:s}">{1:s}</a></span>`, pkg_to_path[&pkgs[tn_pkg]], name)
case .Generic: case .Generic:
@@ -727,16 +727,16 @@ write_pkg :: proc(w: io.Writer, path: string, pkg: ^doc.Pkg) {
fmt.wprintf(w, "%s :: ", name) fmt.wprintf(w, "%s :: ", name)
the_type := types[e.type] the_type := types[e.type]
type_to_print := the_type type_to_print := the_type
if the_type.kind == .Named { if the_type.kind == .Named && .Type_Alias not_in e.flags {
if e.pos != entities[array(the_type.entities)[0]].pos { if e.pos == entities[array(the_type.entities)[0]].pos {
io.write_string(w, "distinct ")
} else {
bt := base_type(the_type) bt := base_type(the_type)
#partial switch bt.kind { #partial switch bt.kind {
case .Struct, .Union, .Proc, .Enum: case .Struct, .Union, .Proc, .Enum:
// Okay
case:
io.write_string(w, "distinct ") io.write_string(w, "distinct ")
type_to_print = bt
} }
type_to_print = bt
} }
} }
write_type(writer, type_to_print, {.Allow_Indent}) write_type(writer, type_to_print, {.Allow_Indent})