mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
EmbeddedSwiftDiagnostics: fix a wrong "cannot use co-routines (like accessors) in -no-allocations mode" error
rdar://150890424
This commit is contained in:
@@ -130,10 +130,16 @@ private struct FunctionChecker {
|
||||
throw Diagnostic(.embedded_swift_allocating_type, (instruction as! SingleValueInstruction).type,
|
||||
at: instruction.location)
|
||||
}
|
||||
|
||||
case is BeginApplyInst:
|
||||
throw Diagnostic(.embedded_swift_allocating_coroutine, at: instruction.location)
|
||||
if context.options.noAllocations {
|
||||
throw Diagnostic(.embedded_swift_allocating_coroutine, at: instruction.location)
|
||||
}
|
||||
|
||||
case is ThunkInst:
|
||||
throw Diagnostic(.embedded_swift_allocating, at: instruction.location)
|
||||
if context.options.noAllocations {
|
||||
throw Diagnostic(.embedded_swift_allocating, at: instruction.location)
|
||||
}
|
||||
|
||||
case let pai as PartialApplyInst:
|
||||
if context.options.noAllocations && !pai.isOnStack {
|
||||
|
||||
19
test/embedded/coroutines-and-testing.swift
Normal file
19
test/embedded/coroutines-and-testing.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
// Make sure this can be compiled without any errors
|
||||
|
||||
// RUN: %target-swift-frontend %s -emit-ir -o /dev/null -enable-experimental-feature Embedded -enable-testing
|
||||
// RUN: %target-swift-frontend %s -emit-ir -o /dev/null -enable-experimental-feature Embedded -enable-testing -no-allocations
|
||||
|
||||
|
||||
// REQUIRES: VENDOR=apple
|
||||
// REQUIRES: OS=macosx
|
||||
// REQUIRES: swift_feature_Embedded
|
||||
|
||||
public protocol P {
|
||||
var storage: UInt32 { get set }
|
||||
}
|
||||
|
||||
struct MyStruct: P {
|
||||
var storage: UInt32
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user