Commit b8a25df
committed
Modify annotations to accommodate NULL_TREE
This finishes the main changes being done at this time to the
annotations of diff-related methods that were started in 0e1df29.
As expected and noted in previous commits, having Diffable.diff
permit NULL_TREE entails a violation of the Liskov substitution
principle in the overridden method IndexFile.diff unless a similar
change were also made there, which could not be done correctly
without modifying its behavior to actually accept NULL_TREE (it
does not contain code to cover it, and raises ane exception if it
is passed). I am unsure if that should ultimately be done, but even
if so, it seems to me to be beyond the scope of the typing changes
being done here.
This therefore applies a suppression there. The suppression is
specific to that one parameter. The long-standing comment atop the
IndexFile.diff method, which reads as vague today, is replaced with
a specific FIXME comment describing the situation where the method
refers to the base-class docstring for documentation of its
parameters yet doesn't accept NULL_TREE (and notes the mypy error).
In effect this is really restoring and fixing the suppression that
was present before 0e1df29 rather than adding a "new" one, but at
that time the base-class parameter type was much broader since it
was a union with object as one of its alternatives, so the
situation was much less clear.1 parent c9952e1 commit b8a25df
2 files changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1475 | 1475 | | |
1476 | 1476 | | |
1477 | 1477 | | |
1478 | | - | |
| 1478 | + | |
| 1479 | + | |
1479 | 1480 | | |
1480 | 1481 | | |
1481 | | - | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
1482 | 1485 | | |
1483 | 1486 | | |
1484 | 1487 | | |
| |||
0 commit comments