Skip to content

[Test] Add regression test. #74211

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
Jun 7, 2024
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
34 changes: 34 additions & 0 deletions validation-test/SILGen/rdar129010265.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
// RUN: %target-swift-emit-sil %s -verify

protocol Summable_2: ~Copyable {
static var zero: Self { get }
}

struct NCInt_2: ~Copyable, Summable_2 {
var rawValue: Int

static var zero: Self {
.init(rawValue: 0)
}
}

// CHECK-LABEL: sil {{.*}} [ossa] @$s13rdar1290102657NCInt_2VAA10Summable_2A2aDP4zeroxvrZTW : {{.*}} {
// CHECK: [[METATYPE:%[^,]+]] = metatype $@thin NCInt_2.Type
// CHECK: [[IMPL:%[^,]+]] = function_ref @$s13rdar1290102657NCInt_2V4zeroACvrZ
// CHECK: ([[ZERO:%[^,]+]], [[TOKEN:%[^,]+]]) = begin_apply [[IMPL]]([[METATYPE]])
// CHECK: [[ALLOC:%[^,]+]] = alloc_stack $NCInt_2
// CHECK: [[MARK:%[^,]+]] = mark_unresolved_non_copyable_value [consumable_and_assignable] [[ALLOC]]
// CHECK: [[ADDR:%[^,]+]] = store_borrow [[ZERO]] to [[MARK]]
// CHECK: yield [[ADDR:%[^,]+]]
// CHECK: resume [[RESUME:bb[0-9]+]]
// CHECK: unwind [[UNWIND:bb[0-9]+]]
// CHECK: [[RESUME]]:
// CHECK: end_borrow [[ADDR]]
// CHECK: dealloc_stack [[ALLOC]]
// CHECK: end_apply [[TOKEN]] as $()
// CHECK: [[UNWIND]]:
// CHECK: end_borrow [[ADDR]]
// CHECK: dealloc_stack [[ALLOC]]
// CHECK: abort_apply [[TOKEN]]
// CHECK-LABEL: } // end sil function '$s13rdar1290102657NCInt_2VAA10Summable_2A2aDP4zeroxvrZTW'