Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tyty cast api #2647

Merged
merged 2 commits into from
Oct 16, 2023
Merged

Tyty cast api #2647

merged 2 commits into from
Oct 16, 2023

Conversation

jdupak
Copy link
Contributor

@jdupak jdupak commented Oct 5, 2023

No description provided.

@jdupak jdupak force-pushed the tyty-cast-api branch 4 times, most recently from 612faaa to a071188 Compare October 5, 2023 12:57
jdupak added 2 commits October 6, 2023 11:33
Associate each subclass with its kind and create cast/match+cast
methods.

gcc/rust/ChangeLog:

	* typecheck/rust-tyty.cc (InferType::InferType): Use static constant for kind information.
	(ErrorType::ErrorType): Use static constant for kind information.
	(TupleType::TupleType): Use static constant for kind information.
	(BoolType::BoolType): Use static constant for kind information.
	(IntType::IntType): Use static constant for kind information.
	(UintType::UintType): Use static constant for kind information.
	(FloatType::FloatType): Use static constant for kind information.
	(USizeType::USizeType): Use static constant for kind information.
	(ISizeType::ISizeType): Use static constant for kind information.
	(CharType::CharType): Use static constant for kind information.
	(ReferenceType::ReferenceType): Use static constant for kind information.
	(PointerType::PointerType): Use static constant for kind information.
	(ParamType::ParamType): Use static constant for kind information.
	(StrType::StrType): Use static constant for kind information.
	(NeverType::NeverType): Use static constant for kind information.
	(PlaceholderType::PlaceholderType): Use static constant for kind information.
	* typecheck/rust-tyty.h: Add static kind information to all TyTy classes.
	Create safe cast and check methods.

Signed-off-by: Jakub Dupak <[email protected]>
gcc/rust/ChangeLog:

	* typecheck/rust-tyty.cc (BaseType::is_unit): Refactor.
	(BaseType::satisfies_bound): Refactor.
	(BaseType::get_root): Refactor.
	(BaseType::destructure): Refactor.
	(BaseType::monomorphized_clone): Refactor.
	(BaseType::is_concrete): Refactor.
	(InferType::InferType): Refactor.
	(InferType::clone): Refactor.
	(InferType::apply_primitive_type_hint): Refactor.
	(StructFieldType::is_equal): Refactor.
	(ADTType::is_equal): Refactor.
	(handle_substitions): Refactor.
	(ADTType::handle_substitions): Refactor.
	(TupleType::TupleType): Refactor.
	(TupleType::is_equal): Refactor.
	(TupleType::handle_substitions): Refactor.

Signed-off-by: Jakub Dupak <[email protected]>
@jdupak
Copy link
Contributor Author

jdupak commented Oct 10, 2023

@philberty

Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM this is much nicer

@philberty philberty added this to the GCC 14.1 release milestone Oct 16, 2023
@philberty philberty added this pull request to the merge queue Oct 16, 2023
Merged via the queue into Rust-GCC:master with commit 2b4eb39 Oct 16, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants