-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to avoid using global actors as default values (#269)
* Fix `any` annotated protocol cannot find default value * Skip to add typeMap when the type may have globalActor * A small renaming
- Loading branch information
1 parent
39e406f
commit 56d8697
Showing
10 changed files
with
156 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import MockoloFramework | ||
|
||
let globalActorProtocol = """ | ||
/// \(String.mockAnnotation) | ||
@MainActor protocol RootController: AnyObject { | ||
var viewController: UIViewController { get } | ||
} | ||
/// \(String.mockAnnotation) | ||
protocol RootBuildable { | ||
func build() -> RootController | ||
} | ||
""" | ||
|
||
let globalActorProtocolMock = """ | ||
class RootControllerMock: RootController { | ||
init() { } | ||
init(viewController: UIViewController) { | ||
self._viewController = viewController | ||
} | ||
private var _viewController: UIViewController! | ||
var viewController: UIViewController { | ||
get { return _viewController } | ||
set { _viewController = newValue } | ||
} | ||
} | ||
class RootBuildableMock: RootBuildable { | ||
init() { } | ||
private(set) var buildCallCount = 0 | ||
var buildHandler: (() -> (RootController))? | ||
func build() -> RootController { | ||
buildCallCount += 1 | ||
if let buildHandler = buildHandler { | ||
return buildHandler() | ||
} | ||
fatalError("buildHandler returns can't have a default value thus its handler must be set") | ||
} | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters