@@ -715,9 +715,7 @@ UnifyRules::expect_reference (TyTy::ReferenceType *ltype, TyTy::BaseType *rtype)
715
715
return unify_error_type_node ();
716
716
}
717
717
718
- return new TyTy::ReferenceType (ltype->get_ref (), ltype->get_ty_ref (),
719
- TyTy::TyVar (base_resolved->get_ref ()),
720
- ltype->mutability ());
718
+ return ltype;
721
719
}
722
720
break ;
723
721
@@ -787,9 +785,7 @@ UnifyRules::expect_pointer (TyTy::PointerType *ltype, TyTy::BaseType *rtype)
787
785
return unify_error_type_node ();
788
786
}
789
787
790
- return new TyTy::PointerType (ltype->get_ref (), ltype->get_ty_ref (),
791
- TyTy::TyVar (base_resolved->get_ref ()),
792
- ltype->mutability ());
788
+ return ltype;
793
789
}
794
790
break ;
795
791
@@ -983,12 +979,7 @@ UnifyRules::expect_slice (TyTy::SliceType *ltype, TyTy::BaseType *rtype)
983
979
TyTy::TyWithLocation (type.get_element_type ()));
984
980
985
981
if (element_unify->get_kind () != TyTy::TypeKind::ERROR)
986
- {
987
- return new TyTy::SliceType (type.get_ref (), type.get_ty_ref (),
988
- type.get_ident ().locus ,
989
- TyTy::TyVar (
990
- element_unify->get_ref ()));
991
- }
982
+ return ltype;
992
983
}
993
984
break ;
994
985
@@ -1298,8 +1289,7 @@ UnifyRules::expect_tuple (TyTy::TupleType *ltype, TyTy::BaseType *rtype)
1298
1289
fields.emplace_back (unified_ty->get_ref ());
1299
1290
}
1300
1291
1301
- return new TyTy::TupleType (type.get_ref (), type.get_ty_ref (),
1302
- type.get_ident ().locus , fields);
1292
+ return ltype;
1303
1293
}
1304
1294
break ;
1305
1295
@@ -1459,8 +1449,7 @@ UnifyRules::expect_int (TyTy::IntType *ltype, TyTy::BaseType *rtype)
1459
1449
TyTy::IntType &type = *static_cast <TyTy::IntType *> (rtype);
1460
1450
bool is_valid = ltype->get_int_kind () == type.get_int_kind ();
1461
1451
if (is_valid)
1462
- return new TyTy::IntType (type.get_ref (), type.get_ty_ref (),
1463
- type.get_int_kind ());
1452
+ return ltype;
1464
1453
}
1465
1454
break ;
1466
1455
@@ -1518,8 +1507,7 @@ UnifyRules::expect_uint (TyTy::UintType *ltype, TyTy::BaseType *rtype)
1518
1507
TyTy::UintType &type = *static_cast <TyTy::UintType *> (rtype);
1519
1508
bool is_valid = ltype->get_uint_kind () == type.get_uint_kind ();
1520
1509
if (is_valid)
1521
- return new TyTy::UintType (type.get_ref (), type.get_ty_ref (),
1522
- type.get_uint_kind ());
1510
+ return ltype;
1523
1511
}
1524
1512
break ;
1525
1513
@@ -1577,8 +1565,7 @@ UnifyRules::expect_float (TyTy::FloatType *ltype, TyTy::BaseType *rtype)
1577
1565
TyTy::FloatType &type = *static_cast <TyTy::FloatType *> (rtype);
1578
1566
bool is_valid = ltype->get_float_kind () == type.get_float_kind ();
1579
1567
if (is_valid)
1580
- return new TyTy::FloatType (type.get_ref (), type.get_ty_ref (),
1581
- type.get_float_kind ());
1568
+ return ltype;
1582
1569
}
1583
1570
break ;
1584
1571
0 commit comments