Skip to content

[ModuleInterface] Add a test for multiple 'indirect' cases on one line #26893

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
Show file tree
Hide file tree
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
28 changes: 28 additions & 0 deletions test/ParseableInterface/Inputs/enums-layout-helper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ public enum FutureproofIndirectCaseEnum {
case c
}

// CHECK-LABEL: public enum FutureproofIndirectMultiCaseEnum
public enum FutureproofIndirectMultiCaseEnum {
// CHECK-SINGLE-FRONTEND-NEXT: {{^}} case a1, a2{{$}}
// CHECK-MULTI-FILE-NEXT: {{^}} case a1{{$}}
// CHECK-MULTI-FILE-NEXT: {{^}} case a2{{$}}
case a1, a2
// CHECK-SINGLE-FRONTEND-NEXT: indirect case b1(Swift.Int), b2(Swift.Int){{$}}
// CHECK-MULTI-FILE-NEXT: indirect case b1(Swift.Int){{$}}
// CHECK-MULTI-FILE-NEXT: indirect case b2(Swift.Int){{$}}
indirect case b1(Int), b2(Int)
// CHECK-NEXT: {{^}} case c{{$}}
case c
}

// CHECK-LABEL: public enum FrozenIndirectCaseEnum
@_frozen public enum FrozenIndirectCaseEnum {
// CHECK-NEXT: {{^}} case a{{$}}
Expand All @@ -85,3 +99,17 @@ public enum FutureproofIndirectCaseEnum {
// CHECK-NEXT: {{^}} case c{{$}}
case c
}

// CHECK-LABEL: public enum FrozenIndirectMultiCaseEnum
@_frozen public enum FrozenIndirectMultiCaseEnum {
// CHECK-SINGLE-FRONTEND-NEXT: {{^}} case a1, a2{{$}}
// CHECK-MULTI-FILE-NEXT: {{^}} case a1{{$}}
// CHECK-MULTI-FILE-NEXT: {{^}} case a2{{$}}
case a1, a2
// CHECK-SINGLE-FRONTEND-NEXT: indirect case b1(Swift.Int), b2(Swift.Int){{$}}
// CHECK-MULTI-FILE-NEXT: indirect case b1(Swift.Int){{$}}
// CHECK-MULTI-FILE-NEXT: indirect case b2(Swift.Int){{$}}
indirect case b1(Int), b2(Int)
// CHECK-NEXT: {{^}} case c{{$}}
case c
}
4 changes: 2 additions & 2 deletions test/ParseableInterface/enums-layout.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift -emit-module-interface-path %t/Lib.swiftinterface -emit-module -o %t/unused.swiftmodule -enable-library-evolution -Xfrontend -enable-objc-interop -Xfrontend -disable-objc-attr-requires-foundation-module -swift-version 5 %S/Inputs/enums-layout-helper.swift -module-name Lib
// RUN: %FileCheck %S/Inputs/enums-layout-helper.swift < %t/Lib.swiftinterface
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK-MULTI-FILE %S/Inputs/enums-layout-helper.swift < %t/Lib.swiftinterface
// RUN: %target-swift-frontend -enable-objc-interop -O -emit-ir -primary-file %s -I %t -Xllvm -swiftmergefunc-threshold=0 | %FileCheck %s

// Try again using a single-frontend build.
// RUN: %empty-directory(%t)
// RUN: %target-build-swift -force-single-frontend-invocation -emit-module-interface-path %t/Lib.swiftinterface -emit-module -o %t/unused.swiftmodule -enable-library-evolution -Xfrontend -enable-objc-interop -Xfrontend -disable-objc-attr-requires-foundation-module -swift-version 5 %S/Inputs/enums-layout-helper.swift -module-name Lib
// RUN: %FileCheck %S/Inputs/enums-layout-helper.swift < %t/Lib.swiftinterface
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK-SINGLE-FRONTEND %S/Inputs/enums-layout-helper.swift < %t/Lib.swiftinterface
// RUN: %target-swift-frontend -enable-objc-interop -O -emit-ir -primary-file %s -I %t -Xllvm -swiftmergefunc-threshold=0 | %FileCheck %s


Expand Down