Gardening: Migrate test suite to GH issues: Compatibility

This commit is contained in:
Anthony Latsis
2022-08-13 03:52:07 +03:00
parent b0fb7c54b2
commit 24d1fbb5ac
5 changed files with 73 additions and 70 deletions

View File

@@ -803,7 +803,8 @@ func checkLiteralTuples() {
}
}
func sr6975() {
// https://github.com/apple/swift/issues/49523
do {
enum E {
case a, b
}
@@ -1177,42 +1178,43 @@ extension Result where T == NoError {
}
}
enum SR10301<T,E> {
case value(T)
case error(E)
}
enum SR10301Error: Error {
case bad
}
// https://github.com/apple/swift/issues/52701
do {
enum Enum<T,E> {
case value(T)
case error(E)
}
enum MyError: Error {
case bad
}
let foo: Enum<String, (Int, Error)>
func sr10301(_ foo: SR10301<String,(Int,Error)>) {
switch foo {
case .value: return
case .error((_, SR10301Error.bad)): return
case .value: break
case .error((_, MyError.bad)): break
case .error((_, let err)):
_ = err
return
break
}
}
func sr10301_is(_ foo: SR10301<String,(Int,Error)>) {
// 'is'
switch foo {
case .value: return
case .error((_, is SR10301Error)): return
case .value: break
case .error((_, is MyError)): break
case .error((_, let err)):
_ = err
return
break
}
}
func sr10301_as(_ foo: SR10301<String,(Int,Error)>) {
// 'as'
switch foo {
case .value: return
case .error((_, let err as SR10301Error)):
case .value: break
case .error((_, let err as MyError)):
_ = err
return
break
case .error((_, let err)):
_ = err
return
break
}
}

View File

@@ -2,6 +2,7 @@
// REQUIRES: executable_test
// https://github.com/apple/swift/issues/53611
// Even though we test that type-checking and exhaustiveness checking work fine
// in the presence of implicit tupling/untupling in exhaustive_switch.swift,
// make sure that the "patched" patterns do not lead to incorrect codegen.
@@ -12,46 +13,46 @@ enum Untupled {
let u_ex = Untupled.upair(1, 2)
func sr11212_content_untupled_pattern_tupled1(u: Untupled) -> (Int, Int) {
func content_untupled_pattern_tupled1(u: Untupled) -> (Int, Int) {
switch u { case .upair((let x, let y)): return (x, y) }
}
print(sr11212_content_untupled_pattern_tupled1(u: u_ex))
print(content_untupled_pattern_tupled1(u: u_ex))
// CHECK: (1, 2)
func sr11212_content_untupled_pattern_tupled2(u: Untupled) -> (Int, Int) {
func content_untupled_pattern_tupled2(u: Untupled) -> (Int, Int) {
switch u { case .upair(let (x, y)): return (x, y) }
}
print(sr11212_content_untupled_pattern_tupled2(u: u_ex))
print(content_untupled_pattern_tupled2(u: u_ex))
// CHECK: (1, 2)
func sr11212_content_untupled_pattern_tupled3(u: Untupled) -> (Int, Int) {
func content_untupled_pattern_tupled3(u: Untupled) -> (Int, Int) {
switch u { case let .upair((x, y)): return (x, y) }
}
print(sr11212_content_untupled_pattern_tupled3(u: u_ex))
print(content_untupled_pattern_tupled3(u: u_ex))
// CHECK: (1, 2)
func sr11212_content_untupled_pattern_untupled1(u: Untupled) -> (Int, Int) {
func content_untupled_pattern_untupled1(u: Untupled) -> (Int, Int) {
switch u { case .upair(let x, let y): return (x, y) }
}
print(sr11212_content_untupled_pattern_untupled1(u: u_ex))
print(content_untupled_pattern_untupled1(u: u_ex))
// CHECK: (1, 2)
func sr11212_content_untupled_pattern_untupled2(u: Untupled) -> (Int, Int) {
func content_untupled_pattern_untupled2(u: Untupled) -> (Int, Int) {
switch u { case let .upair(x, y): return (x, y) }
}
print(sr11212_content_untupled_pattern_untupled2(u: u_ex))
print(content_untupled_pattern_untupled2(u: u_ex))
// CHECK: (1, 2)
func sr11212_content_untupled_pattern_ambiguous1(u: Untupled) -> (Int, Int) {
func content_untupled_pattern_ambiguous1(u: Untupled) -> (Int, Int) {
switch u { case .upair(let u_): return u_ }
}
print(sr11212_content_untupled_pattern_ambiguous1(u: u_ex))
print(content_untupled_pattern_ambiguous1(u: u_ex))
// CHECK: (1, 2)
func sr11212_content_untupled_pattern_ambiguous2(u: Untupled) -> (Int, Int) {
func content_untupled_pattern_ambiguous2(u: Untupled) -> (Int, Int) {
switch u { case let .upair(u_): return u_ }
}
print(sr11212_content_untupled_pattern_ambiguous2(u: u_ex))
print(content_untupled_pattern_ambiguous2(u: u_ex))
// CHECK: (1, 2)
enum Tupled {
@@ -60,46 +61,46 @@ enum Tupled {
let t_ex = Tupled.tpair((1, 2))
func sr11212_content_tupled_pattern_tupled1(t: Tupled) -> (Int, Int) {
func content_tupled_pattern_tupled1(t: Tupled) -> (Int, Int) {
switch t { case .tpair((let x, let y)): return (x, y) }
}
print(sr11212_content_tupled_pattern_tupled1(t: t_ex))
print(content_tupled_pattern_tupled1(t: t_ex))
// CHECK: (1, 2)
func sr11212_content_tupled_pattern_tupled2(t: Tupled) -> (Int, Int) {
func content_tupled_pattern_tupled2(t: Tupled) -> (Int, Int) {
switch t { case .tpair(let (x, y)): return (x, y) }
}
print(sr11212_content_tupled_pattern_tupled2(t: t_ex))
print(content_tupled_pattern_tupled2(t: t_ex))
// CHECK: (1, 2)
func sr11212_content_tupled_pattern_tupled3(t: Tupled) -> (Int, Int) {
func content_tupled_pattern_tupled3(t: Tupled) -> (Int, Int) {
switch t { case let .tpair((x, y)): return (x, y) }
}
print(sr11212_content_tupled_pattern_tupled3(t: t_ex))
print(content_tupled_pattern_tupled3(t: t_ex))
// CHECK: (1, 2)
func sr11212_content_tupled_pattern_untupled1(t: Tupled) -> (Int, Int) {
func content_tupled_pattern_untupled1(t: Tupled) -> (Int, Int) {
switch t { case .tpair(let x, let y): return (x, y) }
}
print(sr11212_content_tupled_pattern_untupled1(t: t_ex))
print(content_tupled_pattern_untupled1(t: t_ex))
// CHECK: (1, 2)
func sr11212_content_tupled_pattern_untupled2(t: Tupled) -> (Int, Int) {
func content_tupled_pattern_untupled2(t: Tupled) -> (Int, Int) {
switch t { case let .tpair(x, y): return (x, y) }
}
print(sr11212_content_tupled_pattern_untupled2(t: t_ex))
print(content_tupled_pattern_untupled2(t: t_ex))
// CHECK: (1, 2)
func sr11212_content_tupled_pattern_ambiguous1(t: Tupled) -> (Int, Int) {
func content_tupled_pattern_ambiguous1(t: Tupled) -> (Int, Int) {
switch t { case .tpair(let t_): return t_ }
}
print(sr11212_content_tupled_pattern_ambiguous1(t: t_ex))
print(content_tupled_pattern_ambiguous1(t: t_ex))
// CHECK: (1, 2)
func sr11212_content_tupled_pattern_ambiguous2(t: Tupled) -> (Int, Int) {
func content_tupled_pattern_ambiguous2(t: Tupled) -> (Int, Int) {
switch t { case let .tpair(t_): return t_ }
}
print(sr11212_content_tupled_pattern_ambiguous2(t: t_ex))
print(content_tupled_pattern_ambiguous2(t: t_ex))
// CHECK: (1, 2)
enum Box<T> {
@@ -108,44 +109,44 @@ enum Box<T> {
let b_ex : Box<(Int, Int)> = Box.box((1, 2))
func sr11212_content_generic_pattern_tupled1(b: Box<(Int, Int)>) -> (Int, Int) {
func content_generic_pattern_tupled1(b: Box<(Int, Int)>) -> (Int, Int) {
switch b { case .box((let x, let y)): return (x, y) }
}
print(sr11212_content_generic_pattern_tupled1(b: b_ex))
print(content_generic_pattern_tupled1(b: b_ex))
// CHECK: (1, 2)
func sr11212_content_generic_pattern_tupled2(b: Box<(Int, Int)>) -> (Int, Int) {
func content_generic_pattern_tupled2(b: Box<(Int, Int)>) -> (Int, Int) {
switch b { case .box(let (x, y)): return (x, y) }
}
print(sr11212_content_generic_pattern_tupled2(b: b_ex))
print(content_generic_pattern_tupled2(b: b_ex))
// CHECK: (1, 2)
func sr11212_content_generic_pattern_tupled3(b: Box<(Int, Int)>) -> (Int, Int) {
func content_generic_pattern_tupled3(b: Box<(Int, Int)>) -> (Int, Int) {
switch b { case let .box((x, y)): return (x, y) }
}
print(sr11212_content_generic_pattern_tupled3(b: b_ex))
print(content_generic_pattern_tupled3(b: b_ex))
// CHECK: (1, 2)
func sr11212_content_generic_pattern_untupled1(b: Box<(Int, Int)>) -> (Int, Int) {
func content_generic_pattern_untupled1(b: Box<(Int, Int)>) -> (Int, Int) {
switch b { case .box(let x, let y): return (x, y) }
}
print(sr11212_content_generic_pattern_untupled1(b: b_ex))
print(content_generic_pattern_untupled1(b: b_ex))
// CHECK: (1, 2)
func sr11212_content_generic_pattern_untupled2(b: Box<(Int, Int)>) -> (Int, Int) {
func content_generic_pattern_untupled2(b: Box<(Int, Int)>) -> (Int, Int) {
switch b { case let .box(x, y): return (x, y) }
}
print(sr11212_content_generic_pattern_untupled2(b: b_ex))
print(content_generic_pattern_untupled2(b: b_ex))
// CHECK: (1, 2)
func sr11212_content_generic_pattern_ambiguous1(b: Box<(Int, Int)>) -> (Int, Int) {
func content_generic_pattern_ambiguous1(b: Box<(Int, Int)>) -> (Int, Int) {
switch b { case .box(let b_): return b_ }
}
print(sr11212_content_generic_pattern_ambiguous1(b: b_ex))
print(content_generic_pattern_ambiguous1(b: b_ex))
// CHECK: (1, 2)
func sr11212_content_generic_pattern_ambiguous2(b: Box<(Int, Int)>) -> (Int, Int) {
func content_generic_pattern_ambiguous2(b: Box<(Int, Int)>) -> (Int, Int) {
switch b { case let .box(b_): return b_ }
}
print(sr11212_content_generic_pattern_ambiguous2(b: b_ex))
print(content_generic_pattern_ambiguous2(b: b_ex))
// CHECK: (1, 2)

View File

@@ -1,7 +1,7 @@
// RUN: %target-typecheck-verify-swift -swift-version 4
// SR-695
// in version 4 and earlier all of these should build with no diagnostic
// https://github.com/apple/swift/issues/43310
// In version 4 and earlier all of these should build with no diagnostic.
class Mario {
func getFriend() -> Self { return self }
func getEnemy() -> Mario { return self }

View File

@@ -1,6 +1,6 @@
// RUN: %target-typecheck-verify-swift -swift-version 4
// https://bugs.swift.org/browse/SR-1660
// https://github.com/apple/swift/issues/44269
enum DayOfTheWeek : Int {
case monday = 0

View File

@@ -1,6 +1,6 @@
// RUN: %target-typecheck-verify-swift -swift-version 4
// https://bugs.swift.org/browse/SR-6837
// https://github.com/apple/swift/issues/49386
// FIXME: Can't overload local functions so these must be top-level
func takePairOverload(_ pair: (Int, Int?)) {}
@@ -18,7 +18,7 @@ do {
// expected-error@-1 {{contextual closure type '(Int, Int?) -> ()' expects 2 arguments, but 1 was used in closure body}}
}
// https://bugs.swift.org/browse/SR-6796
// https://github.com/apple/swift/issues/49345
do {
func f(a: (() -> Void)? = nil) {}
func log<T>() -> ((T) -> Void)? { return nil }