-
Notifications
You must be signed in to change notification settings - Fork 3
Turn Knit.Resolver into a class type #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
49549d2
to
cf40012
Compare
@@ -58,18 +58,6 @@ public final class ScopedModuleAssembler<TargetResolver> { | |||
behaviors: [Behavior] = [], | |||
postAssemble: ((Container<TargetResolver>) -> Void)? = nil | |||
) throws { | |||
// For provided modules, fail early if they are scoped incorrectly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed since the TargetResolver check is already done at compile time.
90def33
to
6c38f05
Compare
let resolver = r.resolve(Container<TargetResolver>.self)! as! TargetResolver | ||
let resolver = r.resolve(Container<TargetResolver>.self)!.resolver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I must have missed this one previously
public func unsafeResolver(file: StaticString, function: StaticString, line: UInt) -> Swinject.Resolver { | ||
_unwrappedSwinjectContainer(file: file, function: function, line: line) | ||
} | ||
public let resolver: TargetResolver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does keeping this property access mean all the existing Container.register methods remain the same?
@@ -40,9 +40,8 @@ public extension ModuleAssembly { | |||
static var replaces: [any ModuleAssembly.Type] { [] } | |||
|
|||
static func scoped(_ dependencies: [any ModuleAssembly.Type]) -> [any ModuleAssembly.Type] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove static func scoped(
from the public protocol now? Seems like it is no longer the extension point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved this into a private function. There's no need for it to be overridden anymore
08993fc
to
e06231c
Compare
28f6855
to
4c867ff
Compare
4c867ff
to
f645ad9
Compare
This changes how Resolvers are created so rather than every container conforming to every Resolver, there are concrete instances of Resolvers allowing correct inheritance.
For some reason this really pushed the Swift compiler causing multiple crashes. The top level Resolver must remain as a protocol otherwise type equality checks cause the compiler to crash.