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:
Erling Ellingsen
2013-05-07 16:23:12 -07:00
commit de Sara Golemon
commit 1e78ff4999
5 arquivos alterados com 653 adições e 635 exclusões
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+12
Ver Arquivo
@@ -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
+1
Ver Arquivo
@@ -0,0 +1 @@
hphp_opts.hip_hop_syntax
+4 -2
Ver Arquivo
@@ -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 */