This may not be an issue specific to this project, but I am seeing some odd behavior. I was just playing around with the square number example and I have this code that does not compile
Lambda.run { (context: Lambda.Context, input: Input, callback) in
context.logger.info("input is \(input.number)")
callback(.success(Output(result: input.number * input.number)))
}
with an error on the callback line of
Cannot convert value of type 'Output' to expected argument type 'Void'
however if I add a type hint, it works just fine
Lambda.run { (context: Lambda.Context, input: Input, callback: (Result<Output, Error>) -> Void) in
context.logger.info("input is \(input.number)")
callback(.success(Output(result: input.number * input.number)))
}
Is this just bad type inference on the swift compiler, or is there an issue with the library? I dug into the code and it seems like it's just swift choosing the Void
callback vs the Out
callback, but I can't see why it would make that choice. Also of note, the non type-hinted version works just fine without the logging line. (as below with the line commented out)
Lambda.run { (context: Lambda.Context, input: Input, callback) in
//context.logger.info("input is \(input.number)")
callback(.success(Output(result: input.number * input.number)))
}