Skip to content
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
6 changes: 6 additions & 0 deletions lib/Sema/AssociatedTypeInference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ static void recordTypeWitness(NormalProtocolConformance *conformance,
aliasDecl->getAttrs().add(attr);
}

// Construct the availability of the type witnesses based on the
// availability of the enclosing type and the associated type.
const Decl * availabilitySources[2] = {dc->getAsDecl(), assocType };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace is a bit wonky here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Fixed up in #71512

AvailabilityInference::applyInferredAvailableAttrs(
aliasDecl, availabilitySources, ctx);

if (nominal == dc) {
nominal->addMember(aliasDecl);
} else {
Expand Down
27 changes: 27 additions & 0 deletions test/ModuleInterface/async_sequence_conformance.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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
}