@@ -1389,15 +1389,15 @@ impl Function {
1389
1389
}
1390
1390
1391
1391
pub fn assoc_fn_params ( self , db : & dyn HirDatabase ) -> Vec < Param > {
1392
- let resolver = self . id . resolver ( db. upcast ( ) ) ;
1393
- let ctx = hir_ty:: TyLoweringContext :: new ( db, & resolver) ;
1394
1392
let environment = db. trait_environment ( self . id . into ( ) ) ;
1395
- db. function_data ( self . id )
1396
- . params
1393
+ let substs = TyBuilder :: placeholder_subst ( db, self . id ) ;
1394
+ let callable_sig = db. callable_item_signature ( self . id . into ( ) ) . substitute ( Interner , & substs) ;
1395
+ callable_sig
1396
+ . params ( )
1397
1397
. iter ( )
1398
1398
. enumerate ( )
1399
- . map ( |( idx, ( _ , type_ref ) ) | {
1400
- let ty = Type { env : environment. clone ( ) , ty : ctx . lower_ty ( type_ref ) } ;
1399
+ . map ( |( idx, ty ) | {
1400
+ let ty = Type { env : environment. clone ( ) , ty : ty . clone ( ) } ;
1401
1401
Param { func : self , ty, idx }
1402
1402
} )
1403
1403
. collect ( )
@@ -1411,17 +1411,17 @@ impl Function {
1411
1411
}
1412
1412
1413
1413
pub fn params_without_self ( self , db : & dyn HirDatabase ) -> Vec < Param > {
1414
- let resolver = self . id . resolver ( db. upcast ( ) ) ;
1415
- let ctx = hir_ty:: TyLoweringContext :: new ( db, & resolver) ;
1416
1414
let environment = db. trait_environment ( self . id . into ( ) ) ;
1415
+ let substs = TyBuilder :: placeholder_subst ( db, self . id ) ;
1416
+ let callable_sig = db. callable_item_signature ( self . id . into ( ) ) . substitute ( Interner , & substs) ;
1417
1417
let skip = if db. function_data ( self . id ) . has_self_param ( ) { 1 } else { 0 } ;
1418
- db . function_data ( self . id )
1419
- . params
1418
+ callable_sig
1419
+ . params ( )
1420
1420
. iter ( )
1421
1421
. enumerate ( )
1422
1422
. skip ( skip)
1423
- . map ( |( idx, ( _ , type_ref ) ) | {
1424
- let ty = Type { env : environment. clone ( ) , ty : ctx . lower_ty ( type_ref ) } ;
1423
+ . map ( |( idx, ty ) | {
1424
+ let ty = Type { env : environment. clone ( ) , ty : ty . clone ( ) } ;
1425
1425
Param { func : self , ty, idx }
1426
1426
} )
1427
1427
. collect ( )
@@ -1573,11 +1573,12 @@ impl SelfParam {
1573
1573
}
1574
1574
1575
1575
pub fn ty ( & self , db : & dyn HirDatabase ) -> Type {
1576
- let resolver = self . func . resolver ( db. upcast ( ) ) ;
1577
- let ctx = hir_ty:: TyLoweringContext :: new ( db, & resolver) ;
1576
+ let substs = TyBuilder :: placeholder_subst ( db, self . func ) ;
1577
+ let callable_sig =
1578
+ db. callable_item_signature ( self . func . into ( ) ) . substitute ( Interner , & substs) ;
1578
1579
let environment = db. trait_environment ( self . func . into ( ) ) ;
1579
-
1580
- Type { env : environment, ty : ctx . lower_ty ( & db . function_data ( self . func ) . params [ 0 ] . 1 ) }
1580
+ let ty = callable_sig . params ( ) [ 0 ] . clone ( ) ;
1581
+ Type { env : environment, ty }
1581
1582
}
1582
1583
}
1583
1584
@@ -2576,10 +2577,9 @@ impl Impl {
2576
2577
}
2577
2578
2578
2579
pub fn self_ty ( self , db : & dyn HirDatabase ) -> Type {
2579
- let impl_data = db. impl_data ( self . id ) ;
2580
2580
let resolver = self . id . resolver ( db. upcast ( ) ) ;
2581
- let ctx = hir_ty :: TyLoweringContext :: new ( db, & resolver ) ;
2582
- let ty = ctx . lower_ty ( & impl_data . self_ty ) ;
2581
+ let substs = TyBuilder :: placeholder_subst ( db, self . id ) ;
2582
+ let ty = db . impl_self_ty ( self . id ) . substitute ( Interner , & substs ) ;
2583
2583
Type :: new_with_resolver_inner ( db, & resolver, ty)
2584
2584
}
2585
2585
0 commit comments