File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -1968,13 +1968,18 @@ def infer_arg_types_in_empty_context(
19681968 return self ._args_cache [key ]
19691969 res : list [Type ] = []
19701970
1971- for arg in args :
1972- arg_type = self .accept (arg )
1973- if has_erased_component (arg_type ):
1974- res .append (NoneType ())
1975- else :
1976- res .append (arg_type )
1977- if can_cache :
1971+ with self .msg .filter_errors (filter_errors = True , save_filtered_errors = True ) as w :
1972+ for arg in args :
1973+ arg_type = self .accept (arg )
1974+ if has_erased_component (arg_type ):
1975+ res .append (NoneType ())
1976+ else :
1977+ res .append (arg_type )
1978+
1979+ if w .has_new_errors ():
1980+ self .msg .add_errors (w .filtered_errors ())
1981+ elif can_cache :
1982+ # Do not cache if new diagnostics were emitted: they may impact parent overload
19781983 self ._args_cache [key ] = res
19791984 return res
19801985
You can’t perform that action at this time.
0 commit comments