One function
generalize in RightTyper/RightTyper
The author described this change as “- fixed bug not checking first TypeInfo for a string argument;”. It counts as a record because the check below fails on the code as it stood at 5c6490473 and passes on 2048b95c3, with nothing else changed between the two runs.
ProjectRightTyper/RightTyper
Fix saved2025-01-10
Sharing licenceApache-2.0 · LICENSE
Change size+12 −6
What the code was meant to do, written into the code itself as a docstring
Processes a sequence of samples observed for function parameters and return values, looking for patterns that can be replaced with type variables. If no pattern is detected, the union of those types (per union_typeset_str) is built. samples: a sequence of tuples with type information. Each type in a tuple corresponds to a parameter (or return) type. typevars: a dictionary from type tuples (indicating a type usage pattern) to variable names. returns: a list of parameter (or return) type annotations.
The change
| 27 | 27 | ||
| 28 | 28 | first = types[0] | |
| 29 | 29 | ||
| 30 | - | return all( | |
| 31 | - | t.module == first.module and | |
| 32 | - | t.name == first.name and | |
| 33 | - | len(t.args) == len(first.args) and | |
| 34 | - | all(isinstance(a, TypeInfo) for a in t.args) | |
| 35 | - | for t in types[1:] | |
| 30 | + | return ( | |
| 31 | + | all( | |
| 32 | + | all(isinstance(a, TypeInfo) for a in t.args) | |
| 33 | + | for t in types | |
| 34 | + | ) | |
| 35 | + | and all( | |
| 36 | + | t.module == first.module and | |
| 37 | + | t.name == first.name and | |
| 38 | + | len(t.args) == len(first.args) and | |
| 39 | + | all(isinstance(a, TypeInfo) for a in t.args) | |
| 40 | + | for t in types[1:] | |
| 41 | + | ) | |
| 36 | 42 | ) | |
| 37 | 43 | ||
| 38 | 44 | from collections import Counter |
The check that tells the two apart
fail→pass·tests/test_typeinfo.py::test_generic_with_string
Check file tests/test_typeinfo.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it5c6490473d8bd262c2324932a6f628d57783d8ce
Broken version dated2025-01-10
Modulerighttyper.typeinfo
Units changedgeneralize
Fingerprintddd0841b268a6802
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.