No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / this_genreadapi2.php
blob5288145fac604f611e17114bc71305c620b3bf17
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.
11 interface GenReadApi<Tk, +Tv> {}
13 class GenReadApiClass<Tk, +Tv> implements GenReadApi<Tk, Tv> {
14 public function __construct(private Tv $v) {}
17 class Foo {
18 public static function make<Tk>(): GenReadApi<Tk, mixed> {
19 return new GenReadApiClass(null);
23 final class Bar extends Foo {
24 public static function make<Tk>(): GenReadApi<Tk, this> {
25 return new GenReadApiClass(new static());
29 interface GenReadIdxApi<Tk, +Tv> {}
31 class GenReadIdxApiClass<Tk, +Tv> implements GenReadIdxApi<Tk, Tv> {
32 public function __construct(private Tv $v) {}
35 class FooIdx {
36 public static function make<Tk>(): GenReadIdxApi<Tk, mixed> {
37 return new GenReadIdxApiClass(null);
41 <<__ConsistentConstruct>>
42 class BarIdx extends FooIdx {
43 public static function make<Tk>(): GenReadIdxApi<Tk, this> {
44 return new GenReadIdxApiClass(new static());