[red-knot] Change Type::member
to return a Result
and rename it to try_member
#16298
Labels
red-knot
Multi-file analysis & type inference
Milestone
Description
Similar to
Type::try_call
,try_iterate
,try_bool
, ...,member
should be renamed totry_member
and returnResult
.LookupResult
: Instead, it should be a result specific toType::member
because we may want to preserve additional error information for better diagnostics that isn't relevant when doing other symbol lookups. But I might be wrong heretry_member
should return aSymbol
because it behaves slightly different from all other type methods in that it doesn't necessarily consider a possibly unbound symbol as an error (but it probably is one for most type checking code).We could offer helper methods to easily convert a
Result<Type, MemberError>
to aResult<Type, LookupError>
orSymbol
(e.g. implementFrom
forResult<Type, LookupError>
so that thetry
operator "just works").The text was updated successfully, but these errors were encountered: