Skip to content

Commit

Permalink
fix: revert parts of #1113
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzablocki committed Dec 7, 2022
1 parent 6371770 commit e1517aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Sourcery CHANGELOG

## 1.9.2
## Internal Changes
- Reverts part of [#1113](https://github.com/krzysztofzablocki/Sourcery/pull/1113) due to incomplete implementation breaking type complex resolution

## 1.9.1
## New Features
- Adds support for public protocols in AutoMockable template [#1100](https://github.com/krzysztofzablocki/Sourcery/pull/1100)
Expand Down
4 changes: 3 additions & 1 deletion SourceryRuntime/Sources/Composer/ParserResultsComposed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ internal struct ParserResultsComposed {
}

if let resolved = resolveGlobalName(for: oldName, containingType: $0.parent, unique: typeMap, modules: modules, typealiases: resolvedTypealiases)?.name {
$0.localName = resolved.components(separatedBy: ".").last!
$0.localName = resolved.replacingOccurrences(of: "\($0.module != nil ? "\($0.module!)." : "")", with: "")
} else {
return
}

// nothing left to do
Expand Down
11 changes: 10 additions & 1 deletion SourceryTests/Parsing/ComposerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2120,13 +2120,22 @@ class ParserComposerSpec: QuickSpec {
struct Item: AutoInitializable {
}
}
extension Root.ViewState.Item {
struct ChildItem {}
}
"""

let types = parseModules(
("Mod1", code)
).types

expect(types.map { $0.globalName }).to(equal(["Mod1.Root", "Mod1.Root.ViewState", "Mod1.Root.ViewState.Item"]))
expect(types.map { $0.globalName }).to(equal([
"Mod1.Root",
"Mod1.Root.ViewState",
"Mod1.Root.ViewState.Item",
"Mod1.Root.ViewState.Item.ChildItem"
]))
}
}

Expand Down

0 comments on commit e1517aa

Please sign in to comment.