Skip to content

Commit

Permalink
Merge pull request #59535 from AnthonyLatsis/close-issues-1
Browse files Browse the repository at this point in the history
Add regression tests to close some issues
  • Loading branch information
AnthonyLatsis committed Jun 23, 2022
2 parents c6ff96f + 2e75a14 commit 15acfa9
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/IRGen/recursion_infinite_optimized.sil
Original file line number Diff line number Diff line change
@@ -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: }
6 changes: 6 additions & 0 deletions test/Interpreter/collection_casts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions test/decl/protocol/protocol_with_superclass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,12 @@ func usesProtoRefinesClass2<T : ProtoRefinesClassComposition>(_ 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() {}
}
9 changes: 9 additions & 0 deletions test/expr/closure/inference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(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("")
}
}
9 changes: 9 additions & 0 deletions validation-test/compiler_crashers_2_fixed/issue59572.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: %target-swift-emit-ir %s

// https://github.com/apple/swift/issues/59572

func foo<T: RawRepresentable>(src: Any, target: inout T) where T.RawValue == UInt {
if let x = src as? UInt, let x = T(rawValue: x) {
target = x
}
}

0 comments on commit 15acfa9

Please sign in to comment.