[red-knot] Infer lambda return type as Unknown (#16695)
## Summary Part of #15382 This PR infers the return type `lambda` expression as `Unknown`. In the future, it would be more useful to infer the expression type considering the surrounding context (#16696). ## Test Plan Update existing test cases from `@todo` to the (verified) return type.
This commit is contained in:
@@ -3840,9 +3840,12 @@ impl<'db> TypeInferenceBuilder<'db> {
|
||||
Parameters::empty()
|
||||
};
|
||||
|
||||
// TODO: Useful inference of a lambda's return type will require a different approach,
|
||||
// which does the inference of the body expression based on arguments at each call site,
|
||||
// rather than eagerly computing a return type without knowing the argument types.
|
||||
Type::Callable(CallableType::General(GeneralCallableType::new(
|
||||
self.db(),
|
||||
Signature::new(parameters, Some(todo_type!("lambda return type"))),
|
||||
Signature::new(parameters, Some(Type::unknown())),
|
||||
)))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user