Skip to content

Add test case for IRGen assert failure #15076

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

Merged
merged 1 commit into from
Mar 8, 2018
Merged
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
20 changes: 20 additions & 0 deletions test/IRGen/partial_apply.sil
Original file line number Diff line number Diff line change
Expand Up @@ -498,3 +498,23 @@ entry(%0: $@thin SwiftStruct.Type, %1: $SwiftClass):
%closure = partial_apply %fun (%0, %1) : $@convention(thin) (@thin SwiftStruct.Type, @owned SwiftClass) -> ()
return %closure : $@callee_owned () -> ()
}

sil @afun : $@convention(thin) (Int) -> @error Error

// Check that we don't assert on a thin noescape function.
// CHECK-LABEL: define{{.*}} swiftcc void @convert_thin_test
// CHECK: call swiftcc void @afun(i64 {{.*}}, %swift.refcounted* swiftself undef
// CHECK: ret void
sil @convert_thin_test : $@convention(thin) (Int) -> () {
bb(%0 : $Int):
%f = function_ref @afun : $@convention(thin) (Int) -> @error Error
%c = convert_function %f : $@convention(thin) (Int) -> @error Error to $@convention(thin) @noescape (Int) -> @error Error
try_apply %c(%0) : $@convention(thin) @noescape (Int) -> @error Error, normal bb2, error bb1

bb1(%err: $Error):
%t = tuple ()
br bb2(%t: $())

bb2(%v : $()):
return %v : $()
}