Allow type aliases to take (ignored) type arguments
type Foo<T> = Bar<T,T> is treated as Foo = Bar; Foo<T> = @?T isn't supported.
Esse commit está contido em:
+634
-633
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +1,12 @@
|
||||
<?hh
|
||||
|
||||
type Foo<X> = string;
|
||||
|
||||
interface Dummy {}
|
||||
|
||||
function main(Foo<Dummy> $x) {
|
||||
echo "Hi\n";
|
||||
}
|
||||
|
||||
main('42');
|
||||
main(42);
|
||||
@@ -0,0 +1,2 @@
|
||||
Hi
|
||||
HipHop Fatal error: Argument 1 passed to main() must be an instance of Foo, int given in %s on line 9
|
||||
Link simbólico
+1
@@ -0,0 +1 @@
|
||||
hphp_opts.hip_hop_syntax
|
||||
@@ -2338,8 +2338,10 @@ class_constant:
|
||||
*/
|
||||
|
||||
sm_typedef_statement:
|
||||
T_TYPE ident '=' sm_type ';' { only_in_strict_mode(_p);
|
||||
_p->onTypedef($$, $2, $4); }
|
||||
T_TYPE sm_name_with_typevar
|
||||
'=' sm_type ';' { only_in_strict_mode(_p);
|
||||
_p->onTypedef($$, $2, $4);
|
||||
_p->popTypeScope(); }
|
||||
;
|
||||
|
||||
sm_name_with_type: /* foo -> int foo */
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário