Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression tests to close some issues #59535

Merged
merged 5 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
AnthonyLatsis marked this conversation as resolved.
Show resolved Hide resolved
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
}
}