https://github.com/facebook/hhvm

sort by:
Revision Author Date Message Commit Date
897c150 avoid duplicating some StaticStrings Summary: Make sure there is a single StaticString referring to "__call", also use empty_string() when appropriate, and kill empty_string_variant_ref. Reviewed By: alexeyt Differential Revision: D16496491 fbshipit-source-id: 5e1d344d12d1811ea8c35fea09eb96b147cfe730 28 July 2019, 00:06:39 UTC
ab15c9a Rename constructNoConst to lockWhileUnwinding, move the default from false to true Summary: In order to support the JIT unwinder, we need to be able to make decisions on whether to lock the object at the top without having to rely the particular bytecode. Changing the FCA in this way so that `lockWhileUnwinding` is set only when we need to lock the object at the top enables us to emit a more generic codepath. Reviewed By: alexeyt Differential Revision: D16522474 fbshipit-source-id: 719e854c66652fd57bba4e1fea5c997a4be98dc5 27 July 2019, 22:11:00 UTC
e62cef6 Remote init Summary: This is the final piece that makes distributing type checking work end-to-end. Reviewed By: jewelpit Differential Revision: D16146602 fbshipit-source-id: b3184cdbce6ba1c9dac141e2e65e147c7407049f 27 July 2019, 05:59:26 UTC
e47801c Remote typing check service Summary: Named by the analog to the (local) `Typing_check_service` - it's used by the devserver side to delegate type checking to remote workers instead of the local MultiWorker workers. Reviewed By: jewelpit Differential Revision: D16146599 fbshipit-source-id: da6905c3936997c5f0932e4b09af96721230bd03 27 July 2019, 05:59:25 UTC
8f89f2c Move __Const checks from nast check to parsing Summary: - Non const classes can extend __Const classes - Moved disallow abstract final class check to parsing - Removed redundant 'disallow __Const on traits, interfaces, and enums' check from nast check - The case Crecord in NastCheck currently has no error-checking during parsing. It also currently will never parse a __ Const attribute as 'missing' is passed in along every parsing path for parse_record_declaration. I made a post on Hacklang Engineering to see if the plan is to further deprecate these or whether we need to add any checks on them. Reviewed By: alexeyt Differential Revision: D16522670 fbshipit-source-id: 26ffa1cce177bb2e6a719ffcf4132afa52eb7342 27 July 2019, 05:36:06 UTC
b09680c Verify Const props in Typechecker Summary: - Parallels checks added in D16434159 - Adds tests to verify these invariants in typechecker - Most checks already in place in typechecker - Enforce instance properties in traits being copied into a const class are const - <<__NoFlatten>> attribute does not need to be tested in typechecker as well because it is not an external attribute Reviewed By: kmeht, alexeyt Differential Revision: D16507810 fbshipit-source-id: a49bb9bcc06b1426b7e96a9ce7ce47ed63bccc1f 27 July 2019, 05:36:05 UTC
df090ef Removed --max-errors from /typecheck/const_attribute/usage Summary: - Removed --max-errors from typecheck/const_attribute/usage to be able to see other significant errors - Increases readability of next diff that will remove some of these and could appear to be adding new errors that did not show with --max-errors=1 Reviewed By: kmeht, alexeyt Differential Revision: D16507665 fbshipit-source-id: dac2a5f21d893e39250f11070a53128661f18a0d 27 July 2019, 05:36:04 UTC
b42a5b2 Added typechecker option for __Const attribute Summary: - Added typechecker option for __Const attribute - There was no current experimental flag for __Const attributes Reviewed By: kmeht Differential Revision: D16497682 fbshipit-source-id: a968e07587474c0a5609e38977fd870d2b49663f 27 July 2019, 05:36:04 UTC
892f5d0 Store gconsts and typedefs from decl_provider in LRU cache Summary: Was having some issues with storing classes, will look into that next. Reviewed By: 2BitSalute Differential Revision: D16526189 fbshipit-source-id: d0183a2c2f48ea1723fe72f13e1529a610308d9d 27 July 2019, 04:12:34 UTC
1aceb49 Add Hh_logger message in typing_lru_check_service Summary: Kept rebasing on top of a similar change as a sanity check, but this can probably be checked in. Reviewed By: 2BitSalute Differential Revision: D16522673 fbshipit-source-id: 481450ddb3c4fa7bc3aebfde0bbde3fb93d13b7b 27 July 2019, 04:12:33 UTC
dcd89c0 Break before is/as tokens instead of after Reviewed By: arxanas Differential Revision: D16523171 fbshipit-source-id: a39872d4a0adf7e582c9cce805cdcacc4e97b2ba 26 July 2019, 23:43:55 UTC
3bc30eb Consolidate autocomplete_kind enum Summary: Reduce the number of conflicting enums that define a symbol's "kind". This diff removes `AutocompleteTypes.autocomplete_kind`. Interesting side effects of this code that don't appear to have major impact: * The "autocomplete_kind" enum was used for a lot of local kinds (literals, keywords, etc) that we didn't have in the si_kind enum, since the si_kind enum was focused on global kinds. * In the "autocomplete_kind" enum we had the concept of a "literal". Interestingly, LSP does not have a "literal" kind: it instead has string, int, bool, etc. * Literals are specifically used to represent "shape keys". * In some old code, the autocomplete_kind "constant" was being mapped to "value". That's odd. I fixed it to map it to constant. * The enum "completion." doesn't recognize namespaces; I mapped `SI_Namespace -> Completion.Module`. I will look to make this more accurate when I attempt to resolve the completion enum. Actual impacts of this change: * Prior to this diff, class constants were rendered in LSP requests as type "value". For example, in this code, `Elsa::bard` would show up as LSP completion "value". The new code renders Elsa::Bard as "constant". This is slightly more precise, although `EnumMember` would be the best possible kind. ``` enum Elsa: string { Alonso = "hello"; Bard = "world"; } ``` Reviewed By: jewelpit Differential Revision: D16504757 fbshipit-source-id: 5d4bbe4a77b0f5695ec8ec545459ece8a6f0ab9d 26 July 2019, 22:24:13 UTC
bd41543 Fix expected error messages Summary: Apparently some error messages have been slightly rewritten. Let's update the expected tests to match. Reviewed By: arxanas Differential Revision: D16522542 fbshipit-source-id: 54234863be3a4b0f7dd6f6238dafcb12b491dd19 26 July 2019, 22:24:13 UTC
731db7b Shard the autoload DB when tests are run in multiple modes Summary: D16449641 adds a test. This test works when you run ``` hphp/test/run -m interp hphp/test/slow/facebook/autoload-parse-error/autoload-parse-error.php ``` works when you run ``` hphp/test/run -m jit hphp/test/slow/facebook/autoload-parse-error/autoload-parse-error.php ``` and fails when you run ``` hphp/test/run -m interp,jit hphp/test/slow/facebook/autoload-parse-error/autoload-parse-error.php ``` The problem is that running in `-m interp,jit` mode causes the test to run a second time before cleaning up artifacts generated by the first run. To resolve this, I'm sharding the `.autoloadDB` artifact by the index of the mode we're running the test in. Now two `.autoloadDB` artifacts will be created, and each test will read from its own DB, maintaining test isolation. Reviewed By: alexeyt Differential Revision: D16520159 fbshipit-source-id: 4d68919259d7c72042f65fc93627b4dfb828ee92 26 July 2019, 21:52:32 UTC
90f8ca3 Make HHI types match runtime types (#8540) Summary: In the face-sql implementation from slack, we discussed how they were casting NULL to string. I presumed that the return value should have a nullable string, instead of a string. `mapRows(): Map<string, ?string>` instead of `Map<string, string>`. I checked my HHI, but it says that a string was used. I did not believe that, so I tried the runtime. At runtime you actually get a nullable string. Pull Request resolved: https://github.com/facebook/hhvm/pull/8540 Differential Revision: D16461914 fbshipit-source-id: fbe7397ef4ffa8f611128c266638ca60b77fe334 26 July 2019, 21:36:20 UTC
cc51e9c make hphp/zend/ explicitly depend on hphp/util/ Summary: D16461543 added an indirect dependency on low-ptr-def.h, which is generated by hphp/util/'s build process. We need ot build hphp/util first. This sometimes happened randomly (on all our *castle builds and real linux builds), sometimes didn't (on our real macos builds); make the dependency explicit Reviewed By: jjergus Differential Revision: D16518679 fbshipit-source-id: 5c62a846b346e01a3466699f1a769f9cfbb10fad 26 July 2019, 20:42:07 UTC
b8c5117 (1/x) Skeleton code for Big Code indexing in hh_server Reviewed By: Wilfred Differential Revision: D15976838 fbshipit-source-id: ce4e0683d3a35d78fa1d5916d2850de160766f9e 26 July 2019, 19:30:00 UTC
4c79cf5 Calculate bucket size when typechecking Summary: Previously buckets were always defaulted to size 500, introduce a change to calculate the bucket size the same way as in `typing_check_service`. Reviewed By: jewelpit Differential Revision: D16502506 fbshipit-source-id: 05656df0e1a4a652a63cc12ed2751ebd4d487a9c 26 July 2019, 19:04:40 UTC
305176c Add tests for `Lwt_message_queue` Summary: As per title. I'm going to change the behavior a bit in future commits, so it's good to add tests now. Differential Revision: D16472718 fbshipit-source-id: 715995460794734ab865ca2be0afec01ab9b86ef 26 July 2019, 18:58:51 UTC
ece197e Pass through RPC commands Summary: No behavioral change. There was originally a layer of abstraction in `ClientIdeService`, where we exposed each RPC command as an individual function. I thought this might be useful for integration tests or something, but it has turned out to be unnecessary altogether. Remove it, and instead have the callers make direct calls to `rpc`. This is also useful for the future where we want to pass a "notification handler" to `rpc`, so that we can handle notifications that come in while we're waiting for a certain RPC request to complete. We would have to add this notification handler as a parameter to every IDE command. This commit also unifies the concept of a "document location", which identifies the cursor at a certain location in the document. This is one of the most common parameters to an IDE command. Differential Revision: D16465331 fbshipit-source-id: 8ccd1d164defa46d12c7a4750854bec992b775a1 26 July 2019, 18:58:51 UTC
9d64b7d Refactor 4336 to better match what it means Summary: This new error code for return mismatches doesn't have a good name. It really only appears when a function implicitly returns `void` but the function hint isn't `void` (or `Awaitable<void>`) This fixes up the naming to keep the error code distinct. Reviewed By: shiqicao Differential Revision: D16519121 fbshipit-source-id: b591b7c5d1f8d6769f72dd1d124e0c79e546be10 26 July 2019, 18:53:17 UTC
fb4c578 Wire up disallowed decl fixmes to provide error when tried. Summary: Hack provides error messages if users try to apply HH_FIXMEs that are otherwise forbidden. The new disallowed_decl_fixmes don't. They just hide the fixmes, leading to user confusion (and increased support load). This threads through the decl fixmes that were tried and forbidden, even if they don't obscure an error so that users get an error and can remove the bad comment. Reviewed By: jewelpit, vassilmladenov Differential Revision: D16452357 fbshipit-source-id: 9b0b15ac0ab255b588a31cd3e930a2b6d3b9e64c 26 July 2019, 18:03:50 UTC
09feb2e Consolidate search_result_type enum Summary: Reduce the number of conflicting enums that define a symbol's "kind". This diff removes `search_result_type`. It allows us to eliminate a number of imprecise conversions: Interesting side effects of this code that don't appear to have major impact: * `search_result_type.ClassVar` and `search_result_type.Method` were defined, but never used in practice * The enum supported a concept of `scope`, which was only ever used to designate class methods as `static`. * `search_result_type.Class (None)` should not be possible, but the code permitted it * `search_result_type.Class (Some Ast.Crecord)` was defined but never used - would this imply a shape? * In `search_result_type`, an enum was considered a sub-kind underneath "class". * `search_result_type` had a concept of abstract class definitions as separate from regular class definitions. This didn't actually result in any user-visible impact. We already store information about "abstract"-ness when we generate the symbol index, and we use that to avoid showing abstract classes as choices for autocomplete when someone types `$x = new ` * It's unclear whether there was ever an intention to separate "class constants" from "global constants". Actual impacts of this change: * Because `SI_ClassMethod` does not support extra data. We previously used `Method ("static", BaseClassName)`. This removes support for `containerName`, a feature of the LSP syntax used for `textDocument/documentSymbol`. * I was able to run DocumentSymbol by selecting the Nuclide feature "Toggle Document Symbols", but I did not see the base-class element appear, so I think removing container name is safe. Here's a video demonstrating that base class does not currently appear when using the LSP document symbol feature: Reviewed By: jewelpit Differential Revision: D16500374 fbshipit-source-id: 6be60a165a040f514ba99ccff1799fd85b605b35 26 July 2019, 16:51:31 UTC
4719421 Suggest similar methods and variables in error messages Summary: If we encounter an undefined variable, method, or a static method, suggest the most similarly named symbol that the user may have intended. Reword the error messages to be concise, so we have room to add the suggestion. Reviewed By: CatherineGasnier Differential Revision: D16017900 fbshipit-source-id: c375961b296b959c7c75ca4c66ba2f761469cb84 26 July 2019, 16:39:56 UTC
3dc972c Split xhp attribute type mismatch out from 4110. Summary: Error 4110 (unfication error) tends to cover all manner of type errors, meaning it is hard to categorize and migrate them. This splits a certain class of error off into its own error code - places where an xhp value is invalid. Reviewed By: shiqicao Differential Revision: D16508296 fbshipit-source-id: eb3f2575662b5b009e58b03f5667b7f0dcd5d699 26 July 2019, 16:20:12 UTC
aa83577 Remove outdated comment + fix until ocamlmerlin is udpated Summary: For the time being, ocamlmerlin+nuclide need to export OCAMLLIB and OCAMLFIND_CONF correctly, which clashes with dune. Cleaning up the env to avoid build problems Reviewed By: Wilfred Differential Revision: D16495287 fbshipit-source-id: 3d5ceb1866bcd8cd6f58c2b569f1f94e9639d108 26 July 2019, 15:33:27 UTC
939c96b Enable ocamlformat for parts of hphp/hack Summary: Enable `ocamlformat` for `hphp/hack`. Since the codebase is large and not consistently formatted today, only format the AST and AAST directories. For the others, leave a `.ocamlformat` that disables formatting in that directory. This also ensures ensures that any new directories will be formatted in this style. Configure using a `.ocamlformat` that's close the current style to minimise code churn. Reviewed By: jewelpit Differential Revision: D16421601 fbshipit-source-id: 7c71aa5fd295f6163a63fd10112da2042c1234ad 26 July 2019, 10:40:48 UTC
e6c5f04 Enforce invariants of const classes/properties in class loading. Summary: In Class::setParent, enforce that a const class can only extend other const classes. In Class::setProperties, enforce that instance properties cannot be redeclared with different constness. In Class::importTraitInstanceProp, enforce that all trait properties being copied into a const class are const. Add unit tests. Reviewed By: oulgen Differential Revision: D16434159 fbshipit-source-id: 57516cee4a11202b9db1e4311e00928b8f1cd9bc 26 July 2019, 09:49:38 UTC
22c8661 De-duplicate Class code for handling redeclared instance props. Summary: De-duplicate the code that handles redeclaring instance properties in Class::setProperties. The case where we were redeclaring with a public property VS with a protected property differed only in the presence/absence of a 2-line if that weakens a protected property to public. Move the code into a lambda that works for both cases. Reviewed By: paulbiss Differential Revision: D16434162 fbshipit-source-id: 219991dd2b0c40542630f899e97a518c95712499 26 July 2019, 09:49:37 UTC
2641c03 Add __NoFlatten to hhbbc, use it to fix const object test. Summary: Add an attibute that tells hhbbc to not flatten traits marked with it. This lets us reliably write unit tests for non-flattened traits without jumping through hoops. Use it to fix hphp/test/slow/object/const/copied-from-non-flattened-trait.php. Since it was written, a change in hhbbc caused traits to get flattened in it despite the hack it was trying to use to prevent that, and another change caused us to turn NewObjS into NewObjD, which meant we would resolve class C by name in D::makeParent, think it was non-unique, and refuse to optimize the LockObj away without testing the code paths that this test is trying to cover. By forcing T to not be flattened into C without using hacks, and by making C unique, we avoid both of these issues and the test once again tests what we want. Reviewed By: oulgen Differential Revision: D16434160 fbshipit-source-id: c3b8df12f1b20f98bf9c9b7fa66e4fa416778c61 26 July 2019, 09:49:37 UTC
2283612 Delete unused hg events from HackEventLogger Summary: These are not used anymore. Reviewed By: ljw1004 Differential Revision: D16510107 fbshipit-source-id: 27bdae5401fcfd3df5a28b046b70c7efb95bdb9a 26 July 2019, 05:42:50 UTC
d7d2bf8 Delete build-related events and columns from HackEventLogger Summary: I observed that we don't log these anymore. Reviewed By: ljw1004 Differential Revision: D16508894 fbshipit-source-id: 344f760ff7a5e2d9dc2f42716a2ad73839006263 26 July 2019, 05:42:49 UTC
f7753e3 Create and cleanup autoloadDBs for unit tests Summary: HHVM integration tests need to be deterministic, but my native autoloader tests have been leaving data around in a central autoloader DB, causing the first run of a test to follow a different code path from every subsequent run. This diff moves the autoloader command-line option into the `run.php` test harness, allowing the test harness to clean the DB up after every test. Reviewed By: alexeyt Differential Revision: D16449338 fbshipit-source-id: 21580695e09cf729c8a7e4b4a9b44538c582d009 26 July 2019, 02:33:59 UTC
dae4151 delete versions for some extensions Summary: `get_PHP_VERSION()` depends on `RuntimeOption::PHP7_Builtins`, which isn't set up correctly yet when we initialize the extension classes. Whatever depends on the version is likely broken. So just use the default hhvm version as the extension version. Reviewed By: fredemmott, alexeyt Differential Revision: D16499314 fbshipit-source-id: c870aab81aaf210548b90ceb56e07cb988a83e4e 26 July 2019, 01:09:01 UTC
4088b30 Fix class of inherited props in late init error messages. Summary: Some operations on objects (cast to array, comparison) were reporting the wrong class in error messages about (soft) late init props: the class of the object rather than the class the property was declared in. Fix it, add tests. Reviewed By: ricklavoie Differential Revision: D16500229 fbshipit-source-id: 73400deb3ac3edf1d9a43f02a1f7f0e0648b7f59 26 July 2019, 00:22:17 UTC
2bb9207 Convert WatchmanAutoloadMap::sync to a Future Summary: (Most of this diff is closed-source, but all the code will be open-sourced as soon as we get our own house in order.) This diff adds an asynchronous implementation of `WatchmanAutoloadMap::sync`, the function which synchronizes the WatchmanAutoloadMap with the repo's state. I didn't like having a method called `sync` which is implemented in an async manner, so I renamed the async method to `update` and the synchronous version to `ensureUpdated`. In Facebook Hacklang code we usually prefix async methods with `gen`, e.g. `async function genUpdate(): Awaitable<bool>`, but I don't know if we have any such convention for C++ methods using folly Futures. Note that I'm still using a lock here, and I'm still staying in the lock while I wait for the future chain to complete. This is because I'm moving futures into each other to set up a future chain, and the move operation is not thread-safe. We only ever have one update operation going on at a time anyway, so I don't think the lock synchronizes our resources beyond what the problem domain requires. Reviewed By: dneiter Differential Revision: D16424845 fbshipit-source-id: 0dd60bc38d4066efb954eaf406853d3b51ae86fc 26 July 2019, 00:14:42 UTC
4015232 Add support for class specializations to RAT Summary: Like object, add support for specialized (exact and subtype) class types to the repo-auth-type. This lets HHBBC report any type inferences done to the interpreter/JIT for class types. Reviewed By: markw65 Differential Revision: D16456388 fbshipit-source-id: 78c6bef61ef972370ccb82569ebcece5e17a8a3a 25 July 2019, 23:21:55 UTC
8ccea2f Remove now dead class-ref code Summary: Remove the code which is now dead because class-refs are gone Reviewed By: markw65 Differential Revision: D16425192 fbshipit-source-id: 4094a576b9c6ec8b233c6096bb688c717c1a88df 25 July 2019, 23:21:54 UTC
f088840 Remove class-refs Summary: Class-refs were added as a way to avoid needing a KindOfClass datatype. Before that, KindOfClass values could exist on the stack (but nowhere else), and weren't a subtype of TGen in the JIT. Since Class* was only stored in a class-ref, we never needed a datatype. However, we're not in a space crunch for datatypes anymore, and KindOfClass is back anyways. So, there's no longer much of a compelling reason to have them. This diff removes the usage of class-ref slots for all bytecodes. Instead of writing or reading a class-ref slot, the instruction pushes or pops a Class* to the stack, like other values. This is actually less complicated than the original way, since TCls are a subtype of TGen now, so there's very little special handling needed. The only real complication is that the class-ref slots grew to contain reified generic information as well. However, an audit of the emitter reveals that there's actually only one combination of bytecodes where the reified generic information might be emitted and might be used. That is: ClsRefGetTS and NewObj[D]. ClsRefGetTS is renamed to ClassGetTS and pushes two values on the stack: The Class and the reified generics. We use KindOfNull to represent the lack of reified generic information (since we can't use a bare null pointer on the stack like previously). Add a new bytecode called NewObjR which behaves like NewObj, but expects reified generic information to be on the stack as well. NewObj now is just for the case where there's no reified generic information (it just pops the Class). These situations can be distinguished statically in the emitter (this also means the "MaybeReified" immediate stuff isn't needed anymore). BaseSC has a few complications as well. Due to order of operation issues, it can read its property name at an arbitrary offset into the stack. Likewise, the Class needs to be evaluated (and hence pushed onto the stack) at different points. Therefore the bytecode cannot just pop the Class off the top. Add a new immediate to BaseSC which gives the offset into the stack of the Class as well. This required adding some additional support to HackC to track the different possible locations of the property name and class. Other than that, everything is straightforward. DiscardClsRef is gone, it can be done with PopC now. Rename ClsRefGetC and ClsRefGetTS to ClassGetC and ClassGetTS. Rename ClsRefName to ClassName. Most bytecode changes (like for Self, etc) are straightforward. Note that this diff leaves a *lot* of dead code. For easier review, that will all be removed in a follow-up diff. Reviewed By: jano, markw65 Differential Revision: D16374292 fbshipit-source-id: 00a11023187ad04767d1c7014ac0c35e6e08cc7a 25 July 2019, 23:21:53 UTC
5c97fe9 Work around deep mutual recursion in Syntax::to_ocaml Summary: Assume that to-OCaml value syntax tree node serialization requires ~2.5x more stack space than parsing, which is almost true in debug mode (because Rust puts intermediate of *each* branch on stack). Also, panic if the stack limit is ever exceeded, to prevent OOM. Reviewed By: shiqicao Differential Revision: D16473535 fbshipit-source-id: 67f1b79c1133442867755cce9ac8810336ff4dab 25 July 2019, 21:57:07 UTC
eacad98 Do not needlessly compute type of result of array append Summary: Similar to D16494603 only for array append. This time, the caller doesn't even use the type! Reviewed By: kmeht Differential Revision: D16495067 fbshipit-source-id: 31b0a34e97a51d7ce2d94ee115e42184d4005907 25 July 2019, 21:45:02 UTC
b5b119c Do not needlessly compute type of result of array assignment Summary: The code in `Typing_array_access` for dealing with array assignments of the form `$x[$y] = $z` computes the TAST type of the whole assignment expression recursively. But as far as I can tell, this will simply produce the type of `$z`, which we have in our hand already. In any case, for inference purposes we use the type of `$z` as the type (see line in `typing.ml`), so for consistency we should just use this in the TAST also. Reviewed By: kmeht Differential Revision: D16494603 fbshipit-source-id: d59d6ef6c198912376980566ce08545d8a16ddcb 25 July 2019, 21:45:01 UTC
0927e3d Include name of inheriting class in Decl_heap_elems_bug message Summary: While investigating T47852226, it was useful for me to know which class inherited the missing member (because that class was an invalid declaration stored in the saved state). This logging seems useful in general and I think we should keep it. This change also avoids running the `sprintf` unless we are actually going to raise the exception. Reviewed By: 2BitSalute Differential Revision: D16495861 fbshipit-source-id: ca924a375d01722c18e8c41fe439c36e59c6fe5e 25 July 2019, 21:10:56 UTC
e47206f Caching annotations Summary: Separate out annotation file parsing from printing, cache annotation files. Reviewed By: jjgriego Differential Revision: D16287280 fbshipit-source-id: d6f745b308b65a356fc76f33afa089f4d361b673 25 July 2019, 21:10:55 UTC
07305ca Switch zend-strtod back to using rdslocal Summary: This undoes the de-rdslocal-ifiication of D15242988. Reviewed By: edwinsmith Differential Revision: D16461543 fbshipit-source-id: 5701df9718a628532e29102d9571b87727bcb8fc 25 July 2019, 21:03:58 UTC
38dd632 Refactor rds local to allow alternate impls Summary: This moves rds-locals into the utility subdirectory. This increases flexibility of their usage. Reviewed By: alexeyt, edwinsmith Differential Revision: D16430228 fbshipit-source-id: 980bfed8e97fa828970fae215ff4a942b5f11ed0 25 July 2019, 21:03:57 UTC
4268109 Unban reification of newtype, dynamic and functions Summary: All of the above are now being correctly handled in the runtime and the typechecker. Let's unban them. Reviewed By: kmeht Differential Revision: D16498430 fbshipit-source-id: c89dbdee06339a1617553ea8e6712b0b17313b23 25 July 2019, 20:30:49 UTC
5d1cd0e Set worker_id if using OCaml Shared Memory Summary: In the current implementation, all workers believe that they are the master process, and have `worker_id = 0`. I didn't think that this had any side effects other than workers being able to remove from `shared_memory`, which shouldn't have been an issue during type checking. However, as I was getting non-deterministic errors on the same `www` revision (and running out of other possibilities to investigate), I found this interesting snippet in `hh_shared.c`: https://fburl.com/xzophqqa. This implies that workers have worker-local storage in shared memory, which would explain how errors were non-deterministic (they would stomp on each other's memory regions). This diff addresses this and assigns each thread a `worker_id`, such that all workers corresponding to a single thread have the same `worker_id`. Reviewed By: 2BitSalute Differential Revision: D16471610 fbshipit-source-id: b437d1c5822c90a734a504ae8e0e329b16f76fac 25 July 2019, 19:44:51 UTC
d20ac9d Add TypeAlias to a separate table Summary: - This moves typealias to a separate table - The reason for that is so we can create the autoload map from the repo without reading all unit extradata. Reviewed By: jano Differential Revision: D15329659 fbshipit-source-id: 2039e5fd8f341d7b23ad236187ae66a99cb74864 25 July 2019, 18:45:36 UTC
2bceca5 Verify no __LateInit, __SoftLateInit [static] const props in Typechecker Summary: - Verify parsing error for __LateInit and __SoftLateInit [static] const props in typechecker - Checks added in D16281754: - Tests for __Const on interfaces, traits, and enums tests already exist - Tests for __Const static props already exist Reviewed By: kmeht, alexeyt Differential Revision: D16478040 fbshipit-source-id: 881661bfe5b1eda3a958f76d9cc9c6aa141561c6 25 July 2019, 18:15:29 UTC
35ce663 Check where constraints on use/implements Summary: [hack] Moving where constraint check from NastCheck to Typing. We check if a class declaration meets the where constraints of the interfaces it implements and the traits it uses in Typing phase now, which was performed in NastCheck. Reviewed By: Matt-Schellhas Differential Revision: D16447409 fbshipit-source-id: 6841a6924acb1967a7dcf3b75c2605d129b16ea5 25 July 2019, 17:15:50 UTC
412918f Add visibility check of private/protected member for constraints Summary: [hack] Typing_visibility now considers subtyping with where constraints This diff enables visibility checking when a class with constraints tries to access members belonging to constraints. This feature is important for constraints to serve as "required classes" rather than merely upper bounds in subtyping. Visibility check can be performed via subtyping: 1. public visibility means no checks 2. protected visibility means the caller is a subtype of the class where the method was declared. 3. private visibility means the caller and the class where the method was declared are mutually subtype of the other. With this diff, we will be able to write partial classes in Hack with the constraint `trait PartialC where this = C`. Reviewed By: Matt-Schellhas Differential Revision: D16348409 fbshipit-source-id: bec35e23a86a3bf0dbc8f583e9f1d20b9f4eb16b 25 July 2019, 16:54:47 UTC
ba442a7 Change error message and recommend __EntryPoint Summary: - Make it clearer that people should use __EntryPoint Reviewed By: kmeht Differential Revision: D16453599 fbshipit-source-id: ad96299696eda5909ce111b6e6177df9b47bcaf9 25 July 2019, 16:36:46 UTC
684d4fb Make type-alias chain tests runnable from hphp Summary: Following other tests in this vein, e.g. test/slow/autoload/systemlib-duplicate-autoload.php, add the include files so they can be found from fbcode, hphp, or test directories. Reviewed By: arnabde03 Differential Revision: D16444856 fbshipit-source-id: ead3949ca76a0b87c074ab8f39e2d54dd054b741 25 July 2019, 15:47:35 UTC
175b653 Remove Typing_env.set_mode Summary: We should never be able to mutate a file's mode—it's an immutable property of the file. This removes `Typing_env.set_mode` and instead passes the mode into the constructor function. This will prevent bugs like the one fixed in D16455881. Reviewed By: DavidSnider Differential Revision: D16473841 fbshipit-source-id: 47bafe324b98866aa74097defcccac3f05d39c5a 25 July 2019, 15:33:22 UTC
f478412 Move files and targets related to redeclarations Reviewed By: arun11111 Differential Revision: D16489413 fbshipit-source-id: ef9889d2d75b3e28f782db31ebadce6803c29c46 25 July 2019, 14:58:40 UTC
0de0827 Sync worker requirement mismatches Summary: Syncing worker requirement mismatches to improve remote build time. Created actions: MEDIUM: 2105 LARGE: 544 XLARGE: 13 Updated actions: From MEDIUM to LARGE: 7 From LARGE to MEDIUM: 5 From LARGE to XLARGE: 3 Differential Revision: D16479094 fbshipit-source-id: 0bfceeb6cc4d8dc37f5124fc02378bae21fe113b 25 July 2019, 13:44:09 UTC
467a122 Prevent swallow exception by `profile_longer_than` Summary: Prevent swallow exception by `profile_longer_than` Reviewed By: losvald Differential Revision: D16468430 fbshipit-source-id: 6b11c0fe3a8f7c751df0c8d7a50e11dfdfe49964 25 July 2019, 07:06:03 UTC
143b017 Fix broken tests Summary: Fix tests broken by D16426910 Reviewed By: oulgen, alexeyt Differential Revision: D16477097 fbshipit-source-id: 164b8d20f4d258c7bf964436f6130dba602dc21c 25 July 2019, 06:45:11 UTC
bfdbc1f Only cache resolve() results in pdce-inlining Summary: Due to the changes to allow for self-referential DefLabels in pdce-inlining, the results of resolveDefLabel() are now path dependent (that is, it depends on the order you visit instructions). Because of this, its not correct to cache each intermediate lookup. Instead only cache the final result (the one returned to resolve()). Reviewed By: jano Differential Revision: D16475387 fbshipit-source-id: 6eb5ba4064b1a80fdf02f565b85fd1a5bca03422 25 July 2019, 06:06:11 UTC
3e6321d Disable writing to static const props using reflection Summary: Added check to builtin function setStaticPropertyValue to prevent setting static const properties using reflection. Reviewed By: kmeht, alexeyt Differential Revision: D16371853 fbshipit-source-id: bc70853efab9b7a1d71d32d8e2f3e99ec8261a64 25 July 2019, 05:02:16 UTC
c5fad4b Disable writing to constant static properties Summary: - Add checks to bytecodes that write to static properties to ensure the properties are not constant. - Add a "constant" field to PropValLookup, and then use this returned value from lookup_sprop() to determine whether to throw. - Updated LdClsPropAddrOrRaise and LdClsPropAddrOrNull to throw exceptions if writing to a const static property Reviewed By: alexeyt Differential Revision: D16289094 fbshipit-source-id: 4b266a435ad0c50cdd3e67ea44ce7ce60c9f3e93 25 July 2019, 05:02:15 UTC
d9015a9 Add tests to disallow const static __LateInit and __SoftLateInit props Summary: Added tests that check that the parser and assembler disallow __LateInit and __SoftLateInit static const props. Reviewed By: kmeht, alexeyt Differential Revision: D16473904 fbshipit-source-id: 29317a940b36b4f5b1a60eb74163217c9dacbad6 25 July 2019, 04:00:23 UTC
45387f2 Fix positions, begin clean up of coercion Summary: I had selected the position from the component type in coercion of union and abstract cases, which was putting errors on the positions relevant to the component type. Small example: ``` function test(int $key): void { $a = array(4, 'aaa'); // error was on the 4, the reason for the `int` component of the type $a[$key] = 4; take_string($a[1]); // (int | string) ~/> string } function take_string(string $_): void {} ``` The error for the invalid parameter was pointing to the line with the assignment rather than the line with the function call. This diff fixes that and deletes the .like_types.exp files that became identical to .exp files. Bash script ``` find -name '*.php.like_types.exp' | while read ltexp; do php=${ltexp%".like_types.exp"}; exp="$php.exp"; if diff $ltexp $exp; then hg rm $ltexp; fi done ``` The overarching plan is to remove the callsites to `can_coerce` and use `try_coerce` instead, then merge `can_coerce` into `coerce_type`. Reviewed By: Matt-Schellhas Differential Revision: D16448766 fbshipit-source-id: 1c34b7a566087977b18a1bec758587a57d49f968 25 July 2019, 03:46:10 UTC
85fe7e3 Remove InstanceOf from AAST Summary: As titled. This removes the `InstanceOf` expression node from the AAST and fixes any downstream effects. Reviewed By: Matt-Schellhas Differential Revision: D16430481 fbshipit-source-id: 9b97d8e25671a9309e9ef5d3fde4ee4cf2d596ff 25 July 2019, 03:33:28 UTC
f632977 Remove ForbidDynamicCalls option from tests Summary: Corrected failing tests to match current options. Reviewed By: ricklavoie Differential Revision: D16471116 fbshipit-source-id: b91ff54760118a7a916f3b4a86af34dbca0935fb 25 July 2019, 03:21:42 UTC
df0c589 Name `ClientIdeMessage` messages consistently Summary: We have three or so different naming conventions for `ClientIdeMessage`s. Settle on one and use it for all the message types. Reviewed By: 2BitSalute Differential Revision: D16447694 fbshipit-source-id: 36c9520a1b5a62eb226210cee9be2d2948436400 25 July 2019, 02:44:22 UTC
7fea913 Wait for `shutdown` response in LSP tests Summary: Rather than read a certain number of expected requests from the language server in tests, simply wait for the shutdown message to be sent. This is useful in future commits where we add more meta-language commands (such as `$test/waitForResponse`) which consume responses, and therefore make the response count not a useful metric. Reviewed By: 2BitSalute Differential Revision: D16442120 fbshipit-source-id: a3473c885c46d0106e483c868d8b7ef03b4785ef 25 July 2019, 02:44:21 UTC
85c11b7 Don't split after case keyword Summary: We currently have an independent split here, but we don't indent the label expression, so breaking on that split has never looked good. We might as well not do it at all. Reviewed By: jewelpit Differential Revision: D16469175 fbshipit-source-id: 870f036ab715aa4ff0536cca80ed3ed97b9e2c7a 25 July 2019, 01:42:32 UTC
90c5c52 Fix `textDocument/definition` for buffers with unsaved changes Summary: Similar to {D16295624}, fix `textDocument/definition` to work with buffers with unsaved changes. Reviewed By: jewelpit Differential Revision: D16423641 fbshipit-source-id: eced1fa73401103fab818767803bb1af86c8992e 25 July 2019, 00:27:13 UTC
22d8480 Drop `telemetry/event` notifications in testing Summary: These seem a little bit non-deterministic. Although there appear to be generated deterministically, they're noisy and the rules for when they're generated aren't immediately obvious. In the previous commit, we add the `powered_by` field to JSONRPC responses and notifications, which is a much more direct and reliable way of determining which back-end served a request, rather than relying on the presence of these `telemetry/event` messages. Reviewed By: jewelpit Differential Revision: D16370667 fbshipit-source-id: 81dbaa3933e636d3703028af72198c9ff60a2bfc 25 July 2019, 00:27:11 UTC
387382b Add optional `powered_by` field to JSONRPC responses Summary: This is a non-standard extension to the JSONRPC protocol. It adds the `powered_by` field as an optional field to responses and notifications, which may be used for logging or as a diagnostic aid. This is useful for the serverless IDE to indicate which back-end a given request was served by. We call it `powered_by` in symmetry with the somewhat well-known `X-Powered-By` HTTP header. I did not find any existing extensions to JSONRPC to base this off of. Reviewed By: jewelpit Differential Revision: D16370668 fbshipit-source-id: a1eb1ff58ac0f8bb497a9acb49da04e6266d8572 25 July 2019, 00:27:10 UTC
7ba53b2 Add dune typecheck_like_types test Reviewed By: andrewjkennedy Differential Revision: D16468100 fbshipit-source-id: e479f422a9c692b53dcc5b6e521d93a627acdc22 24 July 2019, 23:54:46 UTC
6b612ea Log dynamic calls by type Summary: Replaced functionality of ForbidDynamicCalls with options based on callable type: - ForbidDynamicCallsToFunc - ForbidDynamicCallsToClsMeth - ForbidDynamicCallsToInstMeth - ForbidDynamicConstructs Behavior is the same as old option but narrowed to specific function type. Reviewed By: periodic1236, paulbiss Differential Revision: D16341560 fbshipit-source-id: 157b7e7dfec89aa13b65f455ec5bd655bf407b7c 24 July 2019, 23:00:58 UTC
b7eb142 Remove InstanceOf from AST Summary: As titled. This removes the `InstanceOf` expression node from the AST and fixes any downstream effects, such as integration tests. The next diff will remove it from the AAST. Reviewed By: vassilmladenov Differential Revision: D16429878 fbshipit-source-id: d660b3a3f00491a4622003cc25ed8d5fe4ad7ae0 24 July 2019, 21:42:52 UTC
51f2aa3 RFC: (Hack) Expose attributes on type alias through Facts Reviewed By: losvald Differential Revision: D16426910 fbshipit-source-id: f696982e38c37afad308b97205cf1f3fec2eafa5 24 July 2019, 21:24:12 UTC
aa97706 Add visibility and staticness checks for hh\dynamic_class_meth Reviewed By: ricklavoie Differential Revision: D16447903 fbshipit-source-id: a553908112911cc36ca5926f50ee79e3ccfb084b 24 July 2019, 20:41:31 UTC
cfc7dd6 Support self-referential DefLabels in pdce-inlining Summary: Originally I thought that we shouldn't get any self-referential DefLabels containing FramePtrs, so any instance of them would be a bug and we should assert. I now see how they can arise because of loops, so modify pdce-inlining to handle them. We should just ignore the self-referential portion of the DefLabel (there should always be a portion which isn't). Reviewed By: markw65 Differential Revision: D16456697 fbshipit-source-id: 86e80fbf71e3984c788ef0c3c54b4b19552e6593 24 July 2019, 20:20:12 UTC
6fcaeb7 Back out "fix Obj_get" Reviewed By: ljw1004 Differential Revision: D16460812 fbshipit-source-id: b343656d52ee7b0754ae5fe71b190ecf6f582f90 24 July 2019, 18:51:03 UTC
48560fe Remove --max-errors for typecheck/const_attribute/ Summary: Increased max-errors to 2 because later diffs moving val_kind checks to a tast_check move some errors later in the expect file, and the 'first error' changes for a few test cases. Reviewed By: kmeht Differential Revision: D16455964 fbshipit-source-id: 6d1c9ab5cb278ab4bfc1076af600e36e1ff405a7 24 July 2019, 18:40:58 UTC
6e3d468 Remove unused paths from nastCheck Summary: - Remove paths that are never used. - Increase clarity of scope of last check. - Don't spend time traversing code that will not throw errors. Reviewed By: kmeht Differential Revision: D16436668 fbshipit-source-id: 340bfcb0f93342fbc6680a265e91dff8eca1795b 24 July 2019, 17:40:20 UTC
c2ad8e1 Support type aliases Summary: Generate code for dependencides on type aliases Reviewed By: CatherineGasnier Differential Revision: D16286052 fbshipit-source-id: 292b0e5ba64693e76530f78cba6ee95989be07ac 24 July 2019, 17:33:10 UTC
83581d4 Generate function declaration based on Typing_defs.fun_type Summary: When a function which we want to extract calls another function, we need to get the latter function's declaration. We used to just read it from the file where the function is declared, which is not efficient. This commit introduces generating the declaration based on Typing_defs.fun_type. Reviewed By: andrewjkennedy Differential Revision: D16261224 fbshipit-source-id: b68b1eb3aef6a4326634876ddbba185b1d1e563b 24 July 2019, 17:33:09 UTC
3cb145b Support dependencies on generic classes Summary: Generate correct code when the passed function has dependencies on generic classes or functions. Reviewed By: andrewjkennedy Differential Revision: D16261218 fbshipit-source-id: a49629b8ceeb0aa660128dc1a348386c1023708b 24 July 2019, 17:33:08 UTC
31d269c Add EntryPoints to some more unit tests. Reviewed By: WizKid Differential Revision: D16422302 fbshipit-source-id: e5cb358040fc86e0ed41e65f87e3230d52b95256 24 July 2019, 17:00:33 UTC
1fd54e4 Use labelled file functions Summary: As suggested by Waleed Khan we would like to use the labelled file functions for highlight. This reuses code that would otherwise be duplicated. Reviewed By: arxanas Differential Revision: D16450224 fbshipit-source-id: dca87548376d9e7e6d5796eda1e3a790989fdd10 24 July 2019, 16:17:54 UTC
7de1b0b Added hh_rewrite_declarations binary Summary: Added hh_rewrite_declarations binary, its [logic](https://fb.quip.com/A6bDAAHD5Y01) and some tests. The purpose of this is to be used in tandem with the hack kernel for Bento (D16417320). This approach will probably be modified soon, such that fb_intercept will be used instead! Reviewed By: arun11111 Differential Revision: D16438624 fbshipit-source-id: a7a607725b407db7c2335e5df63863833dad3da6 24 July 2019, 15:33:25 UTC
894889c Remove horrible XHP attribute file mode hack Summary: This hack was added in 2014, and caused us to check XHP files in partial mode for two months. Reviewed By: DavidSnider Differential Revision: D16455965 fbshipit-source-id: 1a9941fd182f8dc4e7e900f363c2e8031eefa2f3 24 July 2019, 07:33:43 UTC
bb71e1b Reset original file mode after gross XHP attribute hack Summary: We added this hack in 2014 to temporarily switch to partial mode for XHP attributes because they didn't support type params or something (D1681272). But, we never switched it back, which was okay, because we discarded the env. But over time, refactorings let the env escape that expression, and finally in D15413998, it escaped the function—meaning that any file containing XHP with attributes were being checked in partial mode after the first attribute. This is a quick fix to restore previous behavior, while the followup diff removes the behavior entirely. We should probably kill `Typing_env.set_mode` with fire. Reviewed By: DavidSnider Differential Revision: D16455881 fbshipit-source-id: d390b57553cc3f8e1a556874e2e8cf78e4d34a12 24 July 2019, 06:56:18 UTC
3a6dc2b Add option to call layoutBlocks before estimating inlining vasm cost Summary: The inliner now uses different weights for blocks depending on whether they're in main/cold/frozen in order to estimate the inlining cost. In this scenario, it makes sense to run layoutBlocks() to repartition the blocks into hot/cold based on profiling data. This diff adds an option for this, but it leaves it off by default for now. Reviewed By: jano Differential Revision: D16451977 fbshipit-source-id: 54fb2a343821e4d47f01c4648016350d2afa2751 24 July 2019, 06:05:52 UTC
e55736e Disable writing to static const props in typechecker Summary: - Disallowed static props from being written to in typechecker if they are constant. - ```Valkind``` is a useful field threaded through typing.ml. It is also used in checking whether we are trying to access a const instance prop. - I propagated it through to check class_get as well. It may be cleaner to pull out the ```write const``` checks out of typing.ml. - This diffs at the logic for checking if a static const prop is an lval. Reviewed By: vassilmladenov Differential Revision: D16427450 fbshipit-source-id: 5acb03ae2dc401298938c380d98bfa5723885ab1 24 July 2019, 03:34:08 UTC
f7cd1b3 Disable a test after adding EntryPoint which triggers a SEGV. Reviewed By: jano Differential Revision: D16422616 fbshipit-source-id: e7fea147c1009ec9c102a1267e9a3ac242c5911c 24 July 2019, 02:44:28 UTC
12a8fd9 Profile config option: duration threshold Summary: In preparation for the next diff, adding the option to make typing check profile logger duration threshold configurable. Reviewed By: jewelpit, ljw1004 Differential Revision: D16400388 fbshipit-source-id: 73f4b03dcddfc15df60fb9b704b31828a4b6e9e9 24 July 2019, 02:24:45 UTC
403b347 Remove .like_types.exp for deleted tests Summary: ``` cd hphp/hack/test/typecheck find -name '*.php.like_types.exp' | while read ltexp; do php=${ltexp%".like_types.exp"}; exp="$php.exp"; if [ ! -f $exp ]; then hg rm $ltexp; fi done ``` Reviewed By: Matt-Schellhas Differential Revision: D16448339 fbshipit-source-id: 81974a8120f69f1e40ec5215f004fd763b9f2323 23 July 2019, 23:47:26 UTC
4f8e6b4 Simplify resolve_ty Summary: The "resolve_ty" function is slow because it calls `localize_with_self` for every result. We can get mostly good enough results if we avoid this localize call, and the performance benefits are significant. For a large result set using one commonly used class with 1,290 class elements, it takes > 4 seconds to process 1,290 results through resolve_ty. After this change it takes 18 milliseconds. What changes as a result of not localizing results? - Mostly, the impact is on generic functions. The generic parameters and generic return values are no longer localized, which means that you can see generic types appear. An example: ``` class C { public function test(): C::Z { ... } public function myfunc(): void { $x = new C(); $x->AUTO332 ``` When autocomplete runs on the the above snippet, C->test() is one of the possible results. The function signature of C->test() appears as `test (function(): _)` if the ty is localized, and `test (function(): C::Z)` without localization. I see no reason to strongly prefer one over the other. Reviewed By: ljw1004 Differential Revision: D16442469 fbshipit-source-id: ee32e125aa7cbce5e8dcf81e34257f9b30e7b094 23 July 2019, 23:25:43 UTC
c8b4945 Break mutual recursion: solver Summary: Second diff that removes ref hacks for mutual recursion. This time, move "solve" functionality out of `Typing_subtype` into a new module `Typing_solver`. The presence of `is_sub_type` and `non_null` in this module isn't entirely satisfactory, so some more refactoring in a subsequent diff is likely. Reviewed By: CatherineGasnier Differential Revision: D16438886 fbshipit-source-id: 7bfa6fbba4e442e639602fe714f27ece348ea5b9 23 July 2019, 23:19:25 UTC
c4eb39d Break mutual recursion: sub_string Summary: This is the first diff in a series, killing the `ref` hack used in `Typing_utils` to avoid mutual recursion between modules that implement subtyping-related functionality. Reviewed By: vassilmladenov Differential Revision: D16438629 fbshipit-source-id: 09e3202fa1477a55ab7f05de7e66d2623b31ae85 23 July 2019, 23:19:24 UTC
059cc43 Add/fix EntryPoints in some tests. Reviewed By: WizKid Differential Revision: D16414862 fbshipit-source-id: 3a969cf24defa3c2aa746cc29417cf74a465a3ec 23 July 2019, 22:54:19 UTC
5ab4920 Add EntryPoints to some more tests (tweaking expected backtraces). Reviewed By: WizKid Differential Revision: D16403316 fbshipit-source-id: 43d44a0de6bebd3cd3652af18ac0d041c5904537 23 July 2019, 22:54:19 UTC
c82d345 New inference: constraint-based async lambda Summary: Under the flag `--new-inference-lambda` Hack will check lambdas using constraint-based inference, generating fresh type variables for parameters and return type that aren't specified. Unfortunately, for async lambdas it leaves the return type as `Awaitable<_>` where `_` is the `Tany` type, instead of using `Awaitable<#1>` where `#1` is a fresh type variable. Fix is straightforward. Also added a test that unfortunately has to make use of `hh_show` to demonstrate that `Tany` is not used. Reviewed By: CatherineGasnier Differential Revision: D16442654 fbshipit-source-id: 2cd95163782d04fd62c7cc22ae100bad51a72ee2 23 July 2019, 22:42:44 UTC
back to top