Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make closure and soft type specifiers a parse error
Summary: These hints may never be used with `is`-expressions because: - We have no information on a function's inputs/output at runtime. - Soft typehints would be meaningless when testing types. Reviewed By: periodic1236, oulgen Differential Revision: D7076934 fbshipit-source-id: 42639d367cfa6a73b384098d6abf3796ad87b935
- Loading branch information
Showing
8 changed files
with
46 additions
and
1 deletion.
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
1 change: 1 addition & 0 deletions
1
hphp/hack/test/full_fidelity/cases/is_expression/test_callable_hint.exp
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 @@ | ||
(13,16)-(13,32) Callable typehints cannot be used with `is` expressions |
14 changes: 14 additions & 0 deletions
14
hphp/hack/test/full_fidelity/cases/is_expression/test_callable_hint.php
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,14 @@ | ||
<?hh | ||
/** | ||
* Copyright (c) 2014, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the "hack" directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
|
||
function test(mixed $e): bool { | ||
return $e is (function(): int); | ||
} |
1 change: 1 addition & 0 deletions
1
hphp/hack/test/full_fidelity/cases/is_expression/test_soft_hint.exp
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 @@ | ||
(13,16)-(13,19) Soft typehints cannot be used with `is` expressions |
14 changes: 14 additions & 0 deletions
14
hphp/hack/test/full_fidelity/cases/is_expression/test_soft_hint.php
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,14 @@ | ||
<?hh | ||
/** | ||
* Copyright (c) 2014, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the "hack" directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
|
||
function test(mixed $e): bool { | ||
return $e is @int; | ||
} |
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