Skip to content

Assertion failed: (!hasIsolatedParameter && "building SIL function type with multiple isolated parameters") #86170

@ahoppen

Description

@ahoppen

Compiling the following with NonisolatedNonsendingByDefault enabled hits an assertion failure in the compiler

struct SymbolDetails2: Hashable {
  let usr: String
  var kind: Bool
}

actor ABC {
  func prepareTypeHierarchy() async throws -> [Int]? {
    let symbols: [SymbolDetails2] = []
    let usrs = symbols.filter {
      return $0.kind
    }.compactMap(\.usr)

    func indexToLSPTypeHierarchyItem2() -> Int? {
      fatalError()
    }

    let typeHierarchyItems = await usrs.asyncCompactMap2 { (usr) -> Int? in
      let item = indexToLSPTypeHierarchyItem2()
      fatalError()
    }

    fatalError()
  }
}


extension Sequence {
  /// Just like `Sequence.compactMap` but allows an `async` transform function.
  func asyncCompactMap2<T>(
    _ transform: (Element) async throws -> T?
  ) async rethrows -> [T] {
    var result: [T] = []

    for element in self {
      if let transformed = try await transform(element) {
        result.append(transformed)
      }
    }

    return result
  }
}
Stack tarce
Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x18a4835b0 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x18a4bd888 pthread_kill + 296
2   libsystem_c.dylib             	       0x18a3c28e0 __abort + 132
3   libsystem_c.dylib             	       0x18a3c285c abort + 136
4   libsystem_c.dylib             	       0x18a3c1a84 __assert_rtn + 284
5   swift-frontend                	       0x106bace30 swift::SILFunctionType::SILFunctionType(swift::GenericSignature, swift::SILExtInfo, swift::SILCoroutineKind, swift::ParameterConvention, llvm::ArrayRef<swift::SILParameterInfo>, llvm::ArrayRef<swift::SILYieldInfo>, llvm::ArrayRef<swift::SILResultInfo>, std::__1::optional<swift::SILResultInfo>, swift::SubstitutionMap, swift::SubstitutionMap, swift::ASTContext const&, swift::RecursiveTypeProperties, swift::ProtocolConformanceRef) (.cold.9) + 40
6   swift-frontend                	       0x10262e2a4 swift::SILFunctionType::SILFunctionType(swift::GenericSignature, swift::SILExtInfo, swift::SILCoroutineKind, swift::ParameterConvention, llvm::ArrayRef<swift::SILParameterInfo>, llvm::ArrayRef<swift::SILYieldInfo>, llvm::ArrayRef<swift::SILResultInfo>, std::__1::optional<swift::SILResultInfo>, swift::SubstitutionMap, swift::SubstitutionMap, swift::ASTContext const&, swift::RecursiveTypeProperties, swift::ProtocolConformanceRef) + 2064
7   swift-frontend                	       0x10262ecf4 swift::SILFunctionType::get(swift::GenericSignature, swift::SILExtInfo, swift::SILCoroutineKind, swift::ParameterConvention, llvm::ArrayRef<swift::SILParameterInfo>, llvm::ArrayRef<swift::SILYieldInfo>, llvm::ArrayRef<swift::SILResultInfo>, std::__1::optional<swift::SILResultInfo>, swift::SubstitutionMap, swift::SubstitutionMap, swift::ASTContext const&, swift::ProtocolConformanceRef) + 1320
8   swift-frontend                	       0x101a56438 getSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, (anonymous namespace)::Conventions const&, swift::ForeignInfo const&, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 7676
9   swift-frontend                	       0x101a4d1ac getNativeSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 672
10  swift-frontend                	       0x101a4f74c getUncachedSILFunctionTypeForConstant(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::SILDeclRef, swift::Lowering::TypeConverter::LoweredFormalTypes) + 1168
11  swift-frontend                	       0x101a5043c swift::Lowering::TypeConverter::getConstantInfo(swift::TypeExpansionContext, swift::SILDeclRef) + 220
12  swift-frontend                	       0x101a46840 swift::SILFunctionBuilder::getOrCreateFunction(swift::SILLocation, swift::SILDeclRef, swift::ForDefinition_t, llvm::function_ref<swift::SILFunction* (swift::SILLocation, swift::SILDeclRef)>, swift::ProfileCounter) + 148
13  swift-frontend                	       0x10173c3d0 swift::Lowering::SILGenModule::getFunction(swift::SILDeclRef, swift::ForDefinition_t) + 248
14  swift-frontend                	       0x101746488 void llvm::function_ref<void ()>::callback_fn<swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&)::$_0>(long) + 116
15  swift-frontend                	       0x101aeac60 swift::Lowering::TypeConverter::withClosureTypeInfo(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&, llvm::function_ref<void ()>) + 160
16  swift-frontend                	       0x101740ba4 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&) + 152
17  swift-frontend                	       0x1017cf2d0 (anonymous namespace)::RValueEmitter::emitClosureReference(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&) + 64
18  swift-frontend                	       0x1017cf078 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 688
19  swift-frontend                	       0x1017b390c swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 56
20  swift-frontend                	       0x101795b08 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 328
21  swift-frontend                	       0x101795cf8 swift::Lowering::ConvertingInitialization::tryPeephole(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::Conversion, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 228
22  swift-frontend                	       0x101795a70 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 176
23  swift-frontend                	       0x101795c00 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::Expr*, swift::Lowering::Conversion const&, swift::Lowering::SGFContext) + 84
24  swift-frontend                	       0x1017c6484 (anonymous namespace)::RValueEmitter::visitFunctionConversionExpr(swift::FunctionConversionExpr*, swift::Lowering::SGFContext) + 1736
25  swift-frontend                	       0x1017b390c swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 56
26  swift-frontend                	       0x101795b08 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 328
27  swift-frontend                	       0x101724d38 swift::Lowering::ArgumentSource::getConverted(swift::Lowering::SILGenFunction&, swift::Lowering::Conversion const&, swift::Lowering::SGFContext) && + 184
28  swift-frontend                	       0x10175eecc (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, bool, std::__1::optional<swift::AnyFunctionType::Param>) + 4236
29  swift-frontend                	       0x10174f6ec (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, bool, std::__1::optional<swift::AnyFunctionType::Param>) + 324
30  swift-frontend                	       0x10175d32c (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern, llvm::ArrayRef<swift::LifetimeDependenceInfo>) + 248
31  swift-frontend                	       0x1017688d8 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::LifetimeDependenceInfo>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && + 568
32  swift-frontend                	       0x10176823c (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::LifetimeDependenceInfo>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 1088
33  swift-frontend                	       0x101752d78 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 1856
34  swift-frontend                	       0x101751464 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 1880
35  swift-frontend                	       0x1017b093c swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, std::__1::optional<swift::SILLocation>) + 160
36  swift-frontend                	       0x10179ca0c swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int, bool) + 1316
37  swift-frontend                	       0x1017a3aa0 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Decl*) + 180
38  swift-frontend                	       0x101848c50 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 4168
39  swift-frontend                	       0x101847bfc swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 24
40  swift-frontend                	       0x1017da458 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 436
41  swift-frontend                	       0x10173e93c swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6328
42  swift-frontend                	       0x10173f848 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 272
43  swift-frontend                	       0x10173d04c swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 192
44  swift-frontend                	       0x10185e9a8 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 28
45  swift-frontend                	       0x10185af2c (anonymous namespace)::SILGenType::emitType() + 276
46  swift-frontend                	       0x10185ae0c swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 24
47  swift-frontend                	       0x101742728 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 176
48  swift-frontend                	       0x101742c48 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 632
49  swift-frontend                	       0x1018475d0 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 148
50  swift-frontend                	       0x101746dd0 swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 340
51  swift-frontend                	       0x1017431f8 swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 104
52  swift-frontend                	       0x10113eda4 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*, llvm::ArrayRef<char const*>) + 692
53  swift-frontend                	       0x10114fb68 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 164
54  swift-frontend                	       0x101142e50 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*, llvm::ArrayRef<char const*>) + 736
55  swift-frontend                	       0x1011405ac swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2424
56  swift-frontend                	       0x100ea0298 swift::mainEntry(int, char const**) + 3060
57  dyld                          	       0x18a0f5d54 start + 7184

Metadata

Metadata

Assignees

Labels

actor isolationFeature → concurrency: Actor isolationconcurrencyFeature: umbrella label for concurrency language featurescrashBug: A crash, i.e., an abnormal termination of software

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions