mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When calling a witness table accessor, IRGen was forcing the conforming type to have complete metadata, even though only abstract metadata is required for that query. This could cause cyclic metadata dependencies when checking conditional conformances. Fixes SR-5958.
32 lines
748 B
Swift
32 lines
748 B
Swift
// RUN: %target-run-simple-swift
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: objc_interop
|
|
|
|
// SR-5958
|
|
import Foundation
|
|
|
|
public struct Property: Equatable, Hashable, Codable {
|
|
public var value: PropertyValue<Property>
|
|
}
|
|
|
|
public enum PropertyValue<P>: Equatable, Hashable where P: Equatable & Hashable {
|
|
case invalid
|
|
case date(date: Date?)
|
|
}
|
|
|
|
extension PropertyValue: Codable where P: Codable {
|
|
public func encode(to encoder: Encoder) throws {}
|
|
public init(from decoder: Decoder) throws { self = .invalid }
|
|
}
|
|
|
|
extension String: Error {}
|
|
|
|
let encoder = JSONEncoder()
|
|
let json = try! encoder.encode(
|
|
Property(value: .invalid)
|
|
)
|
|
|
|
let decoder = JSONDecoder()
|
|
let result = try! decoder.decode(Property.self, from: json)
|
|
print(result)
|