From 095a2f7e9a680bd4418fc08f49b7ffa3950f03fa Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Thu, 11 Jul 2024 11:26:48 -0700 Subject: [PATCH 1/5] [AST] Mark init accessors as having internal access This allows them to be used across files in the same module and requires explicit `@usableFromInline` annotation to be used inside of `@_alwaysEmitIntoClient` and `@inlinable` initializers. (cherry picked from commit dbe151bc0fcd02599f523d557ff162f1ca89762b) --- lib/AST/AccessRequests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/AST/AccessRequests.cpp b/lib/AST/AccessRequests.cpp index 78fc25d71d94d..2089a7e3c65e5 100644 --- a/lib/AST/AccessRequests.cpp +++ b/lib/AST/AccessRequests.cpp @@ -65,8 +65,8 @@ AccessLevelRequest::evaluate(Evaluator &evaluator, ValueDecl *D) const { // These are only needed to synthesize the setter. return AccessLevel::Private; case AccessorKind::Init: - // These are only called from designated initializers. - return AccessLevel::Private; + // These are only called from within the same module. + return AccessLevel::Internal; } } From 70fda4afdf5d64e221a40a5538bb3027dd8fec16 Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Thu, 11 Jul 2024 13:21:48 -0700 Subject: [PATCH 2/5] [Sema] Improve diagnostic when `@usableFromInline` is applied to a declaration without a name (i.e. accessor/init) (cherry picked from commit 6925940b37354d758ebe26a44f056559786f8f4c) --- include/swift/AST/DiagnosticsSema.def | 4 +-- lib/Sema/TypeCheckAttr.cpp | 2 +- .../attr_usableFromInline_swift4.swift | 8 +++--- .../attr_usableFromInline_swift42.swift | 8 +++--- test/attr/attr_usableFromInline.swift | 28 +++++++++++++++---- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 76627e870563c..e41b60fb44e54 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -6855,8 +6855,8 @@ ERROR(frozen_attr_on_internal_type, ERROR(usable_from_inline_attr_with_explicit_access, none, "'@usableFromInline' attribute can only be applied to internal or package " - "declarations, but %0 is %select{private|fileprivate|%error|package|public|open}1", - (DeclName, AccessLevel)) + "declarations, but %kind0 is %select{private|fileprivate|%error|package|public|open}1", + (const ValueDecl *, AccessLevel)) WARNING(inlinable_implies_usable_from_inline,none, "'@usableFromInline' attribute has no effect on '@inlinable' %kind0", diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index c0c1198042569..13d9152755062 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -3206,7 +3206,7 @@ void AttributeChecker::visitUsableFromInlineAttr(UsableFromInlineAttr *attr) { VD->getFormalAccess() != AccessLevel::Package) { diagnoseAndRemoveAttr(attr, diag::usable_from_inline_attr_with_explicit_access, - VD->getName(), VD->getFormalAccess()); + VD, VD->getFormalAccess()); return; } diff --git a/test/Compatibility/attr_usableFromInline_swift4.swift b/test/Compatibility/attr_usableFromInline_swift4.swift index b050642a8a1d3..22eb819c1e2ef 100644 --- a/test/Compatibility/attr_usableFromInline_swift4.swift +++ b/test/Compatibility/attr_usableFromInline_swift4.swift @@ -2,10 +2,10 @@ // RUN: %target-typecheck-verify-swift -enable-testing -swift-version 4 -disable-objc-attr-requires-foundation-module -enable-objc-interop @usableFromInline private func privateVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'privateVersioned()' is private}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'privateVersioned()' is private}} @usableFromInline fileprivate func fileprivateVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'fileprivateVersioned()' is fileprivate}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'fileprivateVersioned()' is fileprivate}} @usableFromInline internal func internalVersioned() {} // OK @@ -14,11 +14,11 @@ // OK @usableFromInline public func publicVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'publicVersioned()' is public}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'publicVersioned()' is public}} internal class InternalClass { @usableFromInline public func publicVersioned() {} - // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'publicVersioned()' is public}} + // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but instance method 'publicVersioned()' is public}} } fileprivate class filePrivateClass { diff --git a/test/Compatibility/attr_usableFromInline_swift42.swift b/test/Compatibility/attr_usableFromInline_swift42.swift index 2c2dad82eb1d8..567768262e3fa 100644 --- a/test/Compatibility/attr_usableFromInline_swift42.swift +++ b/test/Compatibility/attr_usableFromInline_swift42.swift @@ -2,10 +2,10 @@ // RUN: %target-typecheck-verify-swift -enable-testing -swift-version 4.2 -disable-objc-attr-requires-foundation-module -enable-objc-interop @usableFromInline private func privateVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'privateVersioned()' is private}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'privateVersioned()' is private}} @usableFromInline fileprivate func fileprivateVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'fileprivateVersioned()' is fileprivate}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'fileprivateVersioned()' is fileprivate}} @usableFromInline internal func internalVersioned() {} // OK @@ -14,12 +14,12 @@ // OK @usableFromInline public func publicVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'publicVersioned()' is public}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'publicVersioned()' is public}} internal class InternalClass { // expected-note@-1 2{{type declared here}} @usableFromInline public func publicVersioned() {} - // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'publicVersioned()' is public}} + // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but instance method 'publicVersioned()' is public}} } fileprivate class filePrivateClass { diff --git a/test/attr/attr_usableFromInline.swift b/test/attr/attr_usableFromInline.swift index fee5f53dce614..10454ef8dd980 100644 --- a/test/attr/attr_usableFromInline.swift +++ b/test/attr/attr_usableFromInline.swift @@ -2,10 +2,10 @@ // RUN: %target-typecheck-verify-swift -swift-version 5 -disable-objc-attr-requires-foundation-module -enable-objc-interop -enable-testing -package-name myPkg @usableFromInline private func privateVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'privateVersioned()' is private}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'privateVersioned()' is private}} @usableFromInline fileprivate func fileprivateVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'fileprivateVersioned()' is fileprivate}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'fileprivateVersioned()' is fileprivate}} @usableFromInline internal func internalVersioned() {} // OK @@ -17,7 +17,7 @@ // OK @usableFromInline public func publicVersioned() {} -// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'publicVersioned()' is public}} +// expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but global function 'publicVersioned()' is public}} // expected-note@+1 3{{global function 'internalFunc()' is not '@usableFromInline' or public}} internal func internalFunc() {} @@ -55,13 +55,13 @@ package func packageInlinableFunc() { package class PackageClass { // expected-note@-1 *{{type declared here}} @usableFromInline public func publicVersioned() {} - // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'publicVersioned()' is public}} + // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but instance method 'publicVersioned()' is public}} } internal class InternalClass { // expected-note@-1 2{{type declared here}} @usableFromInline public func publicVersioned() {} - // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but 'publicVersioned()' is public}} + // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but instance method 'publicVersioned()' is public}} } fileprivate class filePrivateClass { @@ -334,3 +334,21 @@ public struct TestGenericSubscripts { @usableFromInline package func pkgNonGenericWhereClause() where T : PackageProtocol {} // expected-error@-1 {{type referenced from a generic requirement of a '@usableFromInline' instance method must be '@usableFromInline' or public}} } + +public struct IncorrectInitUse { + public var x: Int { + @usableFromInline + // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but getter for property 'x' is public}} + get { 0 } + + @usableFromInline + // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but setter for property 'x' is public}} + set { } + } + + @usableFromInline + // expected-error@-1 {{'@usableFromInline' attribute can only be applied to internal or package declarations, but initializer 'init(x:)' is public}} + public init(x: Int) { + self.x = x + } +} From c09fd60bfbe00a1792346bee374d7fa0635ed23d Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Thu, 11 Jul 2024 16:15:40 -0700 Subject: [PATCH 3/5] [Sema] Resilience: Diagnose uses of init accessors in inlinable contexts if they are not marked as `@usableFromInline` (cherry picked from commit 123068c64e49977e9642a3891297a0011c5d5899) --- lib/Sema/ResilienceDiagnostics.cpp | 13 +++++++++- test/attr/attr_alwaysEmitIntoClient.swift | 29 ++++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/Sema/ResilienceDiagnostics.cpp b/lib/Sema/ResilienceDiagnostics.cpp index 0f855431a0e78..5ab07e7919afe 100644 --- a/lib/Sema/ResilienceDiagnostics.cpp +++ b/lib/Sema/ResilienceDiagnostics.cpp @@ -63,6 +63,17 @@ bool TypeChecker::diagnoseInlinableDeclRefAccess(SourceLoc loc, auto *DC = where.getDeclContext(); auto &Context = DC->getASTContext(); + if (auto *init = dyn_cast(DC)) { + if (init->isDesignatedInit()) { + auto *storage = dyn_cast(D); + if (storage && storage->hasInitAccessor()) { + if (diagnoseInlinableDeclRefAccess( + loc, storage->getAccessor(AccessorKind::Init), where)) + return true; + } + } + } + ImportAccessLevel problematicImport = D->getImportAccessFrom(DC); if (problematicImport.has_value()) { auto SF = DC->getParentSourceFile(); @@ -111,7 +122,7 @@ bool TypeChecker::diagnoseInlinableDeclRefAccess(SourceLoc loc, // Swift 4.2 did not check accessor accessibility. if (auto accessor = dyn_cast(D)) { - if (!Context.isSwiftVersionAtLeast(5)) + if (!accessor->isInitAccessor() && !Context.isSwiftVersionAtLeast(5)) downgradeToWarning = DowngradeToWarning::Yes; } diff --git a/test/attr/attr_alwaysEmitIntoClient.swift b/test/attr/attr_alwaysEmitIntoClient.swift index ef1933fe6c68b..09d077b0d8fa6 100644 --- a/test/attr/attr_alwaysEmitIntoClient.swift +++ b/test/attr/attr_alwaysEmitIntoClient.swift @@ -15,4 +15,31 @@ public func publicFunction() {} internalFunction() // expected-error {{global function 'internalFunction()' is internal and cannot be referenced from an '@_alwaysEmitIntoClient' function}} versionedFunction() publicFunction() -} \ No newline at end of file +} + +public struct TestInitAccessors { + var _x: Int + + public var x: Int { + @storageRestrictions(initializes: _x) + init { // expected-note 2 {{init acecssor for property 'x' is not '@usableFromInline' or public}} + self._x = newValue + } + + get { + self._x + } + + set {} + } + + @_alwaysEmitIntoClient + public init(x: Int) { + self.x = 0 // expected-error {{init acecssor for property 'x' is internal and cannot be referenced from an '@_alwaysEmitIntoClient' function}} + } + + @inlinable + public init() { + self.x = 0 // expected-error {{init acecssor for property 'x' is internal and cannot be referenced from an '@inlinable' function}} + } +} From eed46aca109728639a2a2c32f733876db965eae8 Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Thu, 11 Jul 2024 16:52:58 -0700 Subject: [PATCH 4/5] [AST] Print init accessors when they are ABI-public Using init accessors from inlinable code requires `@usableFromInline` annotation, which means that we need to print them in swift interfaces and serialize them. (cherry picked from commit be3396821e6fdabac07b6d094b555448979a2ba0) --- lib/AST/ASTPrinter.cpp | 5 - .../inlinable_init_accessors.swift | 79 +++++++++++ test/ModuleInterface/init_accessors.swift | 123 ++++++++++++++++++ 3 files changed, 202 insertions(+), 5 deletions(-) create mode 100644 test/Interpreter/inlinable_init_accessors.swift create mode 100644 test/ModuleInterface/init_accessors.swift diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index 20c5aa76c00c9..5dffbc13a1963 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -352,11 +352,6 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint, } } - if (auto *accessor = dyn_cast(D)) { - if (accessor->isInitAccessor() && !options.PrintForSIL) - return false; - } - return ShouldPrintChecker::shouldPrint(D, options); } }; diff --git a/test/Interpreter/inlinable_init_accessors.swift b/test/Interpreter/inlinable_init_accessors.swift new file mode 100644 index 0000000000000..2c25d9b142d98 --- /dev/null +++ b/test/Interpreter/inlinable_init_accessors.swift @@ -0,0 +1,79 @@ +// RUN: %empty-directory(%t/src) +// RUN: split-file %s %t/src + +// RUN: %target-build-swift %t/src/Library.swift -swift-version 5 -emit-module -emit-library \ +// RUN: -enable-library-evolution \ +// RUN: -module-name Library \ +// RUN: -o %t/%target-library-name(Library) \ +// RUN: -emit-module-interface-path %t/Library.swiftinterface + +// RUN: %target-codesign %t/%target-library-name(Library) + +// RUN: %target-build-swift -I %t -L %t -l Library %t/src/main.swift %target-rpath(%t) -o %t/main.out +// RUN: %target-codesign %t/main.out +// RUN: %target-run %t/main.out %t/%target-library-name(Library) 2>&1 | %FileCheck %t/src/main.swift + +// RUN: rm %t/Library.swiftmodule + +// RUN: %target-build-swift -I %t -L %t -l Library %t/src/main.swift %target-rpath(%t) -o %t/main.out +// RUN: %target-codesign %t/main.out +// RUN: %target-run %t/main.out %t/%target-library-name(Library) 2>&1 | %FileCheck %t/src/main.swift + +// REQUIRES: executable_test + +//--- Library.swift +@frozen +public struct Inlinable { + var _x: Int + + public var x: Int { + @usableFromInline + @storageRestrictions(initializes: _x) + init { + self._x = newValue + } + + get { + _x + } + } + + @inlinable + public init(x: Int) { + self.x = x + } +} + +@frozen +public struct Transparent { + @usableFromInline + var _x: Int + + public var x: Int { + @_alwaysEmitIntoClient + @storageRestrictions(initializes: _x) + init { + self._x = newValue + } + + get { + _x + } + } + + @_alwaysEmitIntoClient + public init(x: Int) { + self.x = x + } +} + +//--- main.swift +import Library + +let inlinable = Inlinable(x: 42) +print("Inlinable.x = \(inlinable.x)") +// CHECK: Inlinable.x = 42 + +let transparent = Transparent(x: -1) +print("Transparent.x = \(transparent.x)") +// CHECK: Transparent.x = -1 diff --git a/test/ModuleInterface/init_accessors.swift b/test/ModuleInterface/init_accessors.swift new file mode 100644 index 0000000000000..692c0b4a91870 --- /dev/null +++ b/test/ModuleInterface/init_accessors.swift @@ -0,0 +1,123 @@ +// RUN: %empty-directory(%t/src) +// RUN: split-file %s %t/src + +/// Build the library A +// RUN: %target-swift-frontend -emit-module %t/src/A.swift \ +// RUN: -module-name A -swift-version 5 -enable-library-evolution \ +// RUN: -emit-module-path %t/A.swiftmodule \ +// RUN: -emit-module-interface-path %t/A.swiftinterface + +// RUN: %FileCheck %t/src/A.swift < %t/A.swiftinterface + +// Build the client using module +// RUN: %target-swift-emit-sil -verify -module-name Client -I %t %t/src/Client.swift | %FileCheck %t/src/Client.swift + +// RUN: rm %t/A.swiftmodule + +// Re-build the client using interface +// RUN: %target-swift-emit-sil -verify -module-name Client -I %t %t/src/Client.swift | %FileCheck %t/src/Client.swift + +// REQUIRES: asserts + +//--- A.swift +@frozen +public struct Inlinable { + var _x: Int + +// CHECK: public var x: Swift.Int { +// CHECK-NEXT: @usableFromInline +// CHECK-NEXT: @storageRestrictions(initializes: _x) init +// CHECK-NEXT: get +// CHECK-NEXT } + + public var x: Int { + @usableFromInline + @storageRestrictions(initializes: _x) + init { + self._x = newValue + } + + get { + _x + } + } + + @inlinable + public init(x: Int) { + self.x = x + } +} + +public struct Internal { +// CHECK: public var y: Swift.Int { +// CHECK-NEXT: get +// CHECK-NEXT: } + + public var y: Int { + init { + } + + get { 0 } + } + + init(y: Int) { + self.y = y + } +} + +@frozen +public struct Transparent { + @usableFromInline + var _x: Int + +// CHECK: public var x: Swift.Int { +// CHECK-NEXT: @_alwaysEmitIntoClient @storageRestrictions(initializes: _x) init { +// CHECK-NEXT: self._x = newValue +// CHECK-NEXT: } +// CHECK-NEXT: get +// CHECK-NEXT } + + public var x: Int { + @_alwaysEmitIntoClient + @storageRestrictions(initializes: _x) + init { + self._x = newValue + } + + get { + _x + } + } + + @_alwaysEmitIntoClient + public init(x: Int) { + self.x = x + } +} + +//--- Client.swift +import A + +// CHECK-LABEL: sil hidden @$s6Client15testTransparentyyF : $@convention(thin) () -> () +// CHECK: [[X:%.*]] = struct $Int (%1 : $Builtin.Int64) +// CHECK-NEXT: // function_ref Transparent.init(x:) +// CHECK-NEXT: [[TRANSPARENT_REF:%.*]] = function_ref @$s1A11TransparentV1xACSi_tcfC : $@convention(method) (Int, @thin Transparent.Type) -> Transparent +// CHECK-NEXT: apply [[TRANSPARENT_REF]]([[X]], %0) : $@convention(method) (Int, @thin Transparent.Type) -> Transparent +func testTransparent() { + _ = Transparent(x: 42) +} + +// CHECK-LABEL: sil shared @$s1A11TransparentV1xACSi_tcfC : $@convention(method) (Int, @thin Transparent.Type) -> Transparent + +// CHECK-LABEL: sil hidden @$s6Client13testInlinableyyF : $@convention(thin) () -> () +// CHECK: [[X:%.*]] = struct $Int (%1 : $Builtin.Int64) +// CHECK-NEXT: // function_ref Inlinable.init(x:) +// CHECK-NEXT: [[INLINABLE_REF:%.*]] = function_ref @$s1A9InlinableV1xACSi_tcfC : $@convention(method) (Int, @thin Inlinable.Type) -> Inlinable +// CHECK-NEXT: apply [[INLINABLE_REF]]([[X]], %0) : $@convention(method) (Int, @thin Inlinable.Type) -> Inlinable +func testInlinable() { + _ = Inlinable(x: 42) +} + +// CHECK-LABEL: sil @$s1A9InlinableV1xACSi_tcfC : $@convention(method) (Int, @thin Inlinable.Type) -> Inlinable + +// CHECK-LABEL: sil shared @$s1A11TransparentV1xSivi : $@convention(thin) (Int, @thin Transparent.Type) -> @out Int From 5e2f46da7ac2609cba9adf6cea00abe6988c7d40 Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Tue, 18 Jun 2024 13:28:07 -0700 Subject: [PATCH 5/5] [Tests/SILOptimizer] NFC: Adjust init accessor visibility in test-cases (cherry picked from commit 115d26a875683989664012dedf3c51355c0538f4) --- test/SILOptimizer/init_accessors.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/SILOptimizer/init_accessors.swift b/test/SILOptimizer/init_accessors.swift index 76b14e7b6db44..43ddbff761410 100644 --- a/test/SILOptimizer/init_accessors.swift +++ b/test/SILOptimizer/init_accessors.swift @@ -10,7 +10,7 @@ struct TestInit { var full: (Int, Int) var point: (Int, Int) { - // CHECK-LABEL: sil private [ossa] @$s14init_accessors8TestInitV5pointSi_Sitvi : $@convention(thin) (Int, Int, @inout Int, @thin TestInit.Type) -> (@out Int, @out (Int, Int)) + // CHECK-LABEL: sil hidden [ossa] @$s14init_accessors8TestInitV5pointSi_Sitvi : $@convention(thin) (Int, Int, @inout Int, @thin TestInit.Type) -> (@out Int, @out (Int, Int)) // CHECK: bb0([[Y_REF:%.*]] : $*Int, [[FULL_REF:%.*]] : $*(Int, Int), [[X_VAL:%.*]] : $Int, [[Y_VAL:%.*]] : $Int, [[X_REF:%.*]] : $*Int, [[METATYPE:%.*]] : $@thin TestInit.Type): // // CHECK: [[INITIAL_VALUE:%.*]] = tuple ([[X_VAL]] : $Int, [[Y_VAL]] : $Int) @@ -230,7 +230,7 @@ class TestClass { var y: (Int, [String]) var data: (Int, (Int, [String])) { - // CHECK-LABEL: sil private [ossa] @$s14init_accessors9TestClassC4dataSi_Si_SaySSGttvi : $@convention(thin) (Int, Int, @owned Array, @thick TestClass.Type) -> (@out Int, @out (Int, Array)) + // CHECK-LABEL: sil hidden [ossa] @$s14init_accessors9TestClassC4dataSi_Si_SaySSGttvi : $@convention(thin) (Int, Int, @owned Array, @thick TestClass.Type) -> (@out Int, @out (Int, Array)) // CHECK: bb0([[X_REF:%.*]] : $*Int, [[Y_REF:%.*]] : $*(Int, Array), [[X_VAL:%.*]] : $Int, [[Y_VAL_0:%.*]] : $Int, [[Y_VAL_1:%.*]] : @owned $Array, [[METATYPE:%.*]] : $@thick TestClass.Type): // // CHECK: ([[X_VAL:%.*]], [[Y_VAL:%.*]]) = destructure_tuple {{.*}} : $(Int, (Int, Array)) @@ -277,7 +277,7 @@ struct TestGeneric { var b: T var c: U - // CHECK-LABEL: sil private [ossa] @$s14init_accessors11TestGenericV4datax_xtvi : $@convention(thin) (@in T, @in T, @inout U, @thin TestGeneric.Type) -> (@out T, @out T) + // CHECK-LABEL: sil hidden [ossa] @$s14init_accessors11TestGenericV4datax_xtvi : $@convention(thin) (@in T, @in T, @inout U, @thin TestGeneric.Type) -> (@out T, @out T) // // CHECK: bb0([[A_REF:%.*]] : $*T, [[B_REF:%.*]] : $*T, [[A_VALUE:%.*]] : $*T, [[B_VALUE:%.*]] : $*T, [[C_REF:%.*]] : $*U, [[METATYPE:%.*]] : $@thin TestGeneric.Type): // @@ -326,7 +326,7 @@ struct TestGenericTuple { var a: T var b: (T, U) - // CHECK-LABEL: sil private [ossa] @$s14init_accessors16TestGenericTupleV4datax_x_q_ttvi : $@convention(thin) (@in T, @in T, @in U, @thin TestGenericTuple.Type) -> (@out T, @out (T, U)) { + // CHECK-LABEL: sil hidden [ossa] @$s14init_accessors16TestGenericTupleV4datax_x_q_ttvi : $@convention(thin) (@in T, @in T, @in U, @thin TestGenericTuple.Type) -> (@out T, @out (T, U)) { // // CHECK: bb0([[A_REF:%.*]] : $*T, [[B_REF:%.*]] : $*(T, U), [[A_VALUE:%.*]] : $*T, [[B_VALUE:%.*]] : $*T, [[C_VALUE:%.*]] : $*U, [[METATYPE:%.*]] : $@thin TestGenericTuple.Type): //