Skip to content

Commit ec8684e

Browse files
aahanaggarwalfacebook-github-bot
authored andcommitted
Record missing names to ensure we get their NameToSName path
Summary: We are missing the NameToSName facts for some names. This will cause glass to fail when looking for references. eg https://www.internalfb.com/code/fbsource/[785dd9ce80df3fb43d2fe77f10cb5cff30df0636]/fbcode/scripts/rubmary/output/class.json?lines=82 this sort of name is not there right now because record_name is never called on the tail for when we add `<locals>` Reviewed By: donsbot Differential Revision: D81241797 fbshipit-source-id: 4698f71270a8fba039ef5cb9d41926ba6d323e41
1 parent 54a4038 commit ec8684e

File tree

3 files changed

+166
-0
lines changed

3 files changed

+166
-0
lines changed

pyrefly/lib/report/glean/convert.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ impl GleanState<'_> {
357357
}
358358
}
359359
};
360+
if !self.names.contains(&scope) {
361+
self.record_name(scope.clone(), None);
362+
}
360363
self.record_name(join_names(&scope, name), Some(name.range.start()))
361364
}
362365

pyrefly/lib/report/glean/snapshots/classes.json

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,49 @@
18721872
}
18731873
}
18741874
},
1875+
{
1876+
"id": 0,
1877+
"key": {
1878+
"id": 0,
1879+
"key": "classes.Animal.__init__.<locals>"
1880+
},
1881+
"value": {
1882+
"id": 0,
1883+
"key": {
1884+
"local_name": {
1885+
"id": 0,
1886+
"key": "<locals>"
1887+
},
1888+
"parent": {
1889+
"id": 0,
1890+
"key": {
1891+
"local_name": {
1892+
"id": 0,
1893+
"key": "__init__"
1894+
},
1895+
"parent": {
1896+
"id": 0,
1897+
"key": {
1898+
"local_name": {
1899+
"id": 0,
1900+
"key": "Animal"
1901+
},
1902+
"parent": {
1903+
"id": 0,
1904+
"key": {
1905+
"local_name": {
1906+
"id": 0,
1907+
"key": "classes"
1908+
}
1909+
}
1910+
}
1911+
}
1912+
}
1913+
}
1914+
}
1915+
}
1916+
}
1917+
},
18751918
{
18761919
"id": 0,
18771920
"key": {
@@ -2010,6 +2053,49 @@
20102053
}
20112054
}
20122055
},
2056+
{
2057+
"id": 0,
2058+
"key": {
2059+
"id": 0,
2060+
"key": "classes.Animal.speak.<locals>"
2061+
},
2062+
"value": {
2063+
"id": 0,
2064+
"key": {
2065+
"local_name": {
2066+
"id": 0,
2067+
"key": "<locals>"
2068+
},
2069+
"parent": {
2070+
"id": 0,
2071+
"key": {
2072+
"local_name": {
2073+
"id": 0,
2074+
"key": "speak"
2075+
},
2076+
"parent": {
2077+
"id": 0,
2078+
"key": {
2079+
"local_name": {
2080+
"id": 0,
2081+
"key": "Animal"
2082+
},
2083+
"parent": {
2084+
"id": 0,
2085+
"key": {
2086+
"local_name": {
2087+
"id": 0,
2088+
"key": "classes"
2089+
}
2090+
}
2091+
}
2092+
}
2093+
}
2094+
}
2095+
}
2096+
}
2097+
}
2098+
},
20132099
{
20142100
"id": 0,
20152101
"key": {
@@ -2121,6 +2207,49 @@
21212207
}
21222208
}
21232209
},
2210+
{
2211+
"id": 0,
2212+
"key": {
2213+
"id": 0,
2214+
"key": "classes.Dog.speak.<locals>"
2215+
},
2216+
"value": {
2217+
"id": 0,
2218+
"key": {
2219+
"local_name": {
2220+
"id": 0,
2221+
"key": "<locals>"
2222+
},
2223+
"parent": {
2224+
"id": 0,
2225+
"key": {
2226+
"local_name": {
2227+
"id": 0,
2228+
"key": "speak"
2229+
},
2230+
"parent": {
2231+
"id": 0,
2232+
"key": {
2233+
"local_name": {
2234+
"id": 0,
2235+
"key": "Dog"
2236+
},
2237+
"parent": {
2238+
"id": 0,
2239+
"key": {
2240+
"local_name": {
2241+
"id": 0,
2242+
"key": "classes"
2243+
}
2244+
}
2245+
}
2246+
}
2247+
}
2248+
}
2249+
}
2250+
}
2251+
}
2252+
},
21242253
{
21252254
"id": 0,
21262255
"key": {

pyrefly/lib/report/glean/snapshots/imports.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,40 @@
17761776
}
17771777
}
17781778
},
1779+
{
1780+
"id": 0,
1781+
"key": {
1782+
"id": 0,
1783+
"key": "imports.process_files.<locals>"
1784+
},
1785+
"value": {
1786+
"id": 0,
1787+
"key": {
1788+
"local_name": {
1789+
"id": 0,
1790+
"key": "<locals>"
1791+
},
1792+
"parent": {
1793+
"id": 0,
1794+
"key": {
1795+
"local_name": {
1796+
"id": 0,
1797+
"key": "process_files"
1798+
},
1799+
"parent": {
1800+
"id": 0,
1801+
"key": {
1802+
"local_name": {
1803+
"id": 0,
1804+
"key": "imports"
1805+
}
1806+
}
1807+
}
1808+
}
1809+
}
1810+
}
1811+
}
1812+
},
17791813
{
17801814
"id": 0,
17811815
"key": {

0 commit comments

Comments
 (0)