aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-09-17 15:59:31 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-09-17 15:59:31 +0100
commitd144eea86290e8efc700d8042e9b517158b9f916 (patch)
tree8d41b6e537fa970a7e0957831fd62aa40518f75a
parent26fe2f57bc1e3e01f29aa07c6e880f76d929463c (diff)
downloadgcc-d144eea86290e8efc700d8042e9b517158b9f916.zip
gcc-d144eea86290e8efc700d8042e9b517158b9f916.tar.gz
gcc-d144eea86290e8efc700d8042e9b517158b9f916.tar.bz2
Type coercions are recursive
Reference types are covariants like arrays or pointers and thus this needs to be recurisve to support all coercions possible. Addresses: #197
-rw-r--r--gcc/rust/typecheck/rust-tyty-coercion.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/rust/typecheck/rust-tyty-coercion.h b/gcc/rust/typecheck/rust-tyty-coercion.h
index 5ab8542..d46f1d4 100644
--- a/gcc/rust/typecheck/rust-tyty-coercion.h
+++ b/gcc/rust/typecheck/rust-tyty-coercion.h
@@ -1130,7 +1130,7 @@ public:
auto base_type = base->get_base ();
auto other_base_type = type.get_base ();
- TyTy::BaseType *base_resolved = base_type->unify (other_base_type);
+ TyTy::BaseType *base_resolved = base_type->coerce (other_base_type);
if (base_resolved == nullptr
|| base_resolved->get_kind () == TypeKind::ERROR)
{