@@ -552,7 +552,7 @@ impl Context {
552552 ) -> Triple < VarInfo , TyCheckError > {
553553 // get_attr_info(?T, aaa) == None
554554 // => ?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 ( ) ) {
556556 let t = free_var ( self . level , Constraint :: new_type_of ( Type ) ) ;
557557 if let Some ( fv) = obj. ref_t ( ) . as_free ( ) {
558558 if fv. get_sub ( ) . is_some ( ) {
@@ -894,7 +894,7 @@ impl Context {
894894 ) -> SingleTyCheckResult < VarInfo > {
895895 // search_method_info(?T, aaa, pos_args: [1, 2]) == None
896896 // => ?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 ( ) ) {
898898 let nd_params = pos_args
899899 . iter ( )
900900 . map ( |_| ParamTy :: Pos ( free_var ( self . level , Constraint :: new_type_of ( Type ) ) ) )
@@ -2559,10 +2559,6 @@ impl Context {
25592559 }
25602560 }
25612561
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-
25662562 pub ( crate ) fn gen_type ( & self , ident : & ast:: Identifier ) -> Type {
25672563 let vis = ident. vis . display_as_accessor ( ) ;
25682564 mono ( format ! ( "{}{vis}{}" , self . name, ident. inspect( ) ) )
0 commit comments