Files
swift-mirror/validation-test/compiler_crashers_2_fixed/rdar79383990.swift
Nate Chandler 4aff98ffb5 [SILGen] Use opaque AP for ObjC-async returns.
Previously, the AbstractionPattern that was used for the value
"returned" (i.e. via a completion handler) from ObjC mostly (but not
quite always) was "type".

The generated completion handler correctly (because this is required in
order to call _resumeUnsafeContinuation) reabstracted the block (e.g.
from @convention(block) to @substituted <T> () -> @out T for <()>).  The
callee of the ObjC function, however, loaded the function from the block
as if it were not reabstracted (e.g. () -> ()).

On most platforms, that happened to work.  On arm64e, that difference in
types caused in a difference in pointer signing, resulting in a failure
at runtime.

rdar://85526879
rdar://85526916
2022-04-20 10:42:45 -07:00

9 lines
248 B
Swift

// RUN: %target-swift-frontend %s -emit-silgen -disable-availability-checking -import-objc-header %S/Inputs/rdar79383990.h
// REQUIRES: objc_interop
import Foundation
func test(s: BackgroundActivityScheduler) async {
_ = await s.schedule()
}