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

USR generation crash for extension within generic struct (invalid code)

    XMLWordPrintable

    Details

      Description

      Reproducer:

      struct A {}
      struct B<T>{
      extension A {
        func foo() {}
      }
      

      Trace:

      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0   swift                         	0x00000001077c638a swift::GenericSignatureImpl::getCanonicalSignature() const + 10
      1   swift                         	0x00000001077c64fa swift::GenericSignatureImpl::isEqual(swift::GenericSignature) + 26
      2   swift                         	0x0000000107730bd0 swift::ExtensionDecl::isConstrainedExtension() const + 176
      3   swift                         	0x0000000107730c67 swift::ExtensionDecl::isEquivalentToExtendedContext() const + 119
      4   swift                         	0x00000001076d1ea1 swift::Mangle::ASTMangler::appendContext(swift::DeclContext const*) + 817
      5   swift                         	0x00000001076d16c0 swift::Mangle::ASTMangler::appendEntity(swift::ValueDecl const*) + 272
      6   swift                         	0x00000001076d6eb8 swift::Mangle::ASTMangler::mangleDeclAsUSR(swift::ValueDecl const*, llvm::StringRef) + 424
      7   swift                         	0x0000000107864cdd swift::USRGenerationRequest::evaluate(swift::Evaluator&, swift::ValueDecl const*) const + 1101
      8   swift                         	0x0000000107444d71 swift::SimpleRequest<swift::USRGenerationRequest, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > (swift::ValueDecl const*), (swift::CacheKind)1>::evaluateRequest(swift::USRGenerationRequest const&, swift::Evaluator&) + 17
      9   swift                         	0x00000001078670ec llvm::Expected<swift::USRGenerationRequest::OutputType> swift::Evaluator::getResultUncached<swift::USRGenerationRequest>(swift::USRGenerationRequest const&) + 380
      10  swift                         	0x0000000107866c1f llvm::Expected<swift::USRGenerationRequest::OutputType> swift::Evaluator::getResultCached<swift::USRGenerationRequest, (void*)0>(swift::USRGenerationRequest const&) + 239
      11  swift                         	0x0000000107865ffb llvm::Expected<swift::USRGenerationRequest::OutputType> swift::Evaluator::operator()<swift::USRGenerationRequest>(swift::USRGenerationRequest const&) + 107
      12  swift                         	0x0000000107865502 swift::USRGenerationRequest::OutputType swift::evaluateOrDefault<swift::USRGenerationRequest>(swift::Evaluator&, swift::USRGenerationRequest, swift::USRGenerationRequest::OutputType) + 34
      13  swift                         	0x0000000107865470 swift::ide::printValueDeclUSR(swift::ValueDecl const*, llvm::raw_ostream&) + 96
      14  swift                         	0x0000000106c29eda (anonymous namespace)::IndexSwiftASTWalker::getNameAndUSR(swift::ValueDecl*, swift::ExtensionDecl*, llvm::StringRef&, llvm::StringRef&) + 250
      15  swift                         	0x0000000106c28686 (anonymous namespace)::IndexSwiftASTWalker::walkToDeclPre(swift::Decl*, swift::CharSourceRange) + 3926
      16  swift                         	0x0000000106c2058f (anonymous namespace)::SemaAnnotator::walkToDeclPre(swift::Decl*) + 1423
      17  swift                         	0x000000010770bcba (anonymous namespace)::Traversal::doIt(swift::Decl*) + 170
      18  swift                         	0x000000010771124b (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 523
      19  swift                         	0x000000010770bce7 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 215
      20  swift                         	0x000000010770bbfb swift::Decl::walk(swift::ASTWalker&) + 27
      21  swift                         	0x00000001078104ee swift::SourceFile::walk(swift::ASTWalker&) + 190
      22  swift                         	0x0000000106c1e76f swift::SourceEntityWalker::walk(swift::SourceFile&) + 255
      23  swift                         	0x0000000106c27522 (anonymous namespace)::IndexSwiftASTWalker::visitModule(swift::ModuleDecl&) + 386
      24  swift                         	0x0000000106c2736a swift::index::indexSourceFile(swift::SourceFile*, swift::index::IndexDataConsumer&) + 442
      25  swift                         	0x0000000106c2d425 recordSourceFileUnit(swift::SourceFile*, llvm::StringRef, llvm::StringRef, bool, bool, llvm::StringRef, llvm::ArrayRef<clang::FileEntry const*>, clang::CompilerInstance const&, swift::DiagnosticEngine&) + 1605
      26  swift                         	0x0000000106c2cd7b swift::index::indexAndRecord(swift::SourceFile*, llvm::StringRef, llvm::StringRef, bool, bool, llvm::StringRef, swift::DependencyTracker const&) + 219
      27  swift                         	0x00000001069b1c88 emitIndexDataIfNeeded(swift::SourceFile*, swift::CompilerInvocation const&, swift::CompilerInstance&) + 328
      28  swift                         	0x00000001069acde5 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 6197
      29  swift                         	0x00000001069aa646 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3046
      30  swift                         	0x000000010694fbe9 main + 729
      31  libdyld.dylib                 	0x00007fff5ed343d5 start + 1
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: