-
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.
Summary: Repro bug T212089841 (unexpected like types in "Extract into method" refactor) A reliable way to reproduce this bug is to add an explicit like type to the return position of a function and call the function. Differential Revision: D68018235 fbshipit-source-id: a57e9c117723f9dc23ca9761fa2a5e753173808e
- Loading branch information
1 parent
3b5048b
commit 5688a90
Showing
5 changed files
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
--config everything_sdt=false | ||
--extra-builtin ../hhi/extraBuiltins.hhi |
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
13 changes: 13 additions & 0 deletions
13
hphp/hack/test/ide_code_actions/extract_method/extract_method_like_types_1.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,13 @@ | ||
<?hh | ||
|
||
class Klass { | ||
public async function foo(vec<int> $vec): Awaitable<void> { | ||
$y = ExtraBuiltins\genInt(); | ||
/*range-start*/ | ||
$x1 = $y; | ||
$x2 = ExtraBuiltins\genInt() | ||
/*range-end*/ | ||
echo $x1; | ||
echo await $x2; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
hphp/hack/test/ide_code_actions/extract_method/extract_method_like_types_1.php.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,48 @@ | ||
Code actions available: | ||
------------------------------------------ | ||
slog variable (CodeActionKind: refactor) | ||
Extract into method (CodeActionKind: refactor) SELECTED | ||
|
||
JSON for selected code action: | ||
------------------------------------------ | ||
{ | ||
"diagnostics":[], | ||
"edit":{ | ||
"changes":{ | ||
"FILE.php":[ | ||
{ | ||
"newText":" private function ${0:method0}(~Awaitable<int> $y): (~Awaitable<int>, ~Awaitable<int>) {\n $x1 = $y;\n $x2 = ExtraBuiltins\\genInt()\n return tuple($x1, $x2);\n }\n\n", | ||
"range":{"end":{"character":0,"line":3},"start":{"character":0,"line":3}} | ||
}, | ||
{ | ||
"newText":"list($x1, $x2) = $this->${0:method0}($y);", | ||
"range":{"end":{"character":32,"line":7},"start":{"character":4,"line":6}} | ||
} | ||
] | ||
} | ||
}, | ||
"kind":"refactor", | ||
"title":"Extract into method" | ||
} | ||
|
||
Applied edit for code action: | ||
------------------------------------------ | ||
<?hh | ||
|
||
class Klass { | ||
private function ${0:method0}(~Awaitable<int> $y): (~Awaitable<int>, ~Awaitable<int>) { | ||
$x1 = $y; | ||
$x2 = ExtraBuiltins\genInt() | ||
return tuple($x1, $x2); | ||
} | ||
|
||
public async function foo(vec<int> $vec): Awaitable<void> { | ||
$y = ExtraBuiltins\genInt(); | ||
/*range-start*/ | ||
list($x1, $x2) = $this->${0:method0}($y); | ||
/*range-end*/ | ||
echo $x1; | ||
echo await $x2; | ||
} | ||
} | ||
|
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 @@ | ||
namespace ExtraBuiltins; | ||
|
||
async function genInt(): ~Awaitable<int>; |