Files
swift-mirror/test/ModuleInterface/effectful_properties.swift
Kavon Farvardin e17e09c294 Enable effectful properties (SE-310) by default.
1. Removes gating on -enable-experimental-concurrency.
2. Updates eff. prop tests to remove experimental flag,
   and also adjusts some tests slightly to avoid things
   that are still behind that flag.
2021-05-03 14:10:44 -07:00

61 lines
1.6 KiB
Swift

// RUN: %target-swift-frontend -typecheck -swift-version 5 -enable-library-evolution -emit-module-interface-path %t.swiftinterface %s -module-name EffProps
// RUN: %FileCheck %s < %t.swiftinterface
public struct MyStruct {}
// CHECK-LABEL: #if compiler(>=5.3) && $EffectfulProp
// CHECK: public var status: Swift.Bool {
// CHECK: get async throws
// CHECK: }
// CHECK: #endif
public extension MyStruct {
struct InnerStruct {
public var status: Bool { get async throws { false } }
}
}
// CHECK-LABEL: #if compiler(>=5.3) && $EffectfulProp
// CHECK: public var hello: Swift.Int {
// CHECK: get async
// CHECK: }
// CHECK: #endif
// CHECK-LABEL: #if compiler(>=5.3) && $EffectfulProp
// CHECK: public subscript(x: Swift.Int) -> Swift.Void {
// CHECK: get async throws
// CHECK: }
// CHECK: #endif
public class C {
public var hello: Int { get async { 0 } }
public subscript(_ x: Int) -> Void {
get async throws { }
}
}
// CHECK-LABEL: #if compiler(>=5.3) && $EffectfulProp
// CHECK: public var world: Swift.Int {
// CHECK: get throws
// CHECK: }
// CHECK: #endif
public enum E {
public var world: Int { get throws { 0 } }
}
// CHECK-LABEL: #if compiler(>=5.3) && $EffectfulProp
// CHECK: var books: Swift.Int { get async }
// CHECK: #endif
// CHECK-LABEL: #if compiler(>=5.3) && $EffectfulProp
// CHECK: subscript(x: Swift.Int) -> Swift.Int { get throws }
// CHECK: #endif
public protocol P {
var books: Int { get async }
subscript(_ x: Int) -> Int { get throws }
}