language
stringlengths 0
24
| filename
stringlengths 9
214
| code
stringlengths 99
9.93M
|
---|---|---|
Python | hhvm/hphp/hack/test/hh_fanout/hh_fanout_integration_tests.py | #!/usr/bin/env python3
# pyre-strict
import os.path
import tempfile
from typing import cast, List, Tuple
from hh_fanout_test_driver import (
Env,
generate_saved_state,
Path,
run_hh_fanout,
SavedStateInfo,
)
from libfb.py.testutil import BaseFacebookTestCase
class TestHhFanout(BaseFacebookTestCase):
@property
def hh_fanout_path(self) -> str:
return os.environ["HH_FANOUT"]
@property
def hh_server_path(self) -> str:
return os.environ["HH_SERVER"]
def set_up_work_dir(self, root_dir: Path) -> Tuple[Env, SavedStateInfo]:
with open(os.path.join(root_dir, ".hhconfig"), "w") as f:
f.write("")
env = Env(
root_dir=root_dir,
hh_fanout_path=self.hh_fanout_path,
hh_server_path=self.hh_server_path,
)
saved_state_info = generate_saved_state(env, target_dir=root_dir)
return (env, saved_state_info)
def write(self, path: Path, contents: str) -> None:
with open(path, "w") as f:
f.write(contents)
def delete(self, path: Path) -> None:
os.unlink(path)
def test_deleted_file(self) -> None:
work_dir: str
with tempfile.TemporaryDirectory() as work_dir:
def file(path: Path) -> Path:
return os.path.join(work_dir, path)
self.write(
file("foo.php"),
"""<?hh
function foo(): void {}
""",
)
self.write(
file("deleted.php"),
"""<?hh
function deleted(): void {
foo();
}
""",
)
(env, saved_state_info) = self.set_up_work_dir(work_dir)
self.delete(file("deleted.php"))
result = run_hh_fanout(
env=env,
saved_state_info=saved_state_info,
changed_files=[file("deleted.php")],
args=[file("foo.php")],
cursor=None,
)
result_files = cast(List[str], result["files"])
self.assertSetEqual(set(result_files), {file("foo.php")})
def test_filter_hack_files(self) -> None:
work_dir: str
with tempfile.TemporaryDirectory() as work_dir:
def file(path: Path) -> Path:
return os.path.join(work_dir, path)
(env, saved_state_info) = self.set_up_work_dir(work_dir)
self.write(
file("foo.json"),
"""
{"changes":["/foo/bar.php",
"saved-state.json"],
"corresponding_base_revision":"-1",
"state":"hh_mini_saved_state",
"deptable":"hh_mini_saved_state.sql"}
""",
)
self.write(
file("foo.php"),
"""<?hh
function foo(): void {}
""",
)
result = run_hh_fanout(
env=env,
saved_state_info=saved_state_info,
changed_files=[file("foo.json"), file("foo.php")],
args=[file("foo.json"), file("foo.php")],
cursor=None,
)
result_files = cast(List[str], result["files"])
self.assertEqual(set(result_files), {file("foo.php")}) |
Python | hhvm/hphp/hack/test/hh_fanout/hh_fanout_test_driver.py | #!/usr/bin/env python3
# pyre-strict
"""Test driver for the fanout service.
The fanout service answers the question "given these changed symbols, which
files need to be re-typechecked"?
The test cases are in files called `test.txt` in the subdirectories of this
directory. They are written in a small DSL (detailed later in this file).
Additionally, we perform the sanity check that the list of typechecking
errors produced from a full typecheck is the same as for an incremental
typecheck.
"""
import argparse
import glob
import json
import os
import os.path
import pprint
import shutil
import subprocess
import sys
import tempfile
import textwrap
from dataclasses import dataclass
from typing import cast, Dict, List, Optional
DEBUGGING = False
Path = str
Cursor = str
def log(message: str) -> None:
sys.stderr.write(message)
sys.stderr.write("\n")
def copy(source: Path, dest: Path) -> None:
log(f"Copying {source} to {dest}")
shutil.copy(source, dest)
DEFAULT_EXEC_ENV = {
# Local configuration may be different on local vs. CI machines, so just
# don't use one for test runs.
"HH_LOCALCONF_PATH": "/tmp/nonexistent"
}
def exec(args: List[str], *, raise_on_error: bool = True) -> str:
command_line = " ".join(args)
log(f"Running: {command_line}")
result = subprocess.run(
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=DEFAULT_EXEC_ENV
)
stdout = result.stdout.decode()
if raise_on_error and result.returncode != 0:
# stderr is pretty noisy ordinarily, and causes the logs to be
# truncated with its length, so only surface it in cases of error.
stderr = result.stderr.decode()
raise RuntimeError(
f"Command {command_line} failed with return code {result.returncode}.\n"
+ f"Stdout: {stdout}\n"
+ f"Stderr: {stderr}\n"
)
elif DEBUGGING:
stderr = result.stderr.decode()
log(f"Stderr: {stderr}")
return stdout
@dataclass
class Env:
root_dir: Path
hh_fanout_path: Path
hh_server_path: Path
@dataclass
class SavedStateInfo:
dep_table_path: Path
naming_table_path: Path
def generate_saved_state(env: Env, target_dir: Path) -> SavedStateInfo:
saved_state_path = os.path.join(target_dir, "dep_table")
# saved_state_path is the naming table file generated by --save-state;
# implicitly other files (e.g. saved_state_path.err for errors,
# saved_state_path.hhdg) get placed adjacent to it.
naming_table_path = os.path.join(target_dir, "naming_table.sqlite")
# naming_table_path is the sqlite naming table file generated by --save-naming
edges_dir = target_dir
# edges_dir - temporary directory used solely for generating depgraph
exec( # noqa P204
[
env.hh_server_path,
env.root_dir,
"--save-state",
saved_state_path,
"--gen-saved-ignore-type-errors",
"--save-64bit",
edges_dir,
]
)
exec( # noqa P204
[
env.hh_fanout_path,
"build",
"--edges-dir",
edges_dir,
"--output",
saved_state_path + ".hhdg",
]
)
# Used to force a lazy init, without reporting typechecking errors (which
# would otherwise cause the process to terminate with error).
lazy_init_args = ["--config", "lazy_init2=true", "--config", "lazy_parse=true"]
exec( # noqa P204
[
env.hh_server_path,
"--check",
env.root_dir,
"--save-naming",
naming_table_path,
*lazy_init_args,
]
)
return SavedStateInfo(
dep_table_path=saved_state_path + ".hhdg", naming_table_path=naming_table_path
)
def relativize_path(env: Env, path: str) -> str:
"""Convert an absolute path into a relative path for consistent test output."""
return os.path.relpath(path, env.root_dir)
def run_hh_fanout(
env: Env,
saved_state_info: SavedStateInfo,
changed_files: List[Path],
args: List[str],
cursor: Optional[str],
) -> Dict[str, object]:
common_args = []
common_args.extend(("--from", "integration-test"))
common_args.extend(("--root", env.root_dir))
common_args.extend(("--detail-level", "high"))
common_args.extend(("--naming-table-path", saved_state_info.naming_table_path))
common_args.extend(("--dep-table-path", saved_state_info.dep_table_path))
common_args.extend(("--state-path", os.path.join(env.root_dir, "hh_fanout_state")))
for changed_file in changed_files:
common_args.extend(("--changed-file", changed_file))
hh_fanout_args = list(common_args)
if cursor is not None:
hh_fanout_args.extend(["--cursor", cursor])
result = exec( # noqa P204
[env.hh_fanout_path, "calculate", *hh_fanout_args, *args]
)
result = json.loads(result)
# Also include the debug output for when the test cases fail and need to be
# debugged.
if len(args) == 1:
debug_result = exec( # noqa P204
[env.hh_fanout_path, "debug", *common_args, *args]
)
debug_result = json.loads(debug_result)
result["debug"] = debug_result["debug"]
return result
def run_hh_fanout_status(env: Env, cursor: Cursor) -> str:
args = []
args.extend(("--from", "integration-test"))
args.extend(("--root", env.root_dir))
args.extend(("--state-path", os.path.join(env.root_dir, "hh_fanout_state")))
args.extend(("--cursor", cursor))
result = exec([env.hh_fanout_path, "status", *args]) # noqa P204
result = result.replace(env.root_dir, "")
result = result.strip()
return result
def sanitize_hh_fanout_result(env: Env, result: Dict[str, object]) -> None:
result["files"] = [
relativize_path(env, path) for path in cast(List[str], result["files"])
]
cursor = cast(Cursor, result["cursor"])
delimiter = ","
assert delimiter in cursor
parts = cursor.split(delimiter)
parts[-1] = "<hash-redacted-for-test>"
result["cursor"] = delimiter.join(parts)
if "telemetry" in result:
result["telemetry"] = "<telemetry-redacted-for-test>"
def run_fanout_test(
env: Env,
saved_state_info: SavedStateInfo,
args: List[Path],
changed_files: List[Path],
cursor: Optional[Cursor],
) -> Cursor:
result = run_hh_fanout(
env=env,
saved_state_info=saved_state_info,
changed_files=changed_files,
args=args,
cursor=cursor,
)
cursor = cast(Cursor, result["cursor"])
sanitize_hh_fanout_result(env, result)
pprint.pprint(result)
return cursor
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("test_path", type=os.path.abspath)
parser.add_argument("--hh-fanout", type=os.path.abspath)
parser.add_argument("--hh-server", type=os.path.abspath)
args = parser.parse_args()
source_dir = os.path.dirname(args.test_path)
with tempfile.TemporaryDirectory() as work_dir:
with open(os.path.join(work_dir, ".hhconfig"), "w") as f:
f.write("")
for source_file in glob.glob(os.path.join(source_dir, "*.php")):
copy(source_file, work_dir)
env = Env(
root_dir=work_dir,
hh_fanout_path=args.hh_fanout,
hh_server_path=args.hh_server,
)
with open(args.test_path) as f:
test_commands = f.readlines()
saved_state_info: Optional[SavedStateInfo] = None
is_first = True
changed_files: List[Path] = []
cursor: Optional[Cursor] = None
i = -1
while i + 1 < len(test_commands):
i += 1
test_command = test_commands[i]
test_command = test_command.strip()
if test_command.startswith("#") or test_command == "":
continue
[command, *command_args] = test_command.split()
# `write` writes the given file contents to disk, and queues it up
# as a "changed file" for the next `calculate-fanout` query.
if command == "write":
content_lines = []
while i + 1 < len(test_commands) and test_commands[i + 1][0].isspace():
content_lines.append(test_commands[i + 1])
i += 1
# Note that the lines already have `\n` at their ends, no need
# to add newlines.
content = "".join(content_line for content_line in content_lines)
content = textwrap.dedent(content)
[target_filename] = command_args
target_path = os.path.join(work_dir, target_filename)
changed_files.append(target_path)
with open(target_path, "w") as f:
f.write(content)
# `generate-saved-state` generates a saved-state for use in
# subsequent commands. Can only be called once.
elif command == "generate-saved-state":
assert (
saved_state_info is None
), "Cannot call `generate-saved-state` more than once"
saved_state_info = generate_saved_state(env, work_dir)
changed_files = []
# `calculate-fanout` calculates the fanout for the arguments and
# prints it to the test output for comparison against the `.exp`
# file.
elif command == "calculate-fanout":
if is_first:
is_first = False
else:
print()
print(f"Fanout calculation on line {i + 1}")
assert (
saved_state_info is not None
), f"Must call `generate-saved-state` before `calculate-fanout` on line {i + 1}"
cursor = run_fanout_test(
env=env,
saved_state_info=saved_state_info,
args=command_args,
changed_files=changed_files,
cursor=cursor,
)
changed_files = []
else:
raise ValueError(f"Unrecognized test command: {command}")
if DEBUGGING:
debug_dir = "/tmp/hh_fanout_debug"
shutil.rmtree(debug_dir, ignore_errors=True)
shutil.copytree(work_dir, debug_dir)
sys.stderr.write(
"DEBUGGING is enabled. "
+ f"You can examine the saved states at: {debug_dir}\n"
)
if __name__ == "__main__":
main() |
Text | hhvm/hphp/hack/test/hh_fanout/inferred_dep/test.txt | write foo.php
<?hh
class Foo {
public function getSomething(): Bar {
throw new Exception('not implemented');
}
}
write bar.php
<?hh
class Bar {
public function someMethod(): int {
return 3;
}
}
write baz.php
<?hh
class Baz {
public function someMethod(): string {
return 'baz';
}
}
write uses_foo.php
<?hh
function uses_foo(): int {
$foo = new Foo();
// There's an implicit dependency here that only arises from the definition
// of `Foo::getSomething`.
//
// We don't change the contents of this file, and yet, when the definition
// of `Foo` changes, the dependencies of this file can change!
$something = $foo->getSomething();
// Will return `int` at the saved-state, but `string` after the change
// after the saved-state.
return $something->someMethod();
}
generate-saved-state
calculate-fanout foo.php |
Text | hhvm/hphp/hack/test/hh_fanout/new_file/test.txt | write new_file.php
<?hh
// No symbols in this file at the moment.
generate-saved-state
calculate-fanout new_file.php |
Text | hhvm/hphp/hack/test/hh_fanout/simple/test.txt | write simple.php
<?hh
class Simple {}
write unrelated.php
<?hh
function unrelated(): void {}
write uses_simple.php
<?hh
function uses_simple(Simple $_): void {}
generate-saved-state
calculate-fanout simple.php |
OCaml | hhvm/hphp/hack/test/hh_oxidize/attrs.ml | type a = {
x: x; [@opaque] [@visitors.opaque]
y: y; [@visitors.opaque]
}
[@@deriving eq, show, visitors { variety = "iter" }] |
OCaml | hhvm/hphp/hack/test/hh_oxidize/by_ref_enum.ml | type x =
| A of int option
| B of bool
| C of float
| D of int ref
| E of string
| F of string * string |
OCaml | hhvm/hphp/hack/test/hh_oxidize/by_ref_recursion.ml | type int_list =
| Nil
| Cons of int * int_list
type 'a n_ary_tree =
| Leaf of 'a
| Children of 'a n_ary_tree list |
OCaml | hhvm/hphp/hack/test/hh_oxidize/doc_comment.ml | (** Type A *)
type a = int
(** Type B
* is int
*)
type b = int
(** Type C has a fenced code block:
*
* ```
* function f(): int {
* return 0;
* }
* ```
*
* And an unfenced code block:
*
* function g(): int {
* return 0;
* }
*
* They should stay indented.
*)
type c = int
(** Type D has no leading asterisks and a code block:
```
function f(): int {
return 0;
}
```
And an indented code block:
```
function g(): int {
return 0;
}
```
*)
type d = int
(** Records can have comments on the fields. *)
type record = {
foo: int;
(** The comments need to trail the field declaration in OCaml (unfortunately). *)
bar: int; (** bar comment *)
}
(** Variant types can have comments on each variant. *)
type variant =
| Foo
(** Again, the comments need to trail the variant declaration.
* Multiline comments are understood. *)
| Bar
(** Multiline comments do not need the leading asterisk on subsequent lines,
but it is removed when it is present. *) |
Text | hhvm/hphp/hack/test/hh_oxidize/extern_types.txt | # Import these types from foo
foo::bar::Bar
foo::baz::BazList # list of Baz
# And this type from qux_crate
qux_crate::qux::QuxList |
OCaml | hhvm/hphp/hack/test/hh_oxidize/field_prefixes.ml | type a = {
a_foo: int;
a_bar: int;
}
type b =
| X of {
x_foo: int;
x_bar: int;
}
| Y of {
y_foo: int;
y_bar: int;
} |
OCaml | hhvm/hphp/hack/test/hh_oxidize/recursion.ml | type int_list =
| Nil
| Cons of int * int_list
type 'a n_ary_tree =
| Leaf of 'a
| Children of 'a n_ary_tree list |
OCaml | hhvm/hphp/hack/test/hh_oxidize/variants.ml | type a =
| I
| J of int
| K of int * int
| L of (int * int)
| M of {
x: int;
y: int;
} |
PHP | hhvm/hphp/hack/test/highlight_refs/class.php | <?hh // strict
// Copyright 2004-present Facebook. All Rights Reserved.
function test(Foo $c) {
$x = new Foo();
}
class Foo {} |
PHP | hhvm/hphp/hack/test/highlight_refs/constructor.php | <?hh // strict
// Copyright 2004-present Facebook. All Rights Reserved.
class Box<T> {
public T $value;
public function __construct(T $v) {
$this->value = $v;
}
}
function foo():Box<int> {
$x = 3;
$y = new Box($x);
return $y;
} |
hhvm/hphp/hack/test/highlight_refs/dune | (rule
(alias highlight_refs)
(deps
%{exe:../../src/hh_single_type_check.exe}
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/review.sh
(glob_files %{project_root}/hack/test/highlight_refs/HH_FLAGS)
(glob_files %{project_root}/hack/test/highlight_refs/*.flags)
(glob_files %{project_root}/hack/test/highlight_refs/*.php)
(glob_files %{project_root}/hack/test/highlight_refs/*.exp))
(action
(run
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/highlight_refs
--program
%{exe:../../src/hh_single_type_check.exe})))
(alias
(name runtest)
(deps
(alias highlight_refs))) |
|
PHP | hhvm/hphp/hack/test/highlight_refs/global_const.php | <?hh // strict
// Copyright 2004-present Facebook. All Rights Reserved.
const FOO = "string"
function test() {
FOO;
} |
PHP | hhvm/hphp/hack/test/highlight_refs/method.php | <?hh // strict
class C {
public function foo(): void {}
}
class D extends C {}
class E {
public function foo(): void {}
}
function test(C $c, D $d, E $e): void {
$c->foo();
$d->foo();
$e->foo();
} |
PHP | hhvm/hphp/hack/test/highlight_refs/multiple_type.php | <?hh // strict
// Copyright 2004-present Facebook. All Rights Reserved.
class C1 {
public function foo() {}
}
class C2 {
public function foo() {}
}
function test(C1 $c1, C2 $c2, bool $b) {
if ($b) {
$x = $c1;
$x->foo();
} else {
$x = $c2;
$x->foo();
}
// this is both C1::foo() and C2::foo(), should hihglight both
$x->foo();
} |
PHP | hhvm/hphp/hack/test/holes/append_keyset.php | <?hh
function array_append_keyset(bool $x): void {
$xs = keyset[];
/* HH_FIXME[4324] */
$xs[] = $x;
}
function array_append_keyset_string_opt(?string $x): void {
$xs = keyset[];
/* HH_FIXME[4324] */
$xs[] = $x;
} |
PHP | hhvm/hphp/hack/test/holes/append_set.php | <?hh
function array_append_set(bool $x): void {
$xs = Set {};
/* HH_FIXME[4324] */
$xs[] = $x;
} |
PHP | hhvm/hphp/hack/test/holes/append_string_datetime.php | <?hh
function append_string_datetime(string $x, DateTime $y): string {
/* HH_FIXME[4414] */
return $x.$y;
} |
PHP | hhvm/hphp/hack/test/holes/array_access_read_object.php | <?hh
/* HH_FIXME[2084] */
function array_access_read_object(classname<_> $yolo) : void {
$x = new $yolo();
/* HH_FIXME[4005] */
$x[1];
} |
PHP | hhvm/hphp/hack/test/holes/array_access_write_intersection.php | <?hh
function array_access_write_intersection((arraykey & string) $xs): void {
/* HH_FIXME[4110] */
$xs[0] = 1;
}
function array_access_write_intersection_empty((arraykey & int) $xs): void {
/* HH_FIXME[4110] */
/* HH_FIXME[4370] */
$xs[0] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/array_access_write_object.php | <?hh
/* HH_FIXME[2084] */
function array_access_write_object(classname<_> $yolo): void {
$obj = new $yolo();
/* HH_FIXME[4370] */
$obj[1] = true;
} |
PHP | hhvm/hphp/hack/test/holes/array_access_write_union.php | <?hh
function array_access_write_union_vector((bool | Vector<string>) $xs): void {
/* HH_FIXME[4370] */
/* HH_FIXME[4110] */
($xs)[0] = 1;
}
function array_access_write_union_vec((bool | vec<string>) $xs): void {
/* HH_FIXME[4370] */
/* HH_FIXME[4110] */
$xs[0] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/array_append_object.php | <?hh
/* HH_FIXME[2084] */
function array_append_object(classname<_> $yolo): void {
$obj = new $yolo();
/* HH_FIXME[4006] */
$obj[] = true;
} |
PHP | hhvm/hphp/hack/test/holes/array_append_union.php | <?hh
function array_append_union_vector((bool | Vector<string>) $xs): void {
/* HH_FIXME[4370] */
/* HH_FIXME[4006] */
/* HH_FIXME[4110] */
($xs)[] = 1;
}
function array_append_union_vec((bool | vec<string>) $xs): void {
/* HH_FIXME[4370] */
/* HH_FIXME[4006] */
/* HH_FIXME[4110] */
($xs)[] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/array_const_mutation_immvector.php | <?hh
function array_const_mutation_immvector(ImmVector<int> $x) : void {
/* HH_FIXME[4011] */
$x[false] = 1.0;
} |
PHP | hhvm/hphp/hack/test/holes/array_const_mutation_keyedcontainer.php | <?hh
function array_const_mutation_keyedcontainer(KeyedContainer<arraykey,int> $x) : void {
/* HH_FIXME[4011] */
$x[1] = 2;
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_dict.php | <?hh
function array_get_index_dict(mixed $idx): void {
$xs = dict[];
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_immvector.php | <?hh
function array_get_index_immvector(ImmVector<int> $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_keyed_container.php | <?hh
function array_get_index_keyed_container(
KeyedContainer<string, int> $xs,
mixed $idx,
): void {
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_keyset.php | <?hh
function array_get_index_keyset(mixed $idx): void {
$xs = keyset[];
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_map.php | <?hh
function array_get_index_map_nothing(mixed $idx): void {
$xs = Map {};
/* HH_FIXME[4298] */
/* HH_FIXME[4324] */
$xs[$idx];
}
function array_get_index_map_string(Map<string,int> $xs, mixed $idx): void {
/* HH_FIXME[4298] */
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_pair.php | <?hh
function array_get_index_pair(Pair<string, int> $xs, mixed $idx): void {
/* HH_FIXME[4116] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_string.php | <?hh
function array_get_index_string(string $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_tuple.php | <?hh
function array_get_index_tuple((string, int) $xs, mixed $idx): void {
/* HH_FIXME[4116] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_varray.php | <?hh
function array_get_index_varray(varray<int> $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_vec.php | <?hh
function array_get_index_vec(vec<int> $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/array_get_index_vector.php | <?hh
function array_get_index_vector(Vector<int> $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx];
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_append_intersection.php | <?hh
function assign_array_append_intersection((int & string) $x, Vector<(int & float)> $xs) : void {
/* HH_FIXME[4110] */
$xs[] = $x;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_append_set.php | <?hh
function assign_array_append_set(Set<arraykey> $xs) : void {
/* HH_FIXME[4324] */
$xs[] = false;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_append_union.php | <?hh
function assign_array_append_union((int|string) $x, Vector<(int|bool)> $xs) : void {
/* HH_FIXME[4110] */
$xs[] = $x;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_append_vector.php | <?hh
function assign_array_append_vector(Vector<arraykey> $xs) : void {
/* HH_FIXME[4110] */
$xs[] = false;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_index_dict.php | <?hh
function assign_array_get_index_dict(mixed $idx): void {
$xs = dict[];
/* HH_FIXME[4371] */
$xs[$idx] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_index_map.php | <?hh
function assign_array_get_index_map(mixed $idx): void {
$xs = Map {};
/* HH_FIXME[4371] */
$xs[$idx] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_index_string.php | <?hh
function assign_array_get_index_string(string $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx] = "a";
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_index_tuple.php | <?hh
function assign_array_get_index_tuple((string, int) $xs, mixed $idx): void {
/* HH_FIXME[4116] */
$xs[$idx] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_index_varray.php | <?hh
function assign_array_get_index_varray(varray<int> $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_index_vec.php | <?hh
function assign_array_get_index_vec(vec<int> $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_index_vector.php | <?hh
function assign_array_get_index_vector(Vector<int> $xs, mixed $idx): void {
/* HH_FIXME[4324] */
$xs[$idx] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_map.php | <?hh
function assign_array_get_map(Map<int,string> $xs) : void {
/* HH_FIXME[4110] */
$xs[0] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_union.php | <?hh
function assign_array_get_union((int|string) $x, Vector<(int|bool)> $xs) : void {
/* HH_FIXME[4110] */
$xs[0] = $x;
} |
PHP | hhvm/hphp/hack/test/holes/assign_array_get_vector.php | <?hh
function assign_array_get_vector(Vector<string> $xs) : void {
/* HH_FIXME[4110] */
$xs[0] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/assign_class_get.php | <?hh
class C {
private static int $prop = 0;
private static ?int $nullable_prop = null;
private static (int, string) $pair_prop = tuple(0, '');
private static Vector<string> $vec_prop = Vector {};
public function set_prop(string $x): void {
/* HH_FIXME[4110] */
self::$prop = $x;
}
public function set_prop_intersect((bool & string) $x): void {
/* HH_FIXME[4110] */
self::$nullable_prop = $x;
}
public function set_prop_union((int | string) $x): void {
/* HH_FIXME[4110] */
self::$prop = $x;
}
public function set_pair_prop((int, bool) $x): void {
/* HH_FIXME[4110] */
self::$pair_prop = $x;
}
public function append_vec_prop(bool $x): void {
/* HH_FIXME[4110] */
self::$vec_prop[] = $x;
}
public function set_pair_prop_fst(bool $x): void {
/* HH_FIXME[4110] */
self::$pair_prop[0] = $x;
}
public function set_pair_prop_snd(bool $x): void {
/* HH_FIXME[4110] */
self::$pair_prop[1] = $x;
}
} |
PHP | hhvm/hphp/hack/test/holes/assign_list.php | <?hh
function __return_3_tuple(bool $x): (int, int, int) {
return tuple(1, 1, 1);
}
function __return_2_tuple(bool $x): (int, int) {
return tuple(1, 1);
}
function assign_list_ok(bool $x): void {
list($u, $v, $w) = __return_3_tuple($x);
}
function assign_list_bad(bool $x): void {
/* HH_FIXME[4110] */
list($u, $v, $w) = __return_2_tuple($x);
} |
PHP | hhvm/hphp/hack/test/holes/assign_obj_get.php | <?hh
class C {
public arraykey $prop = 0;
}
function assign_object_get(C $x) : void {
/* HH_FIXME[4110] */
$x->prop = false;
} |
PHP | hhvm/hphp/hack/test/holes/async_value_collection_lit.php | <?hh
async function async_get_an_int(): Awaitable<?int> {
return 1;
}
function take_a_set(Set<int> $x): void {}
async function async_value_collection_lit(): Awaitable<void> {
$x = await async_get_an_int();
/* HH_FIXME[4110] */
take_a_set(Set {$x});
} |
PHP | hhvm/hphp/hack/test/holes/bidirectional_bad.php | <?hh
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
final class C {
public function __construct(private dict<string, mixed> $spec) {}
}
function foo(dict<string, mixed> $xs): void {
$x = idx($xs, 'whatever');
if (HH\is_any_array($x)) {
/* HH_FIXME[4110] */
new C(dict($x));
}
}
function bar(dict<string, mixed> $xs): void {
$x = idx($xs, 'whatever');
if (HH\is_any_array($x)) {
$y = dict($x);
/* HH_FIXME[4110] */
new C($y);
}
} |
PHP | hhvm/hphp/hack/test/holes/call_collection.php | <?hh
class TestCollection{
public function l(Collection<int> $l): void {}
}
function l(Collection<int> $l): void {}
function call_collection(
Collection<string> $l,
): void {
/* HH_FIXME[4110] */
l($l);
$foo = new TestCollection();
/* HH_FIXME[4110] */
$foo->l($l);
}
function call_collection_cast(
Collection<string> $l,
): void {
/* HH_FIXME[4417] */
l(\HH\FIXME\UNSAFE_CAST<Collection<string>,Collection<int>>($l));
$foo = new TestCollection();
/* HH_FIXME[4417] */
$foo->l(\HH\FIXME\UNSAFE_CAST<Collection<string>,Collection<int>>($l));
} |
PHP | hhvm/hphp/hack/test/holes/call_dead_code.php | <?hh
function foo(int $x): void {}
function call_dead_code(): void {
$x = 1;
if (true) {
$x = 'string';
/* HH_FIXME[4110] */
foo($x);
} else {
$x = 'string';
foo($x);
}
}
function call_dead_code_cast(): void {
$x = 1;
if (true) {
$x = 'string';
/* HH_FIXME[4417] */
foo(\HH\FIXME\UNSAFE_CAST<string,int>($x));
} else {
$x = 'string';
foo($x);
}
} |
PHP | hhvm/hphp/hack/test/holes/call_dict.php | <?hh
class TestDict{
public function n(dict<int, int> $n): void {}
}
function n(dict<int, int> $n): void {}
function call_dict(
dict<string, int> $n1,
dict<int, string> $n2,
): void {
/* HH_FIXME[4110] */
n($n1);
/* HH_FIXME[4110] */
n($n2);
$foo = new TestDict();
/* HH_FIXME[4110] */
$foo->n($n1);
/* HH_FIXME[4110] */
$foo->n($n2);
}
function call_dict_cast(
dict<string, int> $n1,
dict<int, string> $n2,
): void {
/* HH_FIXME[4417] */
n(\HH\FIXME\UNSAFE_CAST<dict<string,int>,dict<int,int>>($n1));
/* HH_FIXME[4417] */
n(\HH\FIXME\UNSAFE_CAST<dict<int,string>,dict<int,int>>($n2));
$foo = new TestDict();
/* HH_FIXME[4417] */
$foo->n(\HH\FIXME\UNSAFE_CAST<dict<string,int>,dict<int,int>>($n1));
/* HH_FIXME[4417] */
$foo->n(\HH\FIXME\UNSAFE_CAST<dict<int,string>,dict<int,int>>($n2));
} |
PHP | hhvm/hphp/hack/test/holes/call_generic.php | <?hh
function generic_bounded<T as num>(T $x, T $y): void {}
function call_generic(int $x, string $y): void {
/* HH_FIXME[4323] */
generic_bounded($x, $y);
}
function call_generic_cast(int $x, string $y): void {
/* HH_FIXME[4417] */
generic_bounded($x, \HH\FIXME\UNSAFE_CAST<string,float>($y));
} |
PHP | hhvm/hphp/hack/test/holes/call_imm_set.php | <?hh
class TestImmSet{
public function j(ImmSet<int> $j): void {}
}
function j(ImmSet<int> $j): void {}
function call_imm_set(
ImmSet<string> $j,
): void {
/* HH_FIXME[4110] */
j($j);
$foo = new TestImmSet();
/* HH_FIXME[4110] */
$foo->j($j);
}
function call_imm_set_cast(
ImmSet<string> $j,
): void {
/* HH_FIXME[4417] */
j(\HH\FIXME\UNSAFE_CAST<ImmSet<string>,ImmSet<int>>($j));
$foo = new TestImmSet();
/* HH_FIXME[4417] */
$foo->j(\HH\FIXME\UNSAFE_CAST<ImmSet<string>,ImmSet<int>>($j));
} |
PHP | hhvm/hphp/hack/test/holes/call_imm_vector.php | <?hh
class TestImmVector{
public function k(ImmVector<int> $k): void {}
}
function k(ImmVector<int> $k): void {}
function call_immvector(
ImmVector<float> $k,
): void {
/* HH_FIXME[4110] */
k($k);
$foo = new TestImmVector();
/* HH_FIXME[4110] */
$foo->k($k);
}
function call_immvector_cast(
ImmVector<float> $k,
): void {
/* HH_FIXME[4417] */
k(\HH\FIXME\UNSAFE_CAST<ImmVector<float>,ImmVector<int>>($k));
$foo = new TestImmVector();
/* HH_FIXME[4417] */
$foo->k(\HH\FIXME\UNSAFE_CAST<ImmVector<float>,ImmVector<int>>($k));
} |
PHP | hhvm/hphp/hack/test/holes/call_inout.php | <?hh
function with_inout(inout int $i): void {}
function call_inout(float $f): void {
/* HH_FIXME[4110] */
with_inout(inout $f);
} |
PHP | hhvm/hphp/hack/test/holes/call_iterable.php | <?hh
class TestIterable{
public function m(Iterable<int> $m): void {}
}
function m(Iterable<int> $m): void {}
function call_iterable(
Iterable<float> $m,
): void {
/* HH_FIXME[4110] */
m($m);
$foo = new TestIterable();
/* HH_FIXME[4110] */
$foo->m($m);
}
function call_iterable_cast(
Iterable<float> $m,
): void {
/* HH_FIXME[4417] */
m(\HH\FIXME\UNSAFE_CAST<Iterable<float>,Iterable<int>>($m));
$foo = new TestIterable();
/* HH_FIXME[4417] */
$foo->m(\HH\FIXME\UNSAFE_CAST<Iterable<float>,Iterable<int>>($m));
} |
PHP | hhvm/hphp/hack/test/holes/call_keyed_traversable.php | <?hh
class TestKeyedTraversable{
public function o(KeyedTraversable<int, int> $o): void {}
}
function o(KeyedTraversable<int, int> $o): void {}
function call_keyed_traversable(
KeyedTraversable<string, int> $o1,
KeyedTraversable<int, string> $o2,
): void {
/* HH_FIXME[4110] */
o($o1);
/* HH_FIXME[4110] */
o($o2);
$foo = new TestKeyedTraversable();
/* HH_FIXME[4110] */
$foo->o($o1);
/* HH_FIXME[4110] */
$foo->o($o2);
}
function call_keyed_traversable_cast(
KeyedTraversable<string, int> $o1,
KeyedTraversable<int, string> $o2,
): void {
/* HH_FIXME[4417] */
o(\HH\FIXME\UNSAFE_CAST<KeyedTraversable<string,int>,KeyedTraversable<int,int>>($o1));
/* HH_FIXME[4417] */
o(\HH\FIXME\UNSAFE_CAST<KeyedTraversable<int,string>,KeyedTraversable<int,int>>($o2));
$foo = new TestKeyedTraversable();
/* HH_FIXME[4417] */
$foo->o(\HH\FIXME\UNSAFE_CAST<KeyedTraversable<string,int>,KeyedTraversable<int,int>>($o1));
/* HH_FIXME[4417] */
$foo->o(\HH\FIXME\UNSAFE_CAST<KeyedTraversable<int,string>,KeyedTraversable<int,int>>($o2));
} |
PHP | hhvm/hphp/hack/test/holes/call_keyset.php | <?hh
class TestKeyset{
public function f(keyset<int> $f): void {}
}
function f(keyset<int> $f): void {}
function call_keyset(
keyset<string> $f,
): void {
/* HH_FIXME[4110] */
f($f);
$foo = new TestKeyset();
/* HH_FIXME[4110] */
$foo->f($f);
}
function call_keyset_cast(
keyset<string> $f,
): void {
/* HH_FIXME[4417] */
f(\HH\FIXME\UNSAFE_CAST<keyset<string>,keyset<int>>($f));
$foo = new TestKeyset();
/* HH_FIXME[4417] */
$foo->f(\HH\FIXME\UNSAFE_CAST<keyset<string>,keyset<int>>($f));
} |
PHP | hhvm/hphp/hack/test/holes/call_pair.php | <?hh
class TestPair{
public function b(Pair<int, int> $b): void {}
}
function b(Pair<int, int> $b): void {}
function call_pair(
Pair<bool, int> $b1,
Pair<int, bool> $b2,
): void {
/* HH_FIXME[4110] */
b($b1);
/* HH_FIXME[4110] */
b($b2);
$foo = new TestPair();
/* HH_FIXME[4110] */
$foo->b($b1);
/* HH_FIXME[4110] */
$foo->b($b2);
}
function call_pair_cast(
Pair<bool, int> $b1,
Pair<int, bool> $b2,
): void {
/* HH_FIXME[4417] */
b(\HH\FIXME\UNSAFE_CAST<Pair<bool,int>,Pair<int,int>>($b1));
/* HH_FIXME[4417] */
b(\HH\FIXME\UNSAFE_CAST<Pair<int,bool>,Pair<int,int>>($b2));
$foo = new TestPair();
/* HH_FIXME[4417] */
$foo->b(\HH\FIXME\UNSAFE_CAST<Pair<bool,int>,Pair<int,int>>($b1));
/* HH_FIXME[4417] */
$foo->b(\HH\FIXME\UNSAFE_CAST<Pair<int,bool>,Pair<int,int>>($b2));
} |
PHP | hhvm/hphp/hack/test/holes/call_prim.php | <?hh
function prim(int $i): void {}
function call_prim(float $f, ?int $x): void {
/* HH_FIXME[4110] */
prim($f);
/* HH_FIXME[4110] */
prim($x);
}
function call_prim_cast(float $f, ?int $x): void {
/* HH_FIXME[4417] */
prim(\HH\FIXME\UNSAFE_CAST<float,int>($f));
/* HH_FIXME[4417] */
prim(\HH\FIXME\UNSAFE_CAST<?int,int>($x));
} |
PHP | hhvm/hphp/hack/test/holes/call_refinement.php | <?hh
function foo<T as ?Container<Tv>, Tv>(inout T $arr): dynamic {
return false;
}
function bar(): dynamic {
return varray[];
}
function qux<T as ?Container<Tv>, Tv>(T $arr): Tv {
throw new \Exception();
}
function call_refinement(): void {
$arr = bar();
/* HH_FIXME[4110] */
if (foo(inout $arr)) {
return;
}
$whatever = qux($arr);
} |
PHP | hhvm/hphp/hack/test/holes/call_set.php | <?hh
class TestSet{
public function h(Set<int> $h): void {}
}
function h(Set<int> $h): void {}
function call_set(
Set<string> $h,
): void {
/* HH_FIXME[4110] */
h($h);
$foo = new TestSet();
/* HH_FIXME[4110] */
$foo->h($h);
}
function call_set_cast(
Set<string> $h,
): void {
/* HH_FIXME[4417] */
h(\HH\FIXME\UNSAFE_CAST<Set<string>,Set<int>>($h));
$foo = new TestSet();
/* HH_FIXME[4417] */
$foo->h(\HH\FIXME\UNSAFE_CAST<Set<string>,Set<int>>($h));
} |
PHP | hhvm/hphp/hack/test/holes/call_traversable.php | <?hh
class TestTraversable{
public function i(Traversable<int> $i): void {}
}
function i(Traversable<int> $i): void {}
function call_traversable(
Traversable<float> $i,
): void {
/* HH_FIXME[4110] */
i($i);
$foo = new TestTraversable();
/* HH_FIXME[4110] */
$foo->i($i);
}
function call_traversable_cast(
Traversable<float> $i,
): void {
/* HH_FIXME[4417] */
i(\HH\FIXME\UNSAFE_CAST<Traversable<float>,Traversable<int>>($i));
$foo = new TestTraversable();
/* HH_FIXME[4417] */
$foo->i(\HH\FIXME\UNSAFE_CAST<Traversable<float>,Traversable<int>>($i));
} |
PHP | hhvm/hphp/hack/test/holes/call_tuple.php | <?hh
class TestTuple {
public function a((int, int) $a): void {}
}
function a((int, int) $a): void {}
function call_tuple(
(int, bool) $a1,
(bool, int) $a2,
): void {
/* HH_FIXME[4110] */
a($a1);
/* HH_FIXME[4110] */
a($a2);
$foo = new TestTuple();
/* HH_FIXME[4110] */
$foo->a($a1);
/* HH_FIXME[4110] */
$foo->a($a2);
}
function call_tuple_cast(
(int, bool) $a1,
(bool, int) $a2,
): void {
/* HH_FIXME[4417] */
a(\HH\FIXME\UNSAFE_CAST<(int,bool),(int,int)>($a1));
/* HH_FIXME[4417] */
a(\HH\FIXME\UNSAFE_CAST<(bool,int),(int,int)>($a2));
$foo = new TestTuple();
/* HH_FIXME[4417] */
$foo->a(\HH\FIXME\UNSAFE_CAST<(int,bool),(int,int)>($a1));
/* HH_FIXME[4417] */
$foo->a(\HH\FIXME\UNSAFE_CAST<(bool,int),(int,int)>($a2));
} |
PHP | hhvm/hphp/hack/test/holes/call_unpack.php | <?hh
function unpack_a(int $x, int ...$xs): void {}
function unpack_b(float $x, varray<int> $y, int ...$ys): void {}
function unpack_c(float $x, (float, int) $y, int ...$ys): void {}
function unpack_d(int $x, shape('u' => bool, 'v' => bool) $y): void {}
function unpack_e(
float $x,
(function(int, float): bool) $f,
int $y,
): void {}
function call_unpack(
Pair<int, float> $a,
(int, float, int, float, int, float) $b,
(float, varray<float>, float) $c,
(float, varray<int>, float, int) $d,
(float, int, float, float) $e,
shape('a' => float, 'b' => int, 'c' => int) $f,
(float, (float, float), int) $g,
(int, shape('u' => float, 'v' => int)) $h,
(float, (function(float, int): int), int) $i,
(float, (function(int, float): bool), int) $j,
): void {
/* HH_FIXME[4110] */
unpack_a(...$a);
/* HH_FIXME[4110] */
unpack_a(...$b);
/* HH_FIXME[4110] */
unpack_b(...$c);
/* HH_FIXME[4110] */
unpack_b(...$d);
/* HH_FIXME[4110] */
unpack_b(...$e);
/* HH_FIXME[4110] */
unpack_b(...$f);
/* HH_FIXME[4110] */
unpack_c(...$g);
/* HH_FIXME[4110] */
unpack_d(...$h);
/* HH_FIXME[4110] */
unpack_e(...$i);
} |
PHP | hhvm/hphp/hack/test/holes/call_variadic.php | <?hh
function variadic(int $x, float ...$xs): void {}
function call_variadic(int $x, float $y): void {
/* HH_FIXME[4110] */
variadic($x, $x);
/* HH_FIXME[4110] */
variadic($x, $y, $x);
/* HH_FIXME[4110] */
variadic($x, $x, $y);
/* HH_FIXME[4110] */
variadic($x, $x, $x);
} |
PHP | hhvm/hphp/hack/test/holes/call_varray.php | <?hh
class TestVarray{
public function c(varray<int> $c): void {}
}
function c(varray<int> $c): void {}
function call_varray(
varray<float> $c,
): void {
/* HH_FIXME[4110] */
c($c);
$foo = new TestVarray();
/* HH_FIXME[4110] */
$foo->c($c);
}
function call_varray_cast(
varray<float> $c,
): void {
/* HH_FIXME[4417] */
c(\HH\FIXME\UNSAFE_CAST<varray<float>,varray<int>>($c));
$foo = new TestVarray();
/* HH_FIXME[4417] */
$foo->c(\HH\FIXME\UNSAFE_CAST<varray<float>,varray<int>>($c));
} |
PHP | hhvm/hphp/hack/test/holes/call_varray_or_darray.php | <?hh
class TestVarrayOrDarray{
public function d(varray_or_darray<int> $d): void {}
}
function d(varray_or_darray<int> $d): void {}
function call_varray_or_darray(
varray_or_darray<float> $d,
): void {
/* HH_FIXME[4110] */
d($d);
$foo = new TestVarrayOrDarray();
/* HH_FIXME[4110] */
$foo->d($d);
}
function call_varray_or_darray_cast(
varray_or_darray<float> $d,
): void {
/* HH_FIXME[4417] */
d(\HH\FIXME\UNSAFE_CAST<varray_or_darray<float>,varray_or_darray<int>>($d));
$foo = new TestVarrayOrDarray();
/* HH_FIXME[4417] */
$foo->d(\HH\FIXME\UNSAFE_CAST<varray_or_darray<float>,varray_or_darray<int>>($d));
} |
PHP | hhvm/hphp/hack/test/holes/call_vec.php | <?hh
class TestVec{
public function e(vec<int> $e): void {}
}
function e(vec<int> $e): void {}
function call_vec(
vec<float> $e,
): void {
/* HH_FIXME[4110] */
e($e);
$foo = new TestVec();
/* HH_FIXME[4110] */
$foo->e($e);
}
function call_vec_cast(
vec<float> $e,
): void {
/* HH_FIXME[4417] */
e(\HH\FIXME\UNSAFE_CAST<vec<float>,vec<int>>($e));
$foo = new TestVec();
/* HH_FIXME[4417] */
$foo->e(\HH\FIXME\UNSAFE_CAST<vec<float>,vec<int>>($e));
} |
PHP | hhvm/hphp/hack/test/holes/call_vector.php | <?hh
class TestVector{
public function g(Vector<int> $g): void {}
}
function g(Vector<int> $g): void {}
function call_vector(
Vector<float> $g,
): void {
/* HH_FIXME[4110] */
g($g);
$foo = new TestVector();
/* HH_FIXME[4110] */
$foo->g($g);
}
function call_vector_cast(
Vector<float> $g,
): void {
/* HH_FIXME[4417] */
g(\HH\FIXME\UNSAFE_CAST<Vector<float>,Vector<int>>($g));
$foo = new TestVector();
/* HH_FIXME[4417] */
$foo->g(\HH\FIXME\UNSAFE_CAST<Vector<float>,Vector<int>>($g));
} |
PHP | hhvm/hphp/hack/test/holes/compound_assign_bitwise_and.php | <?hh
function compound_assign_bitwise_and(Vector<int> $xs) : void {
/* HH_FIXME[4423] */
$xs[0] &= 1.0;
} |
PHP | hhvm/hphp/hack/test/holes/compound_assign_div.php | <?hh
function compound_assign_div(Vector<int> $xs) : void {
/* HH_FIXME[4110] */
$xs[0] /= 1.0;
} |
PHP | hhvm/hphp/hack/test/holes/compound_assign_plus.php | <?hh
function compound_assign_plus(Vector<int> $xs) : void {
/* HH_FIXME[4110] */
$xs[0] += 1.0;
} |
PHP | hhvm/hphp/hack/test/holes/compound_assign_rshift.php | <?hh
function compound_assign_rshift(Vector<int> $xs) : void {
/* HH_FIXME[4423] */
$xs[0] >>= 1.0;
} |
PHP | hhvm/hphp/hack/test/holes/const_mutation_map.php | <?hh
function const_mutation_immmap(ImmMap<string,int> $x) : void {
/* HH_FIXME[4011] */
$x['a'] = 1;
}
function const_mutation_constmap(ConstMap<string,int> $x) : void {
/* HH_FIXME[4011] */
$x['a'] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/const_mutation_nothing.php | <?hh
function const_mutation_pair(Pair<string,int> $x) : void {
/* HH_FIXME[4011] */
$x[1] = 1;
}
function const_mutation_keyedcontainer(KeyedContainer<string,int> $x) : void {
/* HH_FIXME[4011] */
$x[1] = 1;
}
function const_mutation_anyarray(AnyArray<string,int> $x) : void {
/* HH_FIXME[4011] */
$x[1] = 1;
} |
PHP | hhvm/hphp/hack/test/holes/const_mutation_vector.php | <?hh
function const_mutation_immvector(ImmVector<int> $x) : void {
/* HH_FIXME[4011] */
$x[0] = 1;
}
function const_mutation_constvector(ConstVector<int> $x) : void {
/* HH_FIXME[4011] */
$x[0] = 1;
} |
hhvm/hphp/hack/test/holes/dune | (rule
(alias tast_holes)
(deps
%{exe:../../src/hh_single_type_check.exe}
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/review.sh
(glob_files %{project_root}/hack/test/holes/*.php)
(glob_files %{project_root}/hack/test/holes/*.php.holes.exp)
(glob_files %{project_root}/hack/test/holes/*.php.exp)
(glob_files %{project_root}/hack/test/holes/HH_FLAGS))
(action
(run
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/holes
--program
%{exe:../../src/hh_single_type_check.exe}
--in-extension
.php
--out-extension
.holes.out
--expect-extension
.holes.exp
--fallback-expect-extension
.exp
--flags
--enable-sound-dynamic-type
--everything-sdt
--tast
--error-format
plain)))
(alias
(name runtest)
(deps
(alias tast_holes))) |
|
PHP | hhvm/hphp/hack/test/holes/echo_non_arraykey.php | <?hh
function echo_non_arraykey(mixed $x, bool $y) : void {
/* HH_FIXME[4438] */
echo($x);
/* HH_FIXME[4438] */
echo($y);
} |
PHP | hhvm/hphp/hack/test/holes/expected_class.php | <?hh
function expected_class(string $class_name) : void {
/* HH_FIXME[4026] */
$x = new $class_name();
} |
PHP | hhvm/hphp/hack/test/holes/expected_class_intersection.php | <?hh
function expected_class_intersection((int & arraykey) $class_name) : void {
/* HH_FIXME[4026] */
$x = new $class_name();
} |
PHP | hhvm/hphp/hack/test/holes/expected_class_intersection_classname.php | <?hh
class C {}
function expected_class_intersection((string & classname<C>) $class_name) : void {
$x = new $class_name();
} |
PHP | hhvm/hphp/hack/test/holes/expected_class_union.php | <?hh
function expected_class_union((string | int) $class_name) : void {
/* HH_FIXME[4026] */
$x = new $class_name();
} |
PHP | hhvm/hphp/hack/test/holes/expected_class_union_classname.php | <?hh
class C {}
function expected_class_union_classname((int | classname<C>) $class_name) : void {
/* HH_FIXME[4026] */
$x = new $class_name();
} |
PHP | hhvm/hphp/hack/test/holes/expr_dependent.php | <?hh
abstract class WithTypeConstant {
abstract const type TX;
abstract public function gen(): this::TX;
abstract public function log(this::TX $x): void;
}
function my_gen<T as WithTypeConstant, TR>(T $left): TR where TR = T::TX {
return $left->gen();
}
function my_log<T as WithTypeConstant, TR>(T $left): (function(
TR,
): void) where TR = T::TX {
return (TR $x) ==> ($left->log($x));
}
function my_error(WithTypeConstant $x, WithTypeConstant $y): void {
$gen = my_gen($x);
$log = my_log($y);
/* HH_FIXME[4110] we need expression-dependent types for Hole reporting here
or we end up with `WithTypeConstant::TX` for both source and destination
type */
$log($gen);
} |
PHP | hhvm/hphp/hack/test/holes/foreach_async_non_traversable.php | <?hh
async function foreach_async_non_traversable(int $xs): Awaitable<void> {
/* HH_FIXME[4110] */
foreach ($xs await as $x) {
}
} |
PHP | hhvm/hphp/hack/test/holes/foreach_async_union_int_dynamic.php | <?hh
async function foreach_async_union_int_dynamic((int|dynamic) $xs): Awaitable<void> {
/* HH_FIXME[4110] */
foreach ($xs await as $x) {
}
} |
PHP | hhvm/hphp/hack/test/holes/foreach_kv_non_traversable.php | <?hh
function foreach_kv_non_traversable(int $xs): void {
/* HH_FIXME[4110] */
foreach ($xs as $k => $v) {
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.