Skip to content

Commit ca7697d

Browse files
vassilmladenovfacebook-github-bot
authored andcommitted
Sort class arrays before returning them
Summary: D76565975 added a test case where the order of the subtypes from the native facts extension was different in `-m jit` vs `-m interp`. Restore that case, and sort the `Array` before returning it. Note: I'm only changing the ones that return `class<T>`, have not tested the other Facts functions. Reviewed By: jano Differential Revision: D76939342 fbshipit-source-id: 4b6e59c0c591f16b621cb7132d247eae103dc977
1 parent e83acda commit ca7697d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

hphp/runtime/ext/facts/facts-store.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ Array makeVecOfLazyClass(const std::vector<Symbol<SymKind::Type>>& vector) {
354354
for (auto const& str : vector) {
355355
ret.append(make_tv<KindOfLazyClass>(LazyClassData::create(str.get())));
356356
}
357-
return ret.toArray();
357+
auto arr = ret.toArray();
358+
arr.get()->sort(0, true);
359+
return arr;
358360
}
359361

360362
/**

hphp/test/slow/class-ptr/facts/facts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class C { public function __construct() { echo nameof static."\n"; }}
44
class D extends C {}
5-
// class E extends C {} // TODO(T227568155)
5+
class E extends C {}
66
class F extends D {}
77

88
function v($a): void {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
===== subtypes =====
22
D
3+
E
34
===== transitive_subtypes =====
45
D
6+
E
57
F
68
===== supertypes =====
79
D

0 commit comments

Comments
 (0)