|
| 1 | +// RUN: %target-swift-frontend -typecheck %s -solver-scope-threshold=60000 |
| 2 | +// REQUIRES: tools-release,no_asan |
| 3 | + |
| 4 | +protocol ArgumentProtocol {} |
| 5 | + |
| 6 | +extension String: ArgumentProtocol {} |
| 7 | +extension Bool: ArgumentProtocol {} |
| 8 | + |
| 9 | +struct ConcreteError: Error {} |
| 10 | + |
| 11 | +struct Option<T> { |
| 12 | + init(key: String, defaultValue: T, usage: String) {} |
| 13 | +} |
| 14 | + |
| 15 | +struct Argument<T> { |
| 16 | + init(defaultValue: T? = nil, usage: String, usageParameter: String? = nil) {} |
| 17 | +} |
| 18 | + |
| 19 | +struct Switch { |
| 20 | + init(flag: Character? = nil, key: String, usage: String) {} |
| 21 | +} |
| 22 | + |
| 23 | +infix operator <*> : LogicalDisjunctionPrecedence |
| 24 | +infix operator <| : MultiplicationPrecedence |
| 25 | + |
| 26 | +func <*> <T, U>(f: (T) -> U, value: Result<T, ConcreteError>) -> Result<U, ConcreteError> { fatalError() } |
| 27 | +func <*> <T, U>(f: Result<((T) -> U), ConcreteError>, value: Result<T, ConcreteError>) -> Result<U, ConcreteError> { fatalError() } |
| 28 | + |
| 29 | +struct CommandMode { |
| 30 | + static func <| <T: ArgumentProtocol>(mode: CommandMode, option: Option<T>) -> Result<T, ConcreteError> { fatalError() } |
| 31 | + static func <| <T: ArgumentProtocol>(mode: CommandMode, option: Option<T?>) -> Result<T?, ConcreteError> { fatalError() } |
| 32 | + static func <| <T: ArgumentProtocol>(mode: CommandMode, option: Option<[T]>) -> Result<[T], ConcreteError> { fatalError() } |
| 33 | + static func <| <T: ArgumentProtocol>(mode: CommandMode, option: Option<[T]?>) -> Result<[T]?, ConcreteError> { fatalError() } |
| 34 | + static func <| (mode: CommandMode, option: Option<Bool>) -> Result<Bool, ConcreteError> { fatalError() } |
| 35 | + static func <| (mode: CommandMode, option: Switch) -> Result<Bool, ConcreteError> { fatalError() } |
| 36 | + static func <| <T: ArgumentProtocol>(mode: CommandMode, argument: Argument<T>) -> Result<T, ConcreteError> { fatalError() } |
| 37 | + static func <| <T: ArgumentProtocol>(mode: CommandMode, argument: Argument<[T]>) -> Result<[T], ConcreteError> { fatalError() } |
| 38 | +} |
| 39 | + |
| 40 | +struct FileManager { |
| 41 | + static var `default`: FileManager = FileManager() |
| 42 | + var currentDirectoryPath: String = "" |
| 43 | +} |
| 44 | + |
| 45 | +struct Options { |
| 46 | + static func create(_ project: String?) -> (String?) -> (String) -> (String) -> (String?) -> (String?) -> (String?) -> (String?) -> (Bool) -> ([String]) -> Options { fatalError() } |
| 47 | + |
| 48 | + static func evaluate(_ mode: CommandMode) -> Result<Options, ConcreteError> { |
| 49 | + let defaultBuildDirectory = "" |
| 50 | + return create |
| 51 | + <*> mode <| Option(key: "", defaultValue: nil, usage: "") |
| 52 | + <*> mode <| Option(key: "", defaultValue: nil, usage: "") |
| 53 | + <*> mode <| Option(key: "", defaultValue: FileManager.default.currentDirectoryPath, usage: "") |
| 54 | + <*> mode <| Option(key: "", defaultValue: FileManager.default.currentDirectoryPath, usage: "") |
| 55 | + <*> mode <| Option(key: "", defaultValue: nil, usage: "") |
| 56 | + <*> mode <| Option(key: "", defaultValue: nil, usage: "") |
| 57 | + <*> mode <| Option(key: "", defaultValue: nil, usage: "") |
| 58 | + <*> mode <| Option(key: "", defaultValue: nil, usage: "") |
| 59 | + <*> mode <| Switch(key: "", usage: "") |
| 60 | + <*> mode <| Argument(defaultValue: [], usage: "") |
| 61 | + } |
| 62 | +} |
0 commit comments