|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-swift-emit-silgen %s > %t/fragile-out.sil |
| 3 | +// %FileCheck --check-prefix=POS %s < %t/fragile-out.sil |
| 4 | +// %FileCheck --check-prefix=NEG %s < %t/fragile-out.sil |
| 5 | +// RUN: %target-swift-emit-silgen -enable-library-evolution %s > %t/resilient-out.sil |
| 6 | +// %FileCheck --check-prefix=POS %s < %t/resilient-out.sil |
| 7 | +// %FileCheck --check-prefix=NEG %s < %t/resilient-out.sil |
| 8 | + |
| 9 | +@frozen |
| 10 | +public struct IsCopyable { |
| 11 | + public init() {} |
| 12 | + |
| 13 | + // Shouldn't get a property descriptor since property type is noncopyable |
| 14 | + // NEG-NOT: sil_property #IsCopyable.noncopyable |
| 15 | + public var noncopyable: IsntCopyable { |
| 16 | + get { IsntCopyable() } |
| 17 | + set { } |
| 18 | + } |
| 19 | + |
| 20 | + // Should get a property descriptor, copyable container and property |
| 21 | + // POS: sil_property #IsCopyable.copyable |
| 22 | + public var copyable: IsCopyable { |
| 23 | + get { IsCopyable() } |
| 24 | + set { } |
| 25 | + } |
| 26 | + |
| 27 | + // Shouldn't get a property descriptor since it's static |
| 28 | + // NEG-NOT: sil_property #IsCopyable.staticCopyable |
| 29 | + public static var staticCopyable: IsCopyable = IsCopyable() |
| 30 | + |
| 31 | + // Shouldn't get a property descriptor since it's static |
| 32 | + // NEG-NOT: sil_property #IsCopyable.staticNoncopyable |
| 33 | + public static var staticNoncopyable: IsntCopyable = IsntCopyable() |
| 34 | +} |
| 35 | + |
| 36 | +@frozen |
| 37 | +public struct IsntCopyable: ~Copyable { |
| 38 | + public init() {} |
| 39 | + |
| 40 | + // Shouldn't get a property descriptor since container and property type are both noncopyable |
| 41 | + // NEG-NOT: sil_property #IsntCopyable.noncopyable |
| 42 | + public var noncopyable: IsntCopyable { |
| 43 | + get { IsntCopyable() } |
| 44 | + set { } |
| 45 | + } |
| 46 | + |
| 47 | + // Shouldn't get a property descriptor since container type is noncopyable |
| 48 | + // NEG-NOT: sil_property #IsntCopyable.copyable |
| 49 | + public var copyable: IsCopyable { |
| 50 | + get { IsCopyable() } |
| 51 | + set { } |
| 52 | + } |
| 53 | + |
| 54 | + // Shouldn't get a property descriptor since it's static |
| 55 | + // NEG-NOT: sil_property #IsntCopyable.staticCopyable |
| 56 | + public static var staticCopyable: IsCopyable = IsCopyable() |
| 57 | + |
| 58 | + // Shouldn't get a property descriptor since it's static |
| 59 | + // NEG-NOT: sil_property #IsntCopyable.staticNoncopyable |
| 60 | + public static var staticNoncopyable: IsntCopyable = IsntCopyable() |
| 61 | +} |
| 62 | + |
| 63 | +// Shouldn't get a property descriptor since it's global |
| 64 | +// NEG-NOT: sil_property #{{.*}}globalCopyable |
| 65 | +public var globalCopyable: IsCopyable = IsCopyable() |
| 66 | + |
| 67 | +// Shouldn't get a property descriptor since it's global |
| 68 | +// NEG-NOT: sil_property #{{.*}}globalNoncopyable |
| 69 | +public var globalNoncopyable: IsntCopyable = IsntCopyable() |
0 commit comments