Avatar
Avatar
omochimetaru
@swift-5.8.1 @swift-5.9.2 @swift-main protocol Middleware<Input, Output, NextInput, NextOutput> { associatedtype Input associatedtype Output associatedtype NextInput associatedtype NextOutput } protocol Routes<Input, Output> { associatedtype Input associatedtype Output } extension Routes { func compose<M>(_ middleware: M) -> any Routes<M.NextInput, M.NextOutput> where M: Middleware, M.Input == Input, M.Output == Output { fatalError() } func mapInput<NewInput>( _ transform: @escaping (Input) -> NewInput ) -> any Routes<NewInput, Output> { fatalError() } } struct Request {} struct Response {} struct User {} struct AuthMiddleware<Input, Output>: Middleware { typealias NextInput = (Input, login: User) typealias NextOutput = Output } func main(routes: any Routes<Request, Response>) { let routes = routes.compose(AuthMiddleware()) .mapInput { (request: $0.0, login: $0.login) } }
swiftNightly BOT 5/20/2023 4:56 AM
exit status: 134 with swift-frontend: /home/build-user/swift/lib/AST/RequirementMachine/Symbol.cpp:93: swift::rewriting::Symbol::Storage::Storage(Symbol::Kind, swift::CanType, ArrayRef<swift::rewriting::Term>): Assertion `!type->hasTypeVariable()' failed. Stack dump: 0. Program arguments: /usr/bin/swift-frontend -frontend -interpret - -disable-objc-interop -new-driver-path /usr/bin/swift-driver -empty-abi-descriptor -plugin-path /usr/lib/swift/host/plugins -plugin-path /usr/local/lib/swift/host/plugins -resource-dir /usr/lib/swift -module-name main
14.11 KB