Skip to content

Commit 15acfa9

Browse files
Merge pull request #59535 from AnthonyLatsis/close-issues-1
Add regression tests to close some issues
2 parents c6ff96f + 2e75a14 commit 15acfa9

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %target-swift-emit-ir %s -O | %FileCheck %s
2+
3+
// https://github.com/apple/swift/issues/43069
4+
5+
sil_stage canonical
6+
7+
import Swift
8+
9+
sil @rec : $@convention(thin) (Int) -> Int {
10+
bb0(%arg : $Int):
11+
%ref = function_ref @rec : $@convention(thin) (Int) -> Int
12+
%res = apply %ref(%arg) : $@convention(thin) (Int) -> Int
13+
return %res : $Int
14+
}
15+
16+
// CHECK: define{{.*}} swiftcc [[T:i[0-9]+]] @rec([[T]] %0) #0 {
17+
// CHECK-NEXT: entry:
18+
// CHECK-NEXT: br label %tailrecurse
19+
// CHECK-EMPTY:
20+
// CHECK-NEXT: tailrecurse:
21+
// CHECK-NEXT: br label %tailrecurse
22+
// CHECK-NEXT: }

test/Interpreter/collection_casts.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ a_array_3?.forEach { $0.preen() }
7373
// CHECK-NEXT: A10
7474
// CHECK-NEXT: A20
7575

76+
let a_array_4 = preening_array_1 as! [A]
77+
a_array_4.forEach { $0.preen() }
78+
// CHECK-NEXT: A5
79+
// CHECK-NEXT: A10
80+
// CHECK-NEXT: A20
81+
7682
}
7783

7884
do {

test/decl/protocol/protocol_with_superclass.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,12 @@ func usesProtoRefinesClass2<T : ProtoRefinesClassComposition>(_ t: T) {
351351
t.genericMethod((1, 2))
352352
let _: BaseProto = t
353353
}
354+
355+
// https://github.com/apple/swift/issues/52883
356+
class issue52883_C: issue52883_P {}
357+
protocol issue52883_P: issue52883_C {
358+
func foo()
359+
}
360+
extension issue52883_P {
361+
func foo() {}
362+
}

test/expr/closure/inference.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,12 @@ cc(1) // Ok
7777
func SR12955() {
7878
let f: @convention(c) (T) -> Void // expected-error {{cannot find type 'T' in scope}}
7979
}
80+
81+
// https://github.com/apple/swift/issues/42790
82+
do {
83+
func foo<T>(block: () -> ()) -> T.Type { T.self } // expected-note {{in call to function 'foo(block:)'}}
84+
85+
let x = foo { // expected-error {{generic parameter 'T' could not be inferred}}
86+
print("")
87+
}
88+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-swift-emit-ir %s
2+
3+
// https://github.com/apple/swift/issues/59572
4+
5+
func foo<T: RawRepresentable>(src: Any, target: inout T) where T.RawValue == UInt {
6+
if let x = src as? UInt, let x = T(rawValue: x) {
7+
target = x
8+
}
9+
}

0 commit comments

Comments
 (0)