@@ -1391,8 +1391,13 @@ impl Const {
1391
1391
db. const_data ( self . id ) . name . clone ( )
1392
1392
}
1393
1393
1394
- pub fn type_ref ( self , db : & dyn HirDatabase ) -> TypeRef {
1395
- db. const_data ( self . id ) . type_ref . as_ref ( ) . clone ( )
1394
+ pub fn ty ( self , db : & dyn HirDatabase ) -> Type {
1395
+ let data = db. const_data ( self . id ) ;
1396
+ let resolver = self . id . resolver ( db. upcast ( ) ) ;
1397
+ let krate = self . id . lookup ( db. upcast ( ) ) . container . krate ( db) ;
1398
+ let ctx = hir_ty:: TyLoweringContext :: new ( db, & resolver) ;
1399
+ let ty = ctx. lower_ty ( & data. type_ref ) ;
1400
+ Type :: new_with_resolver_inner ( db, krate. id , & resolver, ty)
1396
1401
}
1397
1402
}
1398
1403
@@ -1421,6 +1426,15 @@ impl Static {
1421
1426
pub fn is_mut ( self , db : & dyn HirDatabase ) -> bool {
1422
1427
db. static_data ( self . id ) . mutable
1423
1428
}
1429
+
1430
+ pub fn ty ( self , db : & dyn HirDatabase ) -> Type {
1431
+ let data = db. static_data ( self . id ) ;
1432
+ let resolver = self . id . resolver ( db. upcast ( ) ) ;
1433
+ let krate = self . id . lookup ( db. upcast ( ) ) . container . krate ( ) ;
1434
+ let ctx = hir_ty:: TyLoweringContext :: new ( db, & resolver) ;
1435
+ let ty = ctx. lower_ty ( & data. type_ref ) ;
1436
+ Type :: new_with_resolver_inner ( db, krate, & resolver, ty)
1437
+ }
1424
1438
}
1425
1439
1426
1440
impl HasVisibility for Static {
0 commit comments