Skip to content

[SR-13000] Refactoring: segfault in AddEquatableContext::getDeclarationContextFromInfo(swift::ide::ResolvedCursorInfo) #55445

@nathawes

Description

@nathawes
Previous ID SR-13000
Radar rdar://problem/64316798
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, Crash, FoundByStressTester
Assignee @theblixguy
Priority Medium

md5: 49872dc010efb7196d36ebfaa20ffd06

Issue Description:

Computing the available refactorings on the extension in the invalid code below crashes:

enum Foo {}
typealias Bar = (Any, Any) -> Foo
extension /*invoke here:*/Bar {}

Trace:

Thread 3 Crashed:: Dispatch queue: sourcekit.swift.ConsumeAST
0   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000102d42081 swift::NominalTypeDecl::prepareConformanceTable() const + 17
1   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000102d42525 swift::NominalTypeDecl::getAllProtocols() const + 21
2   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101d6ffcc (anonymous namespace)::AddEquatableContext::getDeclarationContextFromInfo(swift::ide::ResolvedCursorInfo) + 108
3   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101d5f07f (anonymous namespace)::RefactoringActionAddEquatableConformance::isApplicable(swift::ide::ResolvedCursorInfo, swift::DiagnosticEngine&) + 47
4   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101d5eb4a swift::ide::collectAvailableRefactorings(swift::SourceFile*, swift::ide::ResolvedCursorInfo, std::__1::vector<swift::ide::RefactoringKind, std::__1::allocator<swift::ide::RefactoringKind> >&, bool) + 2090
5   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101c68fbf collectAvailableRefactoringsOtherThanRename(swift::SourceFile*, swift::ide::ResolvedCursorInfo, std::__1::vector<SourceKit::UIdent, std::__1::allocator<SourceKit::UIdent> >&, swift::ide::DelayedStringRetriever&, swift::ide::DelayedStringRetriever&) + 79
6   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101c66f2d passCursorInfoForDecl(swift::SourceFile*, swift::ValueDecl const*, swift::ModuleDecl*, swift::Type, bool, bool, swift::ide::ResolvedCursorInfo, llvm::Optional<unsigned int>, swift::SourceLoc, llvm::ArrayRef<SourceKit::RefactoringInfo>, SourceKit::SwiftLangSupport&, swift::CompilerInvocation const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, llvm::ArrayRef<llvm::IntrusiveRefCntPtr<SourceKit::ImmutableTextSnapshot> >, std::__1::function<void (SourceKit::RequestResult<SourceKit::CursorInfoData> const&)>) + 4685
7   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101c64866 resolveCursor(SourceKit::SwiftLangSupport&, llvm::StringRef, unsigned int, unsigned int, bool, llvm::IntrusiveRefCntPtr<SourceKit::SwiftInvocation>, bool, bool, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::function<void (SourceKit::RequestResult<SourceKit::CursorInfoData> const&)>)::CursorInfoConsumer::handlePrimaryAST(llvm::IntrusiveRefCntPtr<SourceKit::ASTUnit>) + 4294
8   com.apple.SourceKitService.5.0.20200610101_osx  0x0000000101c1caff void SourceKit::WorkQueue::DispatchData::callAndDelete<SourceKit::ASTUnit::Implementation::consumeAsync(std::__1::shared_ptr<SourceKit::SwiftASTConsumer>, llvm::IntrusiveRefCntPtr<SourceKit::ASTUnit>)::$_0>(void*) + 95
9   libdispatch.dylib               0x00007fff6b28c658 _dispatch_client_callout + 8
10  libdispatch.dylib               0x00007fff6b291c44 _dispatch_lane_serial_drain + 597
11  libdispatch.dylib               0x00007fff6b2925d6 _dispatch_lane_invoke + 363
12  libdispatch.dylib               0x00007fff6b29bc09 _dispatch_workloop_worker_thread + 596
13  libsystem_pthread.dylib         0x00007fff6b4e6a3d _pthread_wqthread + 290
14  libsystem_pthread.dylib         0x00007fff6b4e5b77 start_wqthread + 15

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwarefound by stress testerFlag: An issue found by the SourceKit stress testerrefactoringArea → source tooling: refactoring

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions