2 // Copyright 2004-present Facebook. All Rights Reserved.
4 interface MyWidget
<Tu
> {}
6 // Create a pair of unrelated types
8 class NotWidgetParent
{}
10 class MyWidgetA
implements MyWidget
<WidgetParent
> {}
11 class MyWidgetB
implements MyWidget
<NotWidgetParent
> {}
14 public function add
<T super WidgetParent
>(MyWidget
<T
> $task): void
{}
17 function test_hhvm_super(): void
{
18 $container = new MyContainer();
19 // So T = WidgetParent
20 $container->add(new MyWidgetA()); // this should pass the type checker
21 // So T = NotWidgetParent
22 $container->add(new MyWidgetB()); // this should be flagged as an error