diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-07-19 17:12:15 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-07-19 19:36:39 +0100 |
commit | 2f7b803bcca98df8cba21c7107d777e8749a88cd (patch) | |
tree | 671bd3aff1b89c63b4266fc97970779523470f20 /gcc | |
parent | eea221e39ead0f45e9ef91aaf1b5ed855a4a5d8b (diff) | |
download | gcc-2f7b803bcca98df8cba21c7107d777e8749a88cd.zip gcc-2f7b803bcca98df8cba21c7107d777e8749a88cd.tar.gz gcc-2f7b803bcca98df8cba21c7107d777e8749a88cd.tar.bz2 |
Refs should be used in the base ctor of BaseType
Refs refers to the reference chain used in the type checking resolution of
this type. We use to eagerly replace the Inference Vars when they unify or
are coerced or default.
Fixes #352
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.h | 90 |
1 files changed, 20 insertions, 70 deletions
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 935b943..7f0ad35 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -1293,22 +1293,12 @@ class USizeType : public BaseType { public: USizeType (HirId ref, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ref, TypeKind::USIZE) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ref, TypeKind::USIZE, refs) + {} USizeType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ty_ref, TypeKind::USIZE) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ty_ref, TypeKind::USIZE, refs) + {} void accept_vis (TyVisitor &vis) override; void accept_vis (TyConstVisitor &vis) const override; @@ -1327,22 +1317,12 @@ class ISizeType : public BaseType { public: ISizeType (HirId ref, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ref, TypeKind::ISIZE) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ref, TypeKind::ISIZE, refs) + {} ISizeType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ty_ref, TypeKind::ISIZE) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ty_ref, TypeKind::ISIZE, refs) + {} void accept_vis (TyVisitor &vis) override; void accept_vis (TyConstVisitor &vis) const override; @@ -1361,22 +1341,12 @@ class CharType : public BaseType { public: CharType (HirId ref, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ref, TypeKind::CHAR) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ref, TypeKind::CHAR, refs) + {} CharType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ty_ref, TypeKind::CHAR) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ty_ref, TypeKind::CHAR, refs) + {} void accept_vis (TyVisitor &vis) override; void accept_vis (TyConstVisitor &vis) const override; @@ -1396,23 +1366,13 @@ class ReferenceType : public BaseType public: ReferenceType (HirId ref, TyVar base, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ref, TypeKind::REF), base (base) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ref, TypeKind::REF, refs), base (base) + {} ReferenceType (HirId ref, HirId ty_ref, TyVar base, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ty_ref, TypeKind::REF), base (base) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ty_ref, TypeKind::REF, refs), base (base) + {} BaseType *get_base () const; @@ -1445,22 +1405,12 @@ class StrType : public BaseType { public: StrType (HirId ref, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ref, TypeKind::STR) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ref, TypeKind::STR, refs) + {} StrType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ()) - : BaseType (ref, ty_ref, TypeKind::STR) - { - // TODO unused; should 'refs' be passed as the last argument to the - // 'BaseType' constructor call? Potential change in behavior (if 'refs' is - // provided by caller)? - (void) refs; - } + : BaseType (ref, ty_ref, TypeKind::STR, refs) + {} std::string get_name () const override final { return as_string (); } |