-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for "HH\object" type constraint
Summary: Some builtins, such as spl_object_hash(), accept arbitrary objects. Expose ability to express that with a "HH\object" typehint that gets mapped to a newly introduced AnnotType::Object, which uses the AnnotMetaType::Precise. The new typehint is not yet used anywhere except of the added unit test, as "object" typehints are not automatically imported into the HH namespace. Reviewed By: mdko Differential Revision: D52018664 fbshipit-source-id: 4ce1a2be65967f223bf6a088c49bad56cc102894
- Loading branch information
1 parent
b0a378e
commit 93db8b6
Showing
8 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?hh | ||
|
||
function test(HH\object $obj) { | ||
var_dump(get_class($obj)); | ||
} | ||
|
||
<<__EntryPoint>> | ||
function main() { | ||
test(new stdClass()); | ||
test("invalid"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
string(8) "stdClass" | ||
|
||
Catchable fatal error: Argument 1 passed to test() must be an instance of HH\object, string given in %s on line 10 |