Files
swift-mirror/test/ModuleInterface/async_sequence_conformance.swift
Doug Gregor 6a43a680d1 Infer availability for typealiases for inferred type witness
Now that associated types can have availability, make sure that we
infer availability attributes for any inferred type witnesses of said
associated types based on both the enclosing context and the associated
type itself. This eliminates failures in the emitted Swift interfaces.

Fixes rdar://122596219.
2024-02-08 19:14:57 -08:00

28 lines
1.0 KiB
Swift

// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name conformances
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name conformances
// RUN: %FileCheck %s < %t.swiftinterface
// REQUIRES: concurrency, OS=macosx
// CHECK: @available(
// CHECK-NEXT: public struct SequenceAdapte
@available(SwiftStdlib 5.1, *)
public struct SequenceAdapter<Base: AsyncSequence>: AsyncSequence {
// CHECK-LABEL: public struct AsyncIterator
// CHECK: @available{{.*}}macOS 10.15
// CHECK-NEXT: public typealias Element = Base.Element
// CHECK: @available(
// CHECK-NEXT: public typealias Failure = Base.Failure
public typealias Element = Base.Element
public struct AsyncIterator: AsyncIteratorProtocol {
public mutating func next() async rethrows -> Base.Element? { nil }
}
// CHECK-LABEL: public func makeAsyncIterator
public func makeAsyncIterator() -> AsyncIterator { AsyncIterator() }
// CHECK: @available(
// CHECK-NEXT: public typealias Failure = Base.Failure
}