-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
informed by the SE that these overrides must now be nonisolated(nonsending)
to override the objc message. This will eventually be the default behavior
Reproduction
/// interface.h
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol InterfaceT
@end
@interface Base : NSObject
- (void)prepareWithP:(nullable id<InterfaceT>)p completionHandler:(void (^ _Nonnull)(NSError * _Nullable))completionHandler;
@end
NS_ASSUME_NONNULL_END
/// test.swift
import Foundation
class Derived : Base {
nonisolated(nonsending) override public func prepare(withP: (any InterfaceT)?) async throws {}
}
adamcmiel@adamcmiel-mac swift % ../build/mymacos/swift-macosx-arm64/bin/swiftc /tmp/test.swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -import-objc-header /tmp/interface.h
<unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: '/Users/adamcmiel/swift-project/build/mymacos/swift-macosx-arm64/bin/swift-driver-new'
SIL verification failed: branch argument types do not match arguments for dest bb: std::equal(BI->getArgs().begin(), BI->getArgs().end(), BI->getDestBB()->args_begin(), [&](SILValue branchArg, SILArgument *bbArg) { return verifyBranchArgs(branchArg, bbArg); })
Verifying instruction:
%9 = enum $Optional<any InterfaceT>, #Optional.some!enumelt, %8 : $any InterfaceT // user: %10
-> br bb3(%9 : $Optional<any InterfaceT>) // id: %10
In function:
// @objc closure #1 in Derived.prepare(withP:)
sil shared [thunk] [ossa] @$s4test7DerivedC7prepare5withPySo10InterfaceT_pSg_tYaKFyyYacfU_To : $@convention(thin) @Sendable @async (Optional<any InterfaceT>, @convention(block) @Sendable (Optional<NSError>) -> (), Derived) -> () {
// %0 // user: %4
// %1 // user: %5
// %2 // user: %6
bb0(%0 : @unowned $Optional<any InterfaceT>, %1 : @unowned $@convention(block) @Sendable (Optional<NSError>) -> (), %2 : @unowned $Derived):
%3 = enum $Optional<any Actor>, #Optional.none!enumelt // user: %17
%4 = copy_value %0 // user: %7
%5 = copy_block %1 // users: %35, %26, %23, %19
%6 = copy_value %2 // users: %41, %15
switch_enum %4, case #Optional.some!enumelt: bb1, case #Optional.none!enumelt: bb2 // id: %7
// %8 // user: %9
bb1(%8 : @owned $any InterfaceT): // Preds: bb0
%9 = enum $Optional<any InterfaceT>, #Optional.some!enumelt, %8 // user: %10
br bb3(%9) // id: %10
bb2: // Preds: bb0
%11 = enum $Optional<any Actor>, #Optional.none!enumelt // user: %12
br bb3(%11) // id: %12
// %13 // users: %40, %14
bb3(%13 : @owned $Optional<any Actor>): // Preds: bb2 bb1
%14 = begin_borrow %13 // users: %39, %17
%15 = begin_borrow %6 // users: %38, %17
// function_ref Derived.prepare(withP:)
%16 = function_ref @$s4test7DerivedC7prepare5withPySo10InterfaceT_pSg_tYaKF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional<any Actor>, @guaranteed Optional<any InterfaceT>, @guaranteed Derived) -> @error any Error // user: %17
try_apply %16(%3, %14, %15) : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional<any Actor>, @guaranteed Optional<any InterfaceT>, @guaranteed Derived) -> @error any Error, normal bb4, error bb5 // id: %17
bb4(%18 : $()): // Preds: bb3
%19 = begin_borrow %5 // users: %22, %21
%20 = enum $Optional<NSError>, #Optional.none!enumelt // user: %21
%21 = apply %19(%20) : $@convention(block) @Sendable (Optional<NSError>) -> ()
end_borrow %19 // id: %22
destroy_value %5 // id: %23
br bb6 // id: %24
// %25 // users: %36, %28
bb5(%25 : @owned $any Error): // Preds: bb3
%26 = begin_borrow %5 // users: %34, %31
// function_ref _convertErrorToNSError(_:)
%27 = function_ref @$s10Foundation22_convertErrorToNSErrorySo0E0Cs0C0_pF : $@convention(thin) (@guaranteed any Error) -> @owned NSError // user: %28
%28 = apply %27(%25) : $@convention(thin) (@guaranteed any Error) -> @owned NSError // user: %29
%29 = enum $Optional<NSError>, #Optional.some!enumelt, %28 // users: %33, %30
%30 = begin_borrow %29 // users: %32, %31
%31 = apply %26(%30) : $@convention(block) @Sendable (Optional<NSError>) -> ()
end_borrow %30 // id: %32
destroy_value %29 // id: %33
end_borrow %26 // id: %34
destroy_value %5 // id: %35
destroy_value %25 // id: %36
br bb6 // id: %37
bb6: // Preds: bb5 bb4
end_borrow %15 // id: %38
end_borrow %14 // id: %39
destroy_value %13 // id: %40
destroy_value %6 // id: %41
return undef : $() // id: %42
} // end sil function '$s4test7DerivedC7prepare5withPySo10InterfaceT_pSg_tYaKFyyYacfU_To'
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Users/adamcmiel/swift-project/build/mymacos/swift-macosx-arm64/bin/swift-frontend -frontend -c -primary-file /tmp/test.swift -target arm64-apple-darwin24.5.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -color-diagnostics -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -in-process-plugin-server-path /Users/adamcmiel/swift-project/build/mymacos/swift-macosx-arm64/lib/swift/host/libSwiftInProcPluginServer.dylib -plugin-path /Users/adamcmiel/swift-project/build/mymacos/swift-macosx-arm64/lib/swift/host/plugins -plugin-path /Users/adamcmiel/swift-project/build/mymacos/swift-macosx-arm64/local/lib/swift/host/plugins -target-sdk-version 15.5 -dwarf-version=5 -import-objc-header /var/folders/g2/h2nk3wrn2y3byx7rk9_bwzn80000gn/T/interface-84513f.pch -module-name test -o /var/folders/g2/h2nk3wrn2y3byx7rk9_bwzn80000gn/T/test-286d30.o
1. Apple Swift version 6.2-dev (LLVM 3a14731cff72f5b, Swift 234a41567f66275)
2. Compiling with effective version 5.10
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/tmp/test.swift")
4. While silgen emitNativeToForeignThunk SIL function "@$s4test7DerivedC7prepare5withPySo10InterfaceT_pSg_tYaKFTo".
for 'prepare(withP:)' (at /tmp/test.swift:4:43)
5. While verifying SIL function "@$s4test7DerivedC7prepare5withPySo10InterfaceT_pSg_tYaKFyyYacfU_To".
for 'prepare(withP:)' (at /tmp/test.swift:4:43)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x000000010ba35178 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x000000010ba33340 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x000000010ba35810 SignalHandler(int, __siginfo*, void*) + 360
3 libsystem_platform.dylib 0x000000018566c624 _sigtramp + 56
4 libsystem_pthread.dylib 0x000000018563288c pthread_kill + 296
5 libsystem_c.dylib 0x000000018553bc60 abort + 124
6 swift-frontend 0x0000000104991d4c swift::verificationFailure(llvm::Twine const&, swift::SILInstruction const*, swift::SILArgument const*, std::__1::function<void ()> const&) + 732
7 swift-frontend 0x0000000104997b74 (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 76
8 swift-frontend 0x00000001049da370 (anonymous namespace)::SILVerifier::checkBranchInst(swift::BranchInst*) + 344
9 swift-frontend 0x00000001049a9904 (anonymous namespace)::SILVerifierBase<(anonymous namespace)::SILVerifier>::visitBranchInst(swift::BranchInst*) + 48
10 swift-frontend 0x00000001049a4158 swift::SILInstructionVisitor<(anonymous namespace)::SILVerifier, void>::visit(swift::SILInstruction*) + 3192
11 swift-frontend 0x00000001049a2f90 swift::SILVisitorBase<(anonymous namespace)::SILVerifier, void>::visitSILBasicBlock(swift::SILBasicBlock*) + 128
12 swift-frontend 0x00000001049a2b68 (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 36
13 swift-frontend 0x000000010499cc00 (anonymous namespace)::SILVerifier::visitSILBasicBlocks(swift::SILFunction*) + 176
14 swift-frontend 0x000000010499a0e4 (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 2124
15 swift-frontend 0x0000000104992ce4 (anonymous namespace)::SILVerifier::verify(bool) + 136
16 swift-frontend 0x0000000104992b1c swift::SILFunction::verify(swift::CalleeCache*, bool, bool, bool) const + 176
17 swift-frontend 0x000000010335dce8 swift::SILFunction::verifyIncompleteOSSA() const + 48
18 swift-frontend 0x000000010335ccfc swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) + 324
19 swift-frontend 0x000000010335a7a0 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 1340
20 swift-frontend 0x00000001035c5098 swift::Lowering::SILGenModule::emitNativeToForeignThunk(swift::SILDeclRef) + 220
21 swift-frontend 0x0000000103360a68 swift::Lowering::SILGenModule::emitObjCMethodThunk(swift::FuncDecl*) + 224
22 swift-frontend 0x00000001035e89e8 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 140
23 swift-frontend 0x00000001035e8220 swift::ASTVisitor<(anonymous namespace)::SILGenType, void, void, void, void, void, void>::visit(swift::Decl*) + 872
24 swift-frontend 0x00000001035e7a28 (anonymous namespace)::SILGenType::visit(swift::Decl*) + 64
25 swift-frontend 0x00000001035db430 (anonymous namespace)::SILGenType::emitType() + 236
26 swift-frontend 0x00000001035db2fc swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 48
27 swift-frontend 0x000000010337db74 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visitClassDecl(swift::ClassDecl*) + 32
28 swift-frontend 0x0000000103359b9c swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 268
29 swift-frontend 0x0000000103359a80 swift::Lowering::SILGenModule::visit(swift::Decl*) + 60
30 swift-frontend 0x0000000103361cb4 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 252
31 swift-frontend 0x0000000103362600 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 700
32 swift-frontend 0x00000001035b57e0 std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)17>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 116
33 swift-frontend 0x00000001035b572c 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&) + 40
34 swift-frontend 0x0000000103381560 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'()) + 240
35 swift-frontend 0x0000000103381464 swift::ASTLoweringRequest::OutputType swift::Evaluator::operator()<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'(), (void*)0>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 40
36 swift-frontend 0x0000000103362d68 swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest) + 40
37 swift-frontend 0x0000000103362ff4 swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 184
38 swift-frontend 0x00000001025134f8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 600
39 swift-frontend 0x0000000102535e0c performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_7::operator()(swift::CompilerInstance&) const + 140
40 swift-frontend 0x0000000102535d74 bool llvm::function_ref<bool (swift::CompilerInstance&)>::callback_fn<performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_7>(long, swift::CompilerInstance&) + 32
41 swift-frontend 0x00000001025351fc llvm::function_ref<bool (swift::CompilerInstance&)>::operator()(swift::CompilerInstance&) const + 40
42 swift-frontend 0x0000000102533de4 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 420
43 swift-frontend 0x000000010252e100 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1224
44 swift-frontend 0x000000010251576c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 252
45 swift-frontend 0x0000000102514bd4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 1932
46 swift-frontend 0x000000010217480c run_driver(llvm::StringRef, llvm::ArrayRef<char const*>, llvm::ArrayRef<char const*>) + 320
47 swift-frontend 0x0000000102173c38 swift::mainEntry(int, char const**) + 1160
48 swift-frontend 0x00000001021733c8 main + 36
49 dyld 0x0000000185292b98 start + 6076
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
Expected behavior
no crash
Environment
OSS swift on b97df26
Xcode 16.4
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels