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

CodeCompletion: Assertion failed while printing generic signature: (Val && "isa<> used on a null pointer")

    XMLWordPrintable

    Details

      Description

      Reproducing test case:

      // RUN: %swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename %s
      
      extension Result {
        public init(_ value: Success?) {
          self = value.map(#^COMPLETE^#)
        }
      }
      
      public func materialize<T>(_ f: T) {}
      

      Crash trace (via sourcekitd):

      Thread 3 Crashed:
      0   libsystem_kernel.dylib        	0x00007fff6fc5333a __pthread_kill + 10
      1   libsystem_pthread.dylib       	0x00007fff6fd0fe60 pthread_kill + 430
      2   libsystem_c.dylib             	0x00007fff6fbda8a2 __abort + 139
      3   libsystem_c.dylib             	0x00007fff6fbda817 abort + 135
      4   libsystem_c.dylib             	0x00007fff6fbd9ac6 __assert_rtn + 314
      5   com.apple.SourceKitService.5.0.20200928101_osx	0x0000000106861ec1 swift::Decl::getInnermostDeclContext() const (.cold.1) + 33
      6   com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103f9f418 swift::Decl::getInnermostDeclContext() const + 136
      7   com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103f4f6f1 (anonymous namespace)::PrintAST::printSingleDepthOfGenericSignature(swift::ArrayRefView<swift::Type, swift::GenericTypeParamType*, swift::GenericTypeParamType* swift::staticCastHelper<swift::GenericTypeParamType>(swift::Type const&), true>, llvm::ArrayRef<swift::Requirement>, bool&, unsigned int, llvm::function_ref<bool (swift::Requirement const&)>) + 161
      8   com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103f4f608 (anonymous namespace)::PrintAST::printGenericSignature(swift::GenericSignature, unsigned int, llvm::function_ref<bool (swift::Requirement const&)>) + 1160
      9   com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103f5529a swift::TypeVisitor<(anonymous namespace)::TypePrinter, void>::visit(swift::Type) + 4410
      10  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103f44d83 swift::Type::print(swift::ASTPrinter&, swift::PrintOptions const&) const + 67
      11  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103f46785 swift::TypeBase::print(swift::ASTPrinter&, swift::PrintOptions const&) const + 21
      12  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102fd12b2 swift::ide::CodeCompletionResultBuilder::addTypeAnnotation(swift::Type, swift::PrintOptions, llvm::StringRef) + 450
      13  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102fdadd8 (anonymous namespace)::CompletionLookup::addTypeAnnotation(swift::ide::CodeCompletionResultBuilder&, swift::Type, swift::GenericSignature) + 168
      14  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102fd78ff (anonymous namespace)::CompletionLookup::addCompoundFunctionNameIfDesiable(swift::AbstractFunctionDecl*, swift::DeclVisibilityKind, swift::DynamicLookupInfo) + 1759
      15  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102fd4e93 (anonymous namespace)::CompletionLookup::foundDecl(swift::ValueDecl*, swift::DeclVisibilityKind, swift::DynamicLookupInfo) + 307
      16  com.apple.SourceKitService.5.0.20200928101_osx	0x000000010409aac2 swift::SourceLookupCache::lookupVisibleDecls(swift::ImportPath::Access, swift::VisibleDeclConsumer&, swift::NLKind) + 530
      17  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102fd33a9 deliverCompletionResults(swift::ide::CodeCompletionContext&, (anonymous namespace)::CompletionLookup&, swift::SourceFile&, swift::ide::CodeCompletionConsumer&) + 569
      18  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102fe6c26 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 19990
      19  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103e3ea55 swift::Parser::performCodeCompletionSecondPassImpl(swift::CodeCompletionDelayedDeclState&) + 933
      20  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103e3e58a swift::CodeCompletionSecondPassRequest::evaluate(swift::Evaluator&, swift::SourceFile*, swift::CodeCompletionCallbacksFactory*) const + 234
      21  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103e48e92 llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::getResultUncached<swift::CodeCompletionSecondPassRequest>(swift::CodeCompletionSecondPassRequest const&) + 386
      22  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103e48c9e llvm::Expected<swift::CodeCompletionSecondPassRequest::OutputType> swift::Evaluator::operator()<swift::CodeCompletionSecondPassRequest, (void*)0>(swift::CodeCompletionSecondPassRequest const&) + 110
      23  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103e3e397 swift::CodeCompletionSecondPassRequest::OutputType swift::evaluateOrDefault<swift::CodeCompletionSecondPassRequest>(swift::Evaluator&, swift::CodeCompletionSecondPassRequest, swift::CodeCompletionSecondPassRequest::OutputType) + 55
      24  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102f0b561 void llvm::function_ref<void (swift::CompilerInstance&, bool)>::callback_fn<swiftCodeCompleteImpl(SourceKit::SwiftLangSupport&, llvm::MemoryBuffer*, unsigned int, (anonymous namespace)::SwiftCodeCompletionConsumer&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)::$_2>(long, swift::CompilerInstance&, bool) + 433
      25  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103007999 swift::ide::CompletionInstance::performNewOperation(llvm::Optional<llvm::hash_code>, swift::CompilerInvocation&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, swift::DiagnosticConsumer*, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 585
      26  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000103007eb8 swift::ide::CompletionInstance::performOperation(swift::CompilerInvocation&, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, llvm::MemoryBuffer*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, swift::DiagnosticConsumer*, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 696
      27  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102f3fd74 SourceKit::SwiftLangSupport::performCompletionLikeOperation(llvm::MemoryBuffer*, unsigned int, llvm::ArrayRef<char const*>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, llvm::function_ref<void (swift::CompilerInstance&, bool)>) + 2596
      28  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102f04d4d SourceKit::SwiftLangSupport::codeComplete(llvm::MemoryBuffer*, unsigned int, SourceKit::OptionsDictionary*, SourceKit::CodeCompletionConsumer&, llvm::ArrayRef<char const*>, llvm::Optional<SourceKit::VFSOptions>) + 573
      29  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102f6c678 handleSemanticRequest(sourcekitd::RequestDict, std::__1::function<void (void*)>, sourcekitd_uid_s*, llvm::Optional<llvm::StringRef>, llvm::Optional<llvm::StringRef>, llvm::ArrayRef<char const*>, llvm::Optional<SourceKit::VFSOptions>) + 2440
      30  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102f6bbe8 void SourceKit::WorkQueue::DispatchData::callAndDelete<handleRequestImpl(void*, std::__1::function<void (void*)>)::$_7>(void*) + 376
      31  libdispatch.dylib             	0x00007fff6fab2658 _dispatch_client_callout + 8
      32  libdispatch.dylib             	0x00007fff6fab4d79 _dispatch_block_invoke_direct + 245
      33  com.apple.SourceKitService.5.0.20200928101_osx	0x000000010603ed8f executeBlock(void*) + 15
      34  com.apple.SourceKitService.5.0.20200928101_osx	0x0000000102ee921d threadFuncSync(void*) + 13
      35  libsystem_pthread.dylib       	0x00007fff6fd10109 _pthread_start + 148
      36  libsystem_pthread.dylib       	0x00007fff6fd0bb8b thread_start + 15
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            nathawes Nathan Hawes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: