@@ -552,7 +552,7 @@ impl Context {
552
552
) -> Triple < VarInfo , TyCheckError > {
553
553
// get_attr_info(?T, aaa) == None
554
554
// => ?T(<: Structural({ .aaa = ?U }))
555
- if self . in_subr ( ) && PYTHON_MODE {
555
+ if PYTHON_MODE && obj . var_info ( ) . is_some_and ( |vi| vi . kind . is_parameter ( ) ) {
556
556
let t = free_var ( self . level , Constraint :: new_type_of ( Type ) ) ;
557
557
if let Some ( fv) = obj. ref_t ( ) . as_free ( ) {
558
558
if fv. get_sub ( ) . is_some ( ) {
@@ -894,7 +894,7 @@ impl Context {
894
894
) -> SingleTyCheckResult < VarInfo > {
895
895
// search_method_info(?T, aaa, pos_args: [1, 2]) == None
896
896
// => ?T(<: Structural({ .aaa = (self: ?T, ?U, ?V) -> ?W }))
897
- if PYTHON_MODE && self . in_subr ( ) {
897
+ if PYTHON_MODE && obj . var_info ( ) . is_some_and ( |vi| vi . kind . is_parameter ( ) ) {
898
898
let nd_params = pos_args
899
899
. iter ( )
900
900
. map ( |_| ParamTy :: Pos ( free_var ( self . level , Constraint :: new_type_of ( Type ) ) ) )
@@ -2559,10 +2559,6 @@ impl Context {
2559
2559
}
2560
2560
}
2561
2561
2562
- pub ( crate ) fn in_subr ( & self ) -> bool {
2563
- self . kind . is_subr ( ) || self . get_outer ( ) . map_or ( false , |ctx| ctx. in_subr ( ) )
2564
- }
2565
-
2566
2562
pub ( crate ) fn gen_type ( & self , ident : & ast:: Identifier ) -> Type {
2567
2563
let vis = ident. vis . display_as_accessor ( ) ;
2568
2564
mono ( format ! ( "{}{vis}{}" , self . name, ident. inspect( ) ) )
0 commit comments