Files
swift-mirror/test/ModuleInterface/layout_pre_specialization.swift
Dario Rexin 45b8cfd511 [ModuleInterface] Guard layout based prespecializations in swiftinter… (#64695)
* [ModuleInterface] Guard layout based prespecializations in swiftinterface files

rdar://107269447

To allow compilers that don't have this feature enabled to parse interface files that contain declarations that use layout based prespecializations, it has to be guarded.

* Incorporate feedback
2023-03-28 22:43:45 -07:00

16 lines
942 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-emit-module-interface(%t/LayoutPrespec.swiftinterface) %s -enable-experimental-feature LayoutPrespecialization -module-name LayoutPrespec -disable-availability-checking
// RUN: %target-swift-typecheck-module-from-interface(%t/LayoutPrespec.swiftinterface) -module-name LayoutPrespec -disable-availability-checking
// RUN: %target-swift-typecheck-module-from-interface(%t/LayoutPrespec.swiftinterface) -module-name LayoutPrespec -enable-experimental-feature LayoutPrespecialization -disable-availability-checking
// RUN: %FileCheck %s < %t/LayoutPrespec.swiftinterface
// CHECK: #if compiler(>=5.3) && $LayoutPrespecialization
// CHECK-NEXT: @_specialize(exported: true, kind: full, where @_noMetadata A : _Class)
// CHECK-NEXT: public func test<A>(a: A) -> A
// CHECK-NEXT: #endif
@_specialize(exported: true, where @_noMetadata A : _Class)
public func test<A>(a: A) -> A {
return a
}