mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* Support extensions including conditional conformance * Correct access modifiers * More correct lookup for the synthesized declarations * Avoid printing decls in nested types (rdar://98025945)
39 lines
1.0 KiB
Swift
39 lines
1.0 KiB
Swift
// RUN: rm -rf %t.result && mkdir -p %t.result
|
|
|
|
struct User1: Codable {
|
|
let firstName: String
|
|
let lastName: String?
|
|
|
|
init(from decoder: any Decoder) throws {
|
|
firstName = ""
|
|
lastName = ""
|
|
}
|
|
func encode(to encoder: any Encoder) throws {}
|
|
}
|
|
|
|
// RUN: %refactor -source-filename %s -pos=3:8 | %FileCheck %s
|
|
// CHECK-NOT: Add Explicit Codable
|
|
|
|
struct User2: Codable {
|
|
let firstName: String
|
|
let lastName: String?
|
|
|
|
init(from decoder: any Decoder) throws {
|
|
firstName = ""
|
|
lastName = ""
|
|
}
|
|
}
|
|
|
|
// RUN: %refactor -add-explicit-codable-implementation -source-filename %s -pos=17:8 > %t.result/has_encodable.swift
|
|
// RUN: diff -u %S/Outputs/existing/has_encodable.swift.expected %t.result/has_encodable.swift
|
|
|
|
struct User3: Codable {
|
|
let firstName: String
|
|
let lastName: String?
|
|
|
|
func encode(to encoder: any Encoder) throws {}
|
|
}
|
|
|
|
// RUN: %refactor -add-explicit-codable-implementation -source-filename %s -pos=30:8 > %t.result/has_decodable.swift
|
|
// RUN: diff -u %S/Outputs/existing/has_decodable.swift.expected %t.result/has_decodable.swift
|