Skip to content

Commit 72692e2

Browse files
committed
Add test case for IRGen assert failure
This is for the commit that fixed SR-7138.
1 parent f873444 commit 72692e2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/IRGen/partial_apply.sil

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,23 @@ entry(%0: $@thin SwiftStruct.Type, %1: $SwiftClass):
498498
%closure = partial_apply %fun (%0, %1) : $@convention(thin) (@thin SwiftStruct.Type, @owned SwiftClass) -> ()
499499
return %closure : $@callee_owned () -> ()
500500
}
501+
502+
sil @afun : $@convention(thin) (Int) -> @error Error
503+
504+
// Check that we don't assert on a thin noescape function.
505+
// CHECK-LABEL: define{{.*}} swiftcc void @convert_thin_test
506+
// CHECK: call swiftcc void @afun(i64 {{.*}}, %swift.refcounted* swiftself undef
507+
// CHECK: ret void
508+
sil @convert_thin_test : $@convention(thin) (Int) -> () {
509+
bb(%0 : $Int):
510+
%f = function_ref @afun : $@convention(thin) (Int) -> @error Error
511+
%c = convert_function %f : $@convention(thin) (Int) -> @error Error to $@convention(thin) @noescape (Int) -> @error Error
512+
try_apply %c(%0) : $@convention(thin) @noescape (Int) -> @error Error, normal bb2, error bb1
513+
514+
bb1(%err: $Error):
515+
%t = tuple ()
516+
br bb2(%t: $())
517+
518+
bb2(%v : $()):
519+
return %v : $()
520+
}

0 commit comments

Comments
 (0)