diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index 50c47e796760..27f462b7d00f 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -3593,11 +3593,6 @@ def accept(self, """ if node in self.type_overrides: return self.type_overrides[node] - # Don't use an Any type context, since that will cause more - # anys than we want for things that consume the inferred - # types. - if isinstance(get_proper_type(type_context), AnyType): - type_context = None self.type_context.append(type_context) try: if allow_none_return and isinstance(node, CallExpr): diff --git a/mypy/suggestions.py b/mypy/suggestions.py index cbad728b430a..c1e5750665e3 100644 --- a/mypy/suggestions.py +++ b/mypy/suggestions.py @@ -30,9 +30,10 @@ from mypy.state import strict_optional_set from mypy.types import ( Type, AnyType, TypeOfAny, CallableType, UnionType, NoneType, Instance, TupleType, - TypeVarType, FunctionLike, TypedDictType, UninhabitedType, + TypeVarType, FunctionLike, TypeStrVisitor, TypeTranslator, is_optional, remove_optional, ProperType, get_proper_type, + TypedDictType ) from mypy.build import State, Graph from mypy.nodes import ( @@ -721,9 +722,6 @@ def visit_tuple_type(self, t: TupleType) -> str: s = self.list_str(t.items) return 'Tuple[{}]'.format(s) - def visit_uninhabited_type(self, t: UninhabitedType) -> str: - return "Any" - def visit_typeddict_type(self, t: TypedDictType) -> str: return t.fallback.accept(self) diff --git a/test-data/unit/fine-grained-suggest.test b/test-data/unit/fine-grained-suggest.test index 73d63e04b96b..701974161a89 100644 --- a/test-data/unit/fine-grained-suggest.test +++ b/test-data/unit/fine-grained-suggest.test @@ -803,23 +803,6 @@ z = foo(f(), g()) (foo.List[Any], UNKNOWN) -> Tuple[foo.List[Any], Any] == -[case testSuggestDict] -# suggest: foo.foo -# suggest: foo.bar -[file foo.py] -def foo(): - # return dict(x=5) - return {'x': 5} - -def bar(): - return {} - -[builtins fixtures/dict.pyi] -[out] -() -> typing.Dict[str, int] -() -> typing.Dict[Any, Any] -== - [case testSuggestWithErrors] # suggest: foo.foo [file foo.py] diff --git a/test-data/unit/typexport-basic.test b/test-data/unit/typexport-basic.test index 2cf07bbb7dce..cfd91c26307f 100644 --- a/test-data/unit/typexport-basic.test +++ b/test-data/unit/typexport-basic.test @@ -672,7 +672,7 @@ from typing import Any a = [] # type: Any [builtins fixtures/list.pyi] [out] -ListExpr(2) : builtins.list[] +ListExpr(2) : builtins.list[Any] [case testHigherOrderFunction] from typing import TypeVar, Callable, List