diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-08-03 12:32:33 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-08-04 16:52:29 +0100 |
commit | da31b651da678fb8ed784191b9dc1ab3e75bd08e (patch) | |
tree | 10ed4ecedd266b951815449a337006906fa01830 /gcc | |
parent | 405d9f1d135771015199546cd1c224ba589ab48d (diff) | |
download | gcc-da31b651da678fb8ed784191b9dc1ab3e75bd08e.zip gcc-da31b651da678fb8ed784191b9dc1ab3e75bd08e.tar.gz gcc-da31b651da678fb8ed784191b9dc1ab3e75bd08e.tar.bz2 |
Update TyTy::can_eq interface for pointers and references
It is valid for pointers and references to unify against inference
variables.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-tyty-cmp.h | 106 |
1 files changed, 100 insertions, 6 deletions
diff --git a/gcc/rust/typecheck/rust-tyty-cmp.h b/gcc/rust/typecheck/rust-tyty-cmp.h index f3118ba..07d1dea 100644 --- a/gcc/rust/typecheck/rust-tyty-cmp.h +++ b/gcc/rust/typecheck/rust-tyty-cmp.h @@ -36,12 +36,7 @@ public: if (other->get_kind () == TypeKind::PARAM) { const ParamType *p = static_cast<const ParamType *> (other); - if (p->can_resolve ()) - { - const BaseType *resolved = p->resolve (); - resolved->accept_vis (*this); - return ok; - } + other = p->resolve (); } if (other->get_kind () == TypeKind::PLACEHOLDER) { @@ -861,6 +856,17 @@ public: : BaseCmp (base, emit_errors), base (base) {} + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const ClosureType *base; @@ -889,6 +895,17 @@ public: ok = true; } + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const ArrayType *base; @@ -917,6 +934,17 @@ public: ok = true; } + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const SliceType *base; @@ -1074,6 +1102,17 @@ public: ok = true; } + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const ADTType *base; @@ -1111,6 +1150,17 @@ public: ok = true; } + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const TupleType *base; @@ -1209,6 +1259,17 @@ public: ok = true; } + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const ReferenceType *base; @@ -1246,6 +1307,17 @@ public: ok = true; } + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const PointerType *base; @@ -1344,6 +1416,17 @@ public: void visit (const StrType &type) override { ok = true; } + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const StrType *base; @@ -1360,6 +1443,17 @@ public: void visit (const NeverType &type) override { ok = true; } + void visit (const InferType &type) override + { + if (type.get_infer_kind () != InferType::InferTypeKind::GENERAL) + { + BaseCmp::visit (type); + return; + } + + ok = true; + } + private: const BaseType *get_base () const override { return base; } const NeverType *base; |