diff --git a/Sources/Knit/Module/Container+AbstractRegistration.swift b/Sources/Knit/Module/Container+AbstractRegistration.swift index c1275f0..f9ab481 100644 --- a/Sources/Knit/Module/Container+AbstractRegistration.swift +++ b/Sources/Knit/Module/Container+AbstractRegistration.swift @@ -11,12 +11,9 @@ extension Container { public func registerAbstract( _ serviceType: Service.Type, name: String? = nil, - file: StaticString = #file + file: String = #fileID ) { - // Simplify the name to support Xcode 14.2. - // Once 14.2 support is dropped and #file becomes shortened this can be removed - let shortFile = URL(fileURLWithPath: file.description).lastPathComponent - let registration = RealAbstractRegistration(name: name, file: shortFile) + let registration = RealAbstractRegistration(name: name, file: file) abstractRegistrations().abstractRegistrations.append(registration) } diff --git a/Sources/Knit/Module/ModuleAssembler.swift b/Sources/Knit/Module/ModuleAssembler.swift index ffe3ca6..2980376 100644 --- a/Sources/Knit/Module/ModuleAssembler.swift +++ b/Sources/Knit/Module/ModuleAssembler.swift @@ -40,7 +40,7 @@ public final class ModuleAssembler { assemblyValidation: ((any ModuleAssembly.Type) throws -> Void)? = nil, errorFormatter: ModuleAssemblerErrorFormatter = DefaultModuleAssemblerErrorFormatter(), postAssemble: ((Container) -> Void)? = nil, - file: StaticString = #file, + file: StaticString = #fileID, line: UInt = #line ) { // Hold an optional reference to be used by error handling later diff --git a/Sources/Knit/Module/ScopedModuleAssembler.swift b/Sources/Knit/Module/ScopedModuleAssembler.swift index 53b755d..2b85616 100644 --- a/Sources/Knit/Module/ScopedModuleAssembler.swift +++ b/Sources/Knit/Module/ScopedModuleAssembler.swift @@ -25,7 +25,7 @@ public final class ScopedModuleAssembler { overrideBehavior: OverrideBehavior = .defaultOverridesWhenTesting, errorFormatter: ModuleAssemblerErrorFormatter = DefaultModuleAssemblerErrorFormatter(), postAssemble: ((Container) -> Void)? = nil, - file: StaticString = #file, + file: StaticString = #fileID, line: UInt = #line ) { do { diff --git a/Tests/KnitTests/AbstractRegistrationTests.swift b/Tests/KnitTests/AbstractRegistrationTests.swift index cd139b2..bfa59d8 100644 --- a/Tests/KnitTests/AbstractRegistrationTests.swift +++ b/Tests/KnitTests/AbstractRegistrationTests.swift @@ -17,8 +17,8 @@ final class AbstractRegistrationTests: XCTestCase { XCTAssertEqual( error.localizedDescription, """ - Unsatisfied abstract registration. Service: String, File: AbstractRegistrationTests.swift - Unsatisfied abstract registration. Service: String, File: AbstractRegistrationTests.swift, Name: test + Unsatisfied abstract registration. Service: String, File: KnitTests/AbstractRegistrationTests.swift + Unsatisfied abstract registration. Service: String, File: KnitTests/AbstractRegistrationTests.swift, Name: test """ ) }