Nếu tôi đọc đúng, vấn đề xuất phát từ phần này của quá trình:
Thread 8 Crashed:
0 com.apple.SourceKitService 0x000000010450d9fc swift::TypeBase::getDesugaredType() + 12
1 com.apple.SourceKitService 0x00000001043bccbe (anonymous namespace)::DeclChecker::checkDynamicSelfReturn(swift::FuncDecl*, swift::TypeRepr*, unsigned int) + 478
2 com.apple.SourceKitService 0x00000001043b7c08 (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl*) + 1432
3 com.apple.SourceKitService 0x00000001043acc0d (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2733
4 com.apple.SourceKitService 0x00000001043a7ea7 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 727
5 com.apple.SourceKitService 0x00000001043b6426 (anonymous namespace)::DeclChecker::visitSubscriptDecl(swift::SubscriptDecl*) + 1478
6 com.apple.SourceKitService 0x00000001043acbdd (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2685
7 com.apple.SourceKitService 0x00000001043a7ea7 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 727
8 com.apple.SourceKitService 0x00000001044fc003 swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3075
9 com.apple.SourceKitService 0x00000001043c7a7c swift::TypeChecker::lookupMember(swift::DeclContext*, swift::Type, swift::DeclName, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 556
10 com.apple.SourceKitService 0x00000001043d51b7 (anonymous namespace)::ConformanceChecker::lookupValueWitnesses(swift::ValueDecl*, bool*) + 359
11 com.apple.SourceKitService 0x00000001043d11a1 (anonymous namespace)::ConformanceChecker::resolveWitnessViaLookup(swift::ValueDecl*) + 401
12 com.apple.SourceKitService 0x00000001043ce86f swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 2255
13 com.apple.SourceKitService 0x000000010438011b typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 1099
14 com.apple.SourceKitService 0x00000001043809e5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1781
15 com.apple.SourceKitService 0x0000000103fa40c2 swift::CompilerInstance::performSema() + 4738
16 com.apple.SourceKitService 0x0000000103e9a836 SourceKit::SwiftLangSupport::indexSource(llvm::StringRef, SourceKit::IndexingConsumer&, llvm::ArrayRef<char const*>, llvm::StringRef) + 4262
17 com.apple.SourceKitService 0x0000000103eb086a void SourceKit::WorkQueue::DispatchData::callAndDelete<handleRequestImpl(void*, std::__1::function<void (void*)>)::$_2>(void*) + 2170
18 libdispatch.dylib 0x00007fff9b7de33f _dispatch_client_callout + 8
19 libdispatch.dylib 0x00007fff9b7ec03a _dispatch_block_invoke + 474
20 com.apple.SourceKitService 0x00000001056afbbf executeBlock(void*) + 15
21 com.apple.SourceKitService 0x0000000103f3e58d ExecuteOnThread_Dispatch(void*) + 13
22 libsystem_pthread.dylib 0x00007fff8be14c13 _pthread_body + 131
23 libsystem_pthread.dylib 0x00007fff8be14b90 _pthread_start + 168
24 libsystem_pthread.dylib 0x00007fff8be12375 thread_start + 13
đó đưa chúng ta đến:
https://github.com/apple/swift/pull/932/files
20days + trước
Vì vậy, tôi đoán đó là một vấn đề đã biết. Tuy nhiên tôi không biết điều gì đang gây ra nó. Tôi khá chắc chắn đó là một phong cách mã nhanh chóng chưa được hỗ trợ tốt.
Tôi cũng thấy vụ tai nạn của bạn trong dự án thử nghiệm sụp đổ này:
https://github.com/practicalswift/swift-compiler-crashes
Nếu bạn nhìn vào nó, bạn có thể tìm thấy những trường hợp chính xác kích hoạt một trong những tai nạn:
- ✓ 28197 nhanh chóng typebase getdesugaredtype
- ✓ 28200 nhanh chóng typebase getdesugaredtype
- ✓ 28203 nhanh chóng typebase getdesugaredtype
Tôi cho rằng bạn đã làm, nhưng trong trường hợp bạn không làm như vậy: "dự án sạch + dữ liệu có nguồn gốc sạch sẽ" có thể hữu ích. – Moritz
@EricD .: Tôi đã thử điều đó rồi. –
Luôn có búa: xóa '~/Library/Caches/com.apple.dt.Xcode /' * thường * giải quyết loại sự cố này, nhưng nó cũng đặt lại một số prefs và DB để nó có thể có các tác dụng phụ phức tạp, hãy cẩn thận (tạo một bản sao TimeMachine trước hoặc một cái gì đó). – Moritz