diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-04-30 10:08:15 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-04-30 10:08:15 +0100 |
commit | ffa45bed5e9211c7d2ee242f63fd6c3118248177 (patch) | |
tree | 1bb611fac5beb16efedec02339b18402b8c4a93a /gcc/rust | |
parent | 682cae549a4eb29857f49fe72cf130e2ee577d8c (diff) | |
download | gcc-ffa45bed5e9211c7d2ee242f63fd6c3118248177.zip gcc-ffa45bed5e9211c7d2ee242f63fd6c3118248177.tar.gz gcc-ffa45bed5e9211c7d2ee242f63fd6c3118248177.tar.bz2 |
Typecheck the default type on TypeParam
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-item.h | 6 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-type.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index ae22008..dbbc743 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -111,6 +111,12 @@ public: Identifier get_type_representation () const { return type_representation; } + std::unique_ptr<Type> &get_type () + { + rust_assert (type != nullptr); + return type; + } + protected: // Clone function implementation as (not pure) virtual method TypeParam *clone_generic_param_impl () const override diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.h b/gcc/rust/typecheck/rust-hir-type-check-type.h index d8a3f29..70b9cfa 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-type.h +++ b/gcc/rust/typecheck/rust-hir-type-check-type.h @@ -253,6 +253,11 @@ public: void visit (HIR::TypeParam ¶m) override { + TyTy::BaseType *default_ty_param = nullptr; + if (param.has_type ()) + { + default_ty_param = TypeCheckType::Resolve (param.get_type ().get ()); + } resolved = new TyTy::ParamType (param.get_type_representation (), param.get_mappings ().get_hirid (), param); } |