Files
swift-mirror/test/Interop/SwiftToCxx/structs/swift-struct-circular-dependent-defs.swift
Alex Lorenz 2a05109c58 [interop][SwiftToCxx] Declare the generic usability type trait before the C++ class that represents the Swift type
This allows you to import a method that returns the type of the context in which the method is declared when such
type is a generic parameter in another type. This means that it's now possible to bridge the initializer for
RawRepresentable enums.
2022-09-21 07:57:32 -07:00

49 lines
1002 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %s -typecheck -module-name Structs -clang-header-expose-public-decls -emit-clang-header-path %t/structs.h
// RUN: %FileCheck %s < %t/structs.h
// RUN: %check-interop-cxx-header-in-clang(%t/structs.h)
struct Large {
let x: (Int64, Int64, Int64, Int64, Int64, Int64) = (0, 0, 0, 0, 0, 0)
}
public struct A {
public func returnsB() -> B {
return B()
}
let v: Large = Large()
}
public struct B {
public func returnsA() -> A {
return A()
}
let v: Large = Large()
}
// CHECK: class B;
// CHECK: class A;
// CHECK: namespace _impl {
// CHECK-EMPTY:
// CHECK-NEXT: class _impl_A;
// CHECK: class A final {
// CHECK: B returnsB() const;
// CHECK: namespace _impl {
// CHECK-EMPTY:
// CHECK-NEXT: class _impl_A {
// CHECK: namespace _impl {
// CHECK-EMPTY:
// CHECK-NEXT: class _impl_B;
// CHECK: class B final {
// CHECK: inline B A::returnsB() const {
// CHECK: inline A B::returnsA() const {