Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34277 from nate-chandler/concurrency/irgen/thread…
…-emission-through-emit-polymorphic [Async CC] Pull polymorphic parameters from entry point emission.
- Loading branch information
Showing
5 changed files
with
116 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
validation-test/compiler_crashers_2_fixed/rdar70144083.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// RUN: %target-swift-frontend -emit-ir %s -enable-experimental-concurrency | ||
|
||
public protocol AsyncIteratorProtocol { | ||
associatedtype Element | ||
associatedtype Failure: Error | ||
|
||
mutating func nextResult() async -> Result<Element, Failure>? | ||
mutating func cancel() | ||
} | ||
|
||
public protocol AsyncSequence { | ||
associatedtype Element | ||
associatedtype Failure: Error | ||
associatedtype AsyncIterator: AsyncIteratorProtocol where AsyncIterator.Element == Element, AsyncIterator.Failure == Failure | ||
|
||
func makeAsyncIterator() -> AsyncIterator | ||
} | ||
|
||
struct Just<Element>: AsyncSequence { | ||
typealias Failure = Never | ||
|
||
struct AsyncIterator: AsyncIteratorProtocol { | ||
var value: Element? | ||
mutating func nextResult() async -> Result<Element, Never>? { | ||
defer { value = nil } | ||
return value.map { .success($0) } | ||
} | ||
|
||
mutating func cancel() { | ||
value = nil | ||
} | ||
} | ||
var value: Element | ||
func makeAsyncIterator() -> AsyncIterator { | ||
return AsyncIterator(value: value) | ||
} | ||
} |