Skip to content

Commit

Permalink
Rename has_type_attr -> is_type
Browse files Browse the repository at this point in the history
Summary: This method is not used to describe now deprecated `.type` attribute, but used to check whether a function can be bit-ored with another type to make a union type.

Reviewed By: perehonchuk

Differential Revision: D63905238

fbshipit-source-id: 9a691f3aab261d4a94b8e47f08f4b1481672ba32
  • Loading branch information
stepancheg authored and facebook-github-bot committed Oct 7, 2024
1 parent 7f4dc6c commit 53c1895
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions starlark/src/typing/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use crate::values::typing::type_compiled::alloc::TypeMatcherAlloc;
pub trait TyCustomFunctionImpl:
Debug + Eq + Ord + Hash + Allocative + Send + Sync + 'static
{
fn has_type_attr(&self) -> bool {
fn is_type(&self) -> bool {
false
}

Expand Down Expand Up @@ -104,7 +104,7 @@ impl<F: TyCustomFunctionImpl> TyCustomImpl for TyCustomFunction<F> {
) -> Result<Ty, TypingNoContextOrInternalError> {
match bin_op {
// `str | list`.
TypingBinOp::BitOr if self.0.has_type_attr() => Ok(Ty::basic(TyBasic::Type)),
TypingBinOp::BitOr if self.0.is_type() => Ok(Ty::basic(TyBasic::Type)),
_ => Err(TypingNoContextOrInternalError::Typing),
}
}
Expand Down Expand Up @@ -161,7 +161,7 @@ impl TyFunction {
}

impl TyCustomFunctionImpl for TyFunction {
fn has_type_attr(&self) -> bool {
fn is_type(&self) -> bool {
self.type_attr.is_some()
}

Expand Down
2 changes: 1 addition & 1 deletion starlark/src/values/types/list/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static LIST: Lazy<TyFunction> = Lazy::new(|| {
});

impl TyCustomFunctionImpl for ListType {
fn has_type_attr(&self) -> bool {
fn is_type(&self) -> bool {
true
}

Expand Down

0 comments on commit 53c1895

Please sign in to comment.