-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Remove builtin_type #11214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove builtin_type #11214
Conversation
@@ -4437,7 +4411,7 @@ def named_type_or_none(self, qualified_name: str, | |||
if args is not None: | |||
# TODO: assert len(args) == len(node.defn.type_vars) | |||
return Instance(node, args) | |||
return Instance(node, [AnyType(TypeOfAny.unannotated)] * len(node.defn.type_vars)) | |||
return Instance(node, [AnyType(TypeOfAny.special_form)] * len(node.defn.type_vars)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's quite confusing that builtin_type
and named_type
use TypeOfAny.special_form
while named_type_or_none
uses TypeOfAny.unannotated
. Is it correct that changing it to special_form
Diff from mypy_primer, showing the effect of this PR on open source code: edgedb (https://github.com/edgedb/edgedb.git)
- Warning: unused section(s) in pyproject.toml: module = ['edb.repl.*']
+ edb/schema/objects.py:928: error: INTERNAL ERROR -- Please try using mypy master on Github:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 0.920+dev.ea3abe4abcc6bc0751d13280c0276edd3545768f
+ edb/schema/objects.py:928: : note: use --pdb to drop into pdb
- edb/schema/objects.py:2276: error: unused "type: ignore" comment
- edb/schema/objects.py:2307: error: unused "type: ignore" comment
- edb/edgeql/codegen.py:115:21: error: Argument 1 to "generic_visit" of "EdgeQLSourceGenerator" has incompatible type "Union[Base, Sequence[Base]]"; expected "Base"
- edb/schema/schema.py:547: error: unused "type: ignore" comment
- edb/schema/referencing.py:535:49: error: Incompatible types in assignment (expression has type "Optional[Any]", variable has type "Type[DDLOperation]")
- edb/schema/referencing.py:715:26: error: "Type[<subclass of "QualifiedObject" and "InheritingObject">]" has no attribute "get_field"
- edb/schema/delta.py:2305:48: error: Argument 3 to "getattr" has incompatible type "Object"; expected "Optional[so.Object_T]"
- edb/schema/delta.py:2314:31: error: Item "None" of "Union[Any, so.Object_T, None]" has no attribute "get_verbosename"
- edb/schema/pointers.py:792:28: error: Item "None" of "Optional[Type]" has no attribute "get_displayname"
- edb/schema/pointers.py:798:12: error: Item "None" of "Optional[Type]" has no attribute "is_enum"
- edb/schema/pointers.py:799:24: error: Item "None" of "Optional[Type]" has no attribute "get_displayname"
- edb/schema/pointers.py:801:24: error: Item "None" of "Optional[Type]" has no attribute "get_displayname"
- edb/edgeql/tracer.py:431:1: error: Dispatch type "None" must be subtype of fallback function first argument "Base"
- edb/edgeql/tracer.py:543:11: error: Argument 1 to "trace" has incompatible type "Optional[Expr]"; expected "Base"
- edb/edgeql/tracer.py:544:11: error: Argument 1 to "trace" has incompatible type "Optional[Expr]"; expected "Base"
- edb/edgeql/tracer.py:813:17: error: Argument 1 to "trace" has incompatible type "Optional[Expr]"; expected "Base"
- edb/edgeql/tracer.py:839:11: error: Argument 1 to "trace" has incompatible type "Optional[Expr]"; expected "Base"
- edb/edgeql/tracer.py:843:11: error: Argument 1 to "trace" has incompatible type "Optional[Expr]"; expected "Base"
- edb/edgeql/tracer.py:844:11: error: Argument 1 to "trace" has incompatible type "Optional[Expr]"; expected "Base"
- edb/edgeql/tracer.py:845:11: error: Argument 1 to "trace" has incompatible type "Optional[Expr]"; expected "Base"
- edb/edgeql/tracer.py:911:19: error: Argument 1 to "trace" has incompatible type "Optional[Expr]"; expected "Base"
- edb/ir/pathid.py:337:48: error: Unsupported operand types for + ("Tuple[Union[UUID, Name, Tuple[str, PointerDirection, bool]], ...]" and "Tuple[Tuple[QualName, PointerDirection, bool], UUID]")
- edb/edgeql/declarative.py:919:23: error: Need type annotation for "ast_subcommands"
- edb/ir/staeval.py:71:28: error: Argument 1 to "const_to_python" has incompatible type "Union[TypeCast, ConstExpr]"; expected "ConstExpr"
- edb/ir/staeval.py:265:1: error: Dispatch type "TypeCast" must be subtype of fallback function first argument "ConstExpr"
- edb/edgeql/compiler/schemactx.py:177:31: error: Argument "derived_name_base" to "derive_view_name" has incompatible type "Optional[str]"; expected "Optional[Name]"
- edb/edgeql/compiler/schemactx.py:231:29: error: "<subclass of "DerivableInheritingObject" and "Type">" has no attribute "get_pointers"
- edb/edgeql/compiler/inference/cardinality.py:235:1: error: Dispatch type "None" must be subtype of fallback function first argument "Expr"
- edb/edgeql/compiler/inference/cardinality.py:246:1: error: Dispatch type "Statement" must be subtype of fallback function first argument "Expr"
- edb/edgeql/compiler/inference/cardinality.py:304:1: error: Dispatch type "TypeRef" must be subtype of fallback function first argument "Expr"
- edb/edgeql/compiler/inference/cardinality.py:1275:37: error: Argument 1 to "_infer_cardinality" has incompatible type "Base"; expected "Expr"
- edb/edgeql/compiler/inference/multiplicity.py:105:1: error: Dispatch type "None" must be subtype of fallback function first argument "Expr"
- edb/edgeql/compiler/inference/multiplicity.py:116:1: error: Dispatch type "Statement" must be subtype of fallback function first argument "Expr"
- edb/edgeql/compiler/inference/multiplicity.py:769:38: error: Argument 1 to "_infer_multiplicity" has incompatible type "Base"; expected "Expr"
- edb/schema/std.py:41: error: unused "type: ignore" comment
- edb/schema/std.py:42: error: unused "type: ignore" comment
- edb/schema/std.py:43: error: unused "type: ignore" comment
- edb/schema/std.py:44: error: unused "type: ignore" comment
- edb/pgsql/compiler/relctx.py:94:28: error: Need type annotation for "view_path_id_map"
- edb/pgsql/compiler/relgen.py:1202:28: error: Argument 1 to "visit" has incompatible type "Optional[Expr]"; expected "Base"
- edb/pgsql/compiler/relgen.py:1817:41: error: Argument 1 to "compile" has incompatible type "Optional[Expr]"; expected "Base"
- edb/pgsql/compiler/relgen.py:1878:37: error: Argument 1 to "compile" has incompatible type "Optional[Expr]"; expected "Base"
- edb/pgsql/compiler/relgen.py:2883:39: error: Argument 1 to "compile" has incompatible type "Optional[Expr]"; expected "Base"
- edb/pgsql/compiler/relgen.py:2891:39: error: Argument 1 to "compile" has incompatible type "Optional[Expr]"; expected "Base"
- edb/server/connpool/pool.py:524:16: error: No overload variant of "get" of "Mapping" matches argument type "str"
- edb/server/connpool/pool.py:524:16: note: Possible overload variants:
- edb/server/connpool/pool.py:524:16: note: def get(self, key: <nothing>) -> None
- edb/server/connpool/pool.py:524:16: note: def [_T] get(self, key: <nothing>, default: _T) -> _T
+ Traceback (most recent call last):
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
+ sys.exit(console_entry())
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/__main__.py", line 11, in console_entry
+ main(None, sys.stdout, sys.stderr)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/main.py", line 87, in main
+ res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/main.py", line 165, in run_build
+ res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 179, in build
+ result = _build(
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 254, in _build
+ graph = dispatch(sources, manager, stdout)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 2707, in dispatch
+ process_graph(graph, manager)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 3031, in process_graph
+ process_stale_scc(graph, scc, manager)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/build.py", line 3123, in process_stale_scc
+ mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal_main.py", line 78, in semantic_analysis_for_scc
+ process_top_levels(graph, scc, patches)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal_main.py", line 199, in process_top_levels
+ deferred, incomplete, progress = semantic_analyze_target(next_id, state,
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal_main.py", line 326, in semantic_analyze_target
+ analyzer.refresh_partial(refresh_node,
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal.py", line 402, in refresh_partial
+ self.refresh_top_level(node)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal.py", line 413, in refresh_top_level
+ self.accept(d)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal.py", line 4965, in accept
+ node.accept(self)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/nodes.py", line 959, in accept
+ return visitor.visit_class_def(self)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal.py", line 1077, in visit_class_def
+ self.analyze_class(defn)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal.py", line 1155, in analyze_class
+ self.analyze_class_body_common(defn)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal.py", line 1164, in analyze_class_body_common
+ self.apply_class_plugin_hooks(defn)
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.8/site-packages/mypy/semanal.py", line 1224, in apply_class_plugin_hooks
+ hook(ClassDefContext(defn, base_expr, self))
+ File "/tmp/mypy_primer/projects/edgedb/edb/tools/mypy/plugin.py", line 97, in handle_schema_class
+ transformer.transform()
+ File "/tmp/mypy_primer/projects/edgedb/edb/tools/mypy/plugin.py", line 173, in transform
+ fields = self._transform()
+ File "/tmp/mypy_primer/projects/edgedb/edb/tools/mypy/plugin.py", line 446, in _transform
+ schema_t = self._lookup_type('edb.schema.schema.Schema')
+ File "/tmp/mypy_primer/projects/edgedb/edb/tools/mypy/plugin.py", line 231, in _lookup_type
+ type_sym = ctx.api.lookup_fully_qualified_or_none(fullname)
+ AttributeError: 'SemanticAnalyzer' object has no attribute 'lookup_fully_qualified_or_none'
|
Renaming |
Description
Follows up to #11205 and partially solves #4157.
This PR removes the
SemanticAnalyzerPluginInterface.builtin_type
which had been marked as deprecated. Also renames theMemberContext.builtin_type
withnamed_type
for consistency.