diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-05-12 17:24:28 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-05-12 17:24:28 +0100 |
commit | decdb126e54b0c45b31ba1fa1d1c96262cafb8e0 (patch) | |
tree | a4a766ce5a86e853f1a6648e8dd1a51d08414995 /gcc/rust | |
parent | 5134aaa9f0b37ea372cb185fe7aa6c26fe0a4c2e (diff) | |
download | gcc-decdb126e54b0c45b31ba1fa1d1c96262cafb8e0.zip gcc-decdb126e54b0c45b31ba1fa1d1c96262cafb8e0.tar.gz gcc-decdb126e54b0c45b31ba1fa1d1c96262cafb8e0.tar.bz2 |
Enhance the is_equal for TyTy::FnTypes to account for substitutions
FnTypes signiture might accidently overlap without taking into account
generic type parameters.
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index e74ab93..cb7d17a 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -682,6 +682,15 @@ FnType::is_equal (const BaseType &other) const if (!get_return_type ()->is_equal (*other2.get_return_type ())) return false; + if (has_subsititions_defined () != other2.has_subsititions_defined ()) + return false; + + if (has_subsititions_defined ()) + { + if (get_num_substitutions () != other2.get_num_substitutions ()) + return false; + } + if (num_params () != other2.num_params ()) return false; |