AST: Adjust declaration printing when NoncopyableGenerics2 is suppressed.

When printing declarations with `NoncopyableGenerics2` suppressed we must avoid
printing the `@_preInverseGenerics` attribute and any `borrowing` or
`consuming` parameter ownership modifiers.
This commit is contained in:
Allan Shortlidge
2024-03-26 18:34:32 -07:00
parent 2813fbe309
commit ee73ff7737
5 changed files with 38 additions and 3 deletions

View File

@@ -144,8 +144,18 @@ import NoncopyableGenerics_Misc
// CHECK-MISC: #if compiler(>=5.3) && $NoncopyableGenerics
// CHECK-MISC-NEXT: @_preInverseGenerics public func old_swap<T>(_ a: inout T, _ b: inout T) where T : ~Copyable
// CHECK-MISC-NEXT: #else
// CHECK-MISC-NOT: @_preInverseGenerics
// CHECK-MISC-NEXT: public func old_swap<T>(_ a: inout T, _ b: inout T)
// CHECK-MISC: #endif
// CHECK-MISC: #if compiler(>=5.3) && $NoncopyableGenerics
// CHECK-MISC-NEXT: @_preInverseGenerics public func borrowsNoncopyable<T>(_ t: borrowing T) where T : ~Copyable
// CHECK-MISC-NEXT: #else
// CHECK-MISC-NOT: @_preInverseGenerics
// CHECK-MISC-NEXT: public func borrowsNoncopyable<T>(_ t: T)
// CHECK-MISC-NEXT: #endif
import Swiftskell
// CHECK: #if compiler(>=5.3) && $NoncopyableGenerics