diff --git a/CHANGELOG.md b/CHANGELOG.md index 241ddfa59..805fdea68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,12 @@ [Minh Nguyễn](https://github.com/1ec5) [#706](https://github.com/realm/jazzy/issues/706) +* Fix issue where multiple Objective-C categories of the same external class + in different files were merged into one and named after the first category + found. + [Minh Nguyễn](https://github.com/1ec5) + [#539](https://github.com/realm/jazzy/issues/539) + ## 0.7.3 ##### Breaking diff --git a/lib/jazzy/sourcekitten.rb b/lib/jazzy/sourcekitten.rb index 4ffe0d094..8719cfdfe 100644 --- a/lib/jazzy/sourcekitten.rb +++ b/lib/jazzy/sourcekitten.rb @@ -390,7 +390,7 @@ def self.doc_coverage # Merges redundant declarations when documenting podspecs. def self.deduplicate_declarations(declarations) duplicate_groups = declarations - .group_by { |d| deduplication_key(d) } + .group_by { |d| deduplication_key(d, declarations) } .values duplicate_groups.map do |group| @@ -400,10 +400,11 @@ def self.deduplicate_declarations(declarations) end # Two declarations get merged if they have the same deduplication key. - def self.deduplication_key(decl) + def self.deduplication_key(decl, root_decls) if decl.type.swift_extensible? || decl.type.swift_extension? [decl.usr, decl.name] - elsif decl.type.objc_class? || decl.type.objc_category? + elsif decl.type.objc_class? || \ + (decl.type.objc_category? && name_match(decl.objc_category_name[0], root_decls)) name, _ = decl.objc_category_name || decl.name [name, :objc_class_and_categories] else diff --git a/spec/integration_specs b/spec/integration_specs index 37ebd2224..31b2b0741 160000 --- a/spec/integration_specs +++ b/spec/integration_specs @@ -1 +1 @@ -Subproject commit 37ebd222427336a865549fda800fabb25a7f371c +Subproject commit 31b2b07417b865784e46f62c93799cf4f048dd2c