Set flags for an overload implementation. Currently, this checks for a trivial body in protocols classes, where it makes the method implicitly abstract.
(self, defn: OverloadedFuncDef)
| 1407 | return None |
| 1408 | |
| 1409 | def process_overload_impl(self, defn: OverloadedFuncDef) -> None: |
| 1410 | """Set flags for an overload implementation. |
| 1411 | |
| 1412 | Currently, this checks for a trivial body in protocols classes, |
| 1413 | where it makes the method implicitly abstract. |
| 1414 | """ |
| 1415 | if defn.impl is None: |
| 1416 | return |
| 1417 | impl = defn.impl if isinstance(defn.impl, FuncDef) else defn.impl.func |
| 1418 | if is_trivial_body(impl.body) and self.is_class_scope() and not self.is_stub_file: |
| 1419 | assert self.type is not None |
| 1420 | if self.type.is_protocol: |
| 1421 | impl.abstract_status = IMPLICITLY_ABSTRACT |
| 1422 | if impl.abstract_status != NOT_ABSTRACT: |
| 1423 | impl.is_trivial_body = True |
| 1424 | |
| 1425 | def analyze_overload_sigs_and_impl( |
| 1426 | self, defn: OverloadedFuncDef |
no test coverage detected