mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL type lowering erases DynamicSelfType, so we generate incorrect code when casting to DynamicSelfType. Fixing this requires a fair amount of plumbing, but most of the changes are mechanical. Note that the textual SIL syntax for casts has changed slightly; the target type is now a formal type without a '$', not a SIL type. Also, the unconditional_checked_cast_value and checked_cast_value_br instructions now take the _source_ formal type as well, just like the *_addr forms they are intended to replace.
37 lines
1.4 KiB
Swift
37 lines
1.4 KiB
Swift
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
|
|
// RUN: %target-swift-emit-silgen %s -target x86_64-apple-macosx10.50 | %FileCheck %s
|
|
// RUN: %target-swift-emit-silgen %s -target x86_64-apple-macosx10.60 | %FileCheck %s
|
|
// REQUIRES: OS=macosx
|
|
|
|
// CHECK-LABEL: sil [available 10.50] [ossa] @$s22availability_attribute17availableFunctionyyF : $@convention(thin) () -> ()
|
|
@available(macOS 10.50, *) public func availableFunction() {}
|
|
|
|
public struct Struct {
|
|
// CHECK-LABEL: sil [available 10.50] [ossa] @$s22availability_attribute6StructV12availableVarSivg : $@convention(method) (Struct) -> Int
|
|
@available(macOS 10.50, *)
|
|
public var availableVar: Int { return 0 }
|
|
|
|
// CHECK-LABEL: sil [available 10.50] [ossa] @$s22availability_attribute6StructV24varWithAvailableAccessorSivg : $@convention(method) (Struct) -> Int
|
|
public var varWithAvailableAccessor: Int {
|
|
@available(macOS 10.50, *)
|
|
get {
|
|
return 0
|
|
}
|
|
}
|
|
}
|
|
|
|
@available(macOS 10.50, *)
|
|
extension Struct {
|
|
// CHECK-LABEL: sil [available 10.50] [ossa] @$s22availability_attribute6StructV24availableExtensionMethodyyF : $@convention(method) (Struct) -> ()
|
|
public func availableExtensionMethod() {}
|
|
}
|
|
|
|
@available(macOS 10.50, *)
|
|
public struct AvailableStruct {
|
|
public func availableMethod() {}
|
|
|
|
public struct Nested {
|
|
public func availableNestedMethod() {}
|
|
}
|
|
}
|