If you have code like this:
#if DEBUG
// @knit internal
container.registerAbstract(Foo.self, name: "a")
#endif
// @knit internal
container.registerAbstract(Foo.self, name: "b")
then the generated code will have the definition for func foo(name: FooKey) inside of an #if DEBUG block, which means that there's no way to access resolver.foo(name: .b).
If you switch the order of the definitions then it won't be in the #if DEBUG block, but now you can access foo(name: .b) when you shouldn't be able to. And presumably, if the registration wasn't abstract then you might try to pull dependencies into your production code that you shouldn't.
I would expect some of the key values to be scoped within #if DEBUG, but the method itself would be outside of any if-defs.
If you have code like this:
then the generated code will have the definition for
func foo(name: FooKey)inside of an#if DEBUGblock, which means that there's no way to accessresolver.foo(name: .b).If you switch the order of the definitions then it won't be in the
#if DEBUGblock, but now you can accessfoo(name: .b)when you shouldn't be able to. And presumably, if the registration wasn't abstract then you might try to pull dependencies into your production code that you shouldn't.I would expect some of the key values to be scoped within
#if DEBUG, but the method itself would be outside of any if-defs.