Commit 5bae05d
authored
[mypyc] fix name generation for modules with similar full names (#18001)
Fixes mypyc/mypyc#1071
Adds a test to cover this case
Building certain package layouts now succeeds instead of failing. The
behavior for all package layouts not affected by the error is unchanged.
In `namegen.make_module_translation_map(names)`, if argument `names`
have `"foo"` and `"foo.foo"`, all suffixes found for `"foo"` are also
found for `"foo.foo"`. This means that module `foo` has no unique
suffixes, which currently causes an `AssertionError`.
The fix forces a module to take the last, fullest suffix if none are
unique. It is guaranteed that no other module will also take the same
suffix because they either will have a unique suffix to take, or they
will take the fullest suffix for their name which is always going to be
different.1 parent cb9dd7d commit 5bae05d
2 files changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | 103 | | |
105 | | - | |
106 | | - | |
| 104 | + | |
| 105 | + | |
107 | 106 | | |
108 | 107 | | |
109 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
0 commit comments