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

Assertion failed: (IndexOfFirstOuterResult > 0 && "found outer results without an inner one"), function add

    XMLWordPrintable

    Details

      Description

      Compile the below to reproduce:

      func pipe() {}
      protocol MyThenable {
          func pipe(to: () -> Void)
      }
      
      
      extension MyThenable {
        //func pipe(to: () -> Void) {}
      }
      
      
      class Guarantee: MyThenable {
          func done() {
            pipe(to: {})
          }
      } 

      Also crashes sourcekit.

      Trace:

      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0   libsystem_kernel.dylib        	0x00007fff6b42d33a __pthread_kill + 10
      1   libsystem_pthread.dylib       	0x00007fff6b4e9e60 pthread_kill + 430
      2   libsystem_c.dylib             	0x00007fff6b3b48a2 __abort + 139
      3   libsystem_c.dylib             	0x00007fff6b3b4817 abort + 135
      4   libsystem_c.dylib             	0x00007fff6b3b3ac6 __assert_rtn + 314
      5   swift                         	0x000000010b98c8e3 swift::LookupResult::add(swift::LookupResultEntry, bool) (.cold.1) + 35
      6   swift                         	0x00000001080ca701 swift::LookupResult::add(swift::LookupResultEntry, bool) + 81
      7   swift                         	0x00000001080cb22a (anonymous namespace)::LookupResultBuilder::add(swift::ValueDecl*, swift::DeclContext*, swift::Type, bool)::'lambda'(swift::ValueDecl*)::operator()(swift::ValueDecl*) const + 138
      8   swift                         	0x00000001080c8d7e (anonymous namespace)::LookupResultBuilder::add(swift::ValueDecl*, swift::DeclContext*, swift::Type, bool) + 142
      9   swift                         	0x00000001080c8c7c swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclNameRef, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 652
      10  swift                         	0x0000000108074445 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 117
      11  swift                         	0x0000000108080df7 (anonymous namespace)::PreCheckExpression::walkToExprPre(swift::Expr*) + 1015
      12  swift                         	0x0000000108356d24 (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 36
      13  swift                         	0x00000001083545f1 swift::Expr::walk(swift::ASTWalker&) + 81
      14  swift                         	0x000000010807728c swift::constraints::ConstraintSystem::preCheckExpression(swift::Expr*&, swift::DeclContext*) + 188
      15  swift                         	0x0000000108077595 swift::TypeChecker::typeCheckExpression(swift::constraints::SolutionApplicationTarget&, bool&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 197
      16  swift                         	0x0000000108077437 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 87
      17  swift                         	0x0000000108118d95 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 2725
      18  swift                         	0x00000001081161c0 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 128
      19  swift                         	0x0000000108115671 swift::TypeCheckFunctionBodyRequest::evaluate(swift::Evaluator&, swift::AbstractFunctionDecl*) const + 1089
      20  swift                         	0x000000010811cb16 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckFunctionBodyRequest>(swift::TypeCheckFunctionBodyRequest const&) + 598
      21  swift                         	0x000000010811c64c llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckFunctionBodyRequest, (void*)0>(swift::TypeCheckFunctionBodyRequest const&) + 316
      22  swift                         	0x000000010811c4b6 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::operator()<swift::TypeCheckFunctionBodyRequest, (void*)0>(swift::TypeCheckFunctionBodyRequest const&) + 118
      23  swift                         	0x0000000108114ef5 swift::TypeCheckFunctionBodyRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckFunctionBodyRequest>(swift::Evaluator&, swift::TypeCheckFunctionBodyRequest, swift::TypeCheckFunctionBodyRequest::OutputType) + 37
      24  swift                         	0x0000000108114ea0 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 64
      25  swift                         	0x0000000108148d4e swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 382
      26  swift                         	0x0000000108149a65 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 453
      27  swift                         	0x0000000108149784 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 52
      28  swift                         	0x00000001081496f6 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::operator()<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 118
      29  swift                         	0x0000000108148ae0 swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType) + 32
      30  swift                         	0x00000001074b978a swift::CompilerInstance::forEachFileToTypeCheck(llvm::function_ref<void (swift::SourceFile&)>) + 90
      31  swift                         	0x00000001074b967a swift::CompilerInstance::performSema() + 74
      32  swift                         	0x00000001073dbe19 performCompile(swift::CompilerInstance&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 2329
      33  swift                         	0x00000001073da519 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3529
      34  swift                         	0x0000000107376ccd main + 861
      35  libdyld.dylib                 	0x00007fff6b2e5cc9 start + 1
      

       

        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: