From 4d3aa95d59d162454623e1536180968ecb132da1 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Fri, 17 Jun 2022 21:06:59 +0300 Subject: [PATCH 1/5] Add regression test to close #42790 --- test/expr/closure/inference.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/expr/closure/inference.swift b/test/expr/closure/inference.swift index 0e9ac2a943f4b..199091ad687d3 100644 --- a/test/expr/closure/inference.swift +++ b/test/expr/closure/inference.swift @@ -77,3 +77,12 @@ cc(1) // Ok func SR12955() { let f: @convention(c) (T) -> Void // expected-error {{cannot find type 'T' in scope}} } + +// https://github.com/apple/swift/issues/42790 +do { + func foo(block: () -> ()) -> T.Type { T.self } // expected-note {{in call to function 'foo(block:)'}} + + let x = foo { // expected-error {{generic parameter 'T' could not be inferred}} + print("") + } +} From f6b39ae6ae37e2d893cc10d72735843284d9d815 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Fri, 17 Jun 2022 21:35:30 +0300 Subject: [PATCH 2/5] Add regression test to close #52883 --- test/decl/protocol/protocol_with_superclass.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/decl/protocol/protocol_with_superclass.swift b/test/decl/protocol/protocol_with_superclass.swift index 33324de7b827a..e1322bb4ac7b8 100644 --- a/test/decl/protocol/protocol_with_superclass.swift +++ b/test/decl/protocol/protocol_with_superclass.swift @@ -351,3 +351,12 @@ func usesProtoRefinesClass2(_ t: T) { t.genericMethod((1, 2)) let _: BaseProto = t } + +// https://github.com/apple/swift/issues/52883 +class issue52883_C: issue52883_P {} +protocol issue52883_P: issue52883_C { + func foo() +} +extension issue52883_P { + func foo() {} +} From 767423a3c9f195c3d6569de5b1db0ed8d99ff31a Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Mon, 20 Jun 2022 21:22:04 +0300 Subject: [PATCH 3/5] Add regression test to close #59572 --- .../compiler_crashers_2_fixed/issue59572.swift | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 validation-test/compiler_crashers_2_fixed/issue59572.swift diff --git a/validation-test/compiler_crashers_2_fixed/issue59572.swift b/validation-test/compiler_crashers_2_fixed/issue59572.swift new file mode 100644 index 0000000000000..a5330555010f6 --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/issue59572.swift @@ -0,0 +1,9 @@ +// RUN: %target-swift-emit-ir %s + +// https://github.com/apple/swift/issues/59572 + +func foo(src: Any, target: inout T) where T.RawValue == UInt { + if let x = src as? UInt, let x = T(rawValue: x) { + target = x + } +} From 2d5e591601729426277bfad8cd2e8783d8e7c37b Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Wed, 22 Jun 2022 04:01:52 +0300 Subject: [PATCH 4/5] Add regression test to close #43069 --- test/IRGen/recursion_infinite_optimized.sil | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/IRGen/recursion_infinite_optimized.sil diff --git a/test/IRGen/recursion_infinite_optimized.sil b/test/IRGen/recursion_infinite_optimized.sil new file mode 100644 index 0000000000000..ee0d26fed0dcc --- /dev/null +++ b/test/IRGen/recursion_infinite_optimized.sil @@ -0,0 +1,22 @@ +// RUN: %target-swift-emit-ir %s -O | %FileCheck %s + +// https://github.com/apple/swift/issues/43069 + +sil_stage canonical + +import Swift + +sil @rec : $@convention(thin) (Int) -> Int { +bb0(%arg : $Int): + %ref = function_ref @rec : $@convention(thin) (Int) -> Int + %res = apply %ref(%arg) : $@convention(thin) (Int) -> Int + return %res : $Int +} + +// CHECK: define{{.*}} swiftcc [[T:i[0-9]+]] @rec([[T]] %0) #0 { +// CHECK-NEXT: entry: +// CHECK-NEXT: br label %tailrecurse +// CHECK-EMPTY: +// CHECK-NEXT: tailrecurse: +// CHECK-NEXT: br label %tailrecurse +// CHECK-NEXT: } From 2e75a14e620038cae6b39b698616ad8a1a7cb1d9 Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Wed, 22 Jun 2022 04:39:40 +0300 Subject: [PATCH 5/5] Add regression test to close #43070 --- test/Interpreter/collection_casts.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/Interpreter/collection_casts.swift b/test/Interpreter/collection_casts.swift index 654ef593b32c8..c8c1b1286b4a8 100644 --- a/test/Interpreter/collection_casts.swift +++ b/test/Interpreter/collection_casts.swift @@ -73,6 +73,12 @@ a_array_3?.forEach { $0.preen() } // CHECK-NEXT: A10 // CHECK-NEXT: A20 +let a_array_4 = preening_array_1 as! [A] +a_array_4.forEach { $0.preen() } +// CHECK-NEXT: A5 +// CHECK-NEXT: A10 +// CHECK-NEXT: A20 + } do {