Disallow ... without type in function typehints
[hiphop-php.git] / hphp / hack / test / typecheck / this_weird_error.php
blob38a4f154bcf000c0c5a7ce51931c8b7315e56ef4
1 <?hh // strict
2 /**
3 * Copyright (c) 2014, Facebook, Inc.
4 * All rights reserved.
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the "hack" directory of this source tree.
12 abstract class MyVector<T> {
13 abstract public function map<Tu>((function(T): Tu) $callback): MyVector<Tu>;
14 abstract public function at(int $k): T;
15 abstract public function isEmpty(): bool;
17 /* HH_FIXME[4110] */
18 static public function newVector(T $x): MyVector<T> {
23 class A {
24 public function getName(): string { return 'hello'; }
28 /**
29 * There was a weird bug in Typing_generic.rename, that was reproduced with
30 * this case. It had to do with variable renaming, and this test doesn't
31 * exercise much beyond that
33 class B {
34 public function foo(MyVector<A> $a_vector): void {
35 $bars = $a_vector->map(function (A $x) { return MyVector::newVector($x); });
36 if (!$bars->isEmpty()) {
37 $bars->at(1)->at(1)->getName();