Uploaded image for project: 'Swift'
  1. Swift
  2. SR-13000

Refactoring: segfault in AddEquatableContext::getDeclarationContextFromInfo(swift::ide::ResolvedCursorInfo)

    XMLWordPrintable

    Details

      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
      

       

        Attachments

          Activity

            People

            Assignee:
            suyashsrijan Suyash Srijan
            Reporter:
            nathawes Nathan Hawes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: