Command SwiftCompile failed with a nonzero exit code Xcode 14

Getting the below error when compiling code with Xcode 14

Please submit a bug report (Swift.org - Contributing) and include the project and the crash backtrace.

1. Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)

2. Compiling with the current language version

3. Contents of /Users/


4. While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for PKKit)

5. While running pass #4392320 SILFunctionTransform "AllocBoxToStack" on SILFunction "@$sSS5PKKitE20_enumerateComponents33_797666E2FD4D301A62EEB955A760B819LL11separatedBy18groupingSeparators8invokingy10Foundation12CharacterSetV_SbySi_S2SSbztctF05$sSS5a25E13_capitalizing33_797666defghiJ50LLySSAA24StringCapitalizationTypeOFySi_S2SSbztcfU_SSz_XxTf1nncn_n".

for '_enumerateComponents(separatedBy:groupingSeparators:invoking:)' (at /Users/dheeeraj/Documents/PK/CHS/PKKiii/pkkit/PKKit/Misc/Extensions/StringExtension.swift:98:17)

Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):

func enumerateComponents(separatedBy separator: CharacterSet, groupingSeparators: Bool, invoking body: @escaping ((_ index: Int, _ component: String, _ separator: String, _ stop: inout Bool) -> Void)) -> Void {
        self._enumerateComponents(separatedBy: separator, groupingSeparators: groupingSeparators, invoking: body)
    }
    
    fileprivate func _enumerateComponents(separatedBy separator: CharacterSet, groupingSeparators: Bool, invoking body: @escaping ((_ index: Int, _ component: String, _ separator: String, _ stop: inout Bool) -> Void)) -> Void {
        guard !self.isEmpty else {
            return
        }
        
        var index = 0
        var currentComponent: String = ""
        var currentSeparator: String = ""
        var isFinishingComponent = false
        var stop = false
        
        let finishComponent = { (evenIfBlank: Bool) in
            if evenIfBlank || !currentComponent.isEmpty {
                body(index, currentComponent, currentSeparator, &stop)
                index += 1
                currentComponent = ""
                currentSeparator = ""
            }
            isFinishingComponent = false
        }
        
        for c in self.unicodeScalars {
            guard !stop else {
                return
            }
            
            if separator.contains(c) {
                currentSeparator.unicodeScalars.append(c)
                
                if groupingSeparators {
                    isFinishingComponent = true
                }
                else {
                    finishComponent(true)
                }
            }
            else {
                if isFinishingComponent {
                    finishComponent(true)
                }
                currentComponent.unicodeScalars.append(c)
            }
        }
        
        finishComponent(isFinishingComponent)
    }

When I comment the function call it archive but with this functional call it is not archiving.