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: } 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 { 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() {} +} 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("") + } +} 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 + } +}