Skip to content

Comments

[red-knot] Rename *_ty functions#15617

Merged
sharkdp merged 1 commit intomainfrom
david/ty-renaming
Jan 22, 2025
Merged

[red-knot] Rename *_ty functions#15617
sharkdp merged 1 commit intomainfrom
david/ty-renaming

Conversation

@sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Jan 20, 2025

Summary

General rules:

  • Change the _ty suffix of all functions to _type.
  • _type_and_qualifiers suffixes seem too long, so we ignore the existence of qualifiers and still speak of "types"
  • Functions only have a _type suffix if they return either Type, Option<Type>, or TypeAndQualifiers

Free functions:

  • binding_ty => binding_type
  • declaration_ty => declaration_type
  • definition_expression_ty => definition_expression_type

Methods:

  • CallDunderResult::return_ty => return_type
  • NotCallableError::return_ty => return_type
  • NotCallableError::called_ty => called_type
  • TypeAndQualifiers::inner_ty => inner_type
  • TypeAliasType::value_ty => value_type
  • TypeInference::expression_ty => expression_type
  • TypeInference::try_expression_ty => try_expression_type
  • TypeInference::binding_ty => binding_type
  • TypeInference::declaration_ty => declaration_type
  • TypeInferenceBuilder::expression_ty => expression_type
  • TypeInferenceBuilder::file_expression_ty => file_expression_type
  • TypeInferenceBuilder::module_ty_from_name => module_type_from_name
  • ClassBase::try_from_ty => try_from_type
  • Parameter::annotated_ty => annotated_type
  • Parameter::default_ty => default_type
  • CallOutcome::return_ty => return_type
  • CallOutcome::return_ty_result => return_type_result
  • CallBinding::from_return_ty => from_return_type
  • CallBinding::set_return_ty => set_return_type
  • CallBinding::return_ty => return_type
  • CallBinding::parameter_tys => parameter_types
  • CallBinding::one_parameter_ty => one_parameter_type
  • CallBinding::two_parameter_tys => two_parameter_types
  • Unpacker::tuple_ty_elements => tuple_type_elements
  • StringPartsCollector::ty => string_type

Traits

  • HasTy => HasType
  • HasTy::ty => inferred_type

Test functions:

  • assert_public_ty => assert_public_type
  • assert_scope_ty => assert_scope_type

closes #15569

Test Plan

@sharkdp sharkdp added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Jan 20, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@sharkdp sharkdp changed the base branch from main to david/ty-renaming-2 January 20, 2025 14:00
Base automatically changed from david/ty-renaming-2 to main January 20, 2025 14:23
@sharkdp sharkdp marked this pull request as ready for review January 22, 2025 07:42
@sharkdp sharkdp requested a review from AlexWaygood as a code owner January 22, 2025 07:42
@sharkdp sharkdp merged commit 792f9e3 into main Jan 22, 2025
21 checks passed
@sharkdp sharkdp deleted the david/ty-renaming branch January 22, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[red-knot] Consistent suffixes for function names

3 participants