From: Jérémie Astor Date: Sun, 13 Sep 2020 20:49:19 +0000 (+0200) Subject: :art: Move templates to the right X-Git-Tag: nightly~1335 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=dd4b73a05f8ba8a1e08a41422d9a11a8db5338ba;p=gwion.git :art: Move templates to the right --- diff --git a/examples/implicit_ptr.gw b/examples/implicit_ptr.gw index da6d8d7b..d0dd5f5a 100644 --- a/examples/implicit_ptr.gw +++ b/examples/implicit_ptr.gw @@ -1,4 +1,4 @@ -fun void test(<~int~>Ptr p) { +fun void test(Ptr<~int~> p) { <<< *p >>>; } var int i => test; diff --git a/examples/ptr_assign.gw b/examples/ptr_assign.gw index c7fbc0e3..6ad53830 100644 --- a/examples/ptr_assign.gw +++ b/examples/ptr_assign.gw @@ -3,4 +3,4 @@ class C { class D extends C { } var D d; -d :=> var <~C~>Ptr pd; +d :=> var Ptr<~C~> pd; diff --git a/examples/ptr_cast.gw b/examples/ptr_cast.gw index 1d2e3ee9..7de28025 100644 --- a/examples/ptr_cast.gw +++ b/examples/ptr_cast.gw @@ -1,2 +1,2 @@ 12 => var int i; -<<Ptr >>>; +<< >>>; diff --git a/examples/ptr_deref.gw b/examples/ptr_deref.gw index e15694de..c13384e0 100644 --- a/examples/ptr_deref.gw +++ b/examples/ptr_deref.gw @@ -1,3 +1,3 @@ var int i; -i :=> var <~int~>Ptr pti; +i :=> var Ptr<~int~> pti; <<<12 => *pti, " ", *pti>>>; diff --git a/tests/error/empty_ptr.gw b/tests/error/empty_ptr.gw index 3a9e0a41..a6d90f3b 100644 --- a/tests/error/empty_ptr.gw +++ b/tests/error/empty_ptr.gw @@ -1,3 +1,3 @@ #! [contains] EmptyPointerException -var <~int~>Ptr t; +var Ptr<~int~> t; <<< *t >>>; diff --git a/tests/error/invalid_pointer_cast.gw b/tests/error/invalid_pointer_cast.gw index 1694e2b7..686f8e8f 100644 --- a/tests/error/invalid_pointer_cast.gw +++ b/tests/error/invalid_pointer_cast.gw @@ -1,2 +1,2 @@ #! [contains] invalid pointer cast -<<< 1 $ <~Object~>Ptr >>>; +<<< 1 $ Ptr<~Object~> >>>; diff --git a/tests/error/ptr_assign_const.gw b/tests/error/ptr_assign_const.gw index 8b75ba44..05eab60e 100644 --- a/tests/error/ptr_assign_const.gw +++ b/tests/error/ptr_assign_const.gw @@ -1 +1 @@ -1 :=> var <~int~>Ptr pd; +1 :=> var Ptr<~int~> pd; diff --git a/tests/error/ptr_assign_invalid.gw b/tests/error/ptr_assign_invalid.gw index d0ee84dc..7c37eeb6 100644 --- a/tests/error/ptr_assign_invalid.gw +++ b/tests/error/ptr_assign_invalid.gw @@ -3,4 +3,4 @@ class C {} class D extends C {} var D d; -d :=> var <~int~>Ptr pd; +d :=> var Ptr<~int~> pd; diff --git a/tests/error/ptr_from_const.gw b/tests/error/ptr_from_const.gw index ece1104f..3a840ad7 100644 --- a/tests/error/ptr_from_const.gw +++ b/tests/error/ptr_from_const.gw @@ -1 +1 @@ -1 :=> var <~int~>Ptr i; +1 :=> var Ptr<~int~> i; diff --git a/tests/error/ptr_implicit_const.gw b/tests/error/ptr_implicit_const.gw index ee0cb6fe..e562e571 100644 --- a/tests/error/ptr_implicit_const.gw +++ b/tests/error/ptr_implicit_const.gw @@ -1,3 +1,3 @@ #! [contains] can't cast non-mutable value to Ptr -fun void test(<~int~>Ptr i) { <<< *i>>>; } +fun void test(Ptr<~int~> i) { <<< *i>>>; } 1 => test; diff --git a/tests/error/template_class_no_type.gw b/tests/error/template_class_no_type.gw index aebe2574..98e981b7 100644 --- a/tests/error/template_class_no_type.gw +++ b/tests/error/template_class_no_type.gw @@ -1,5 +1,5 @@ #! [contains] you must provide template types -class<~A~> C { +class C<~A~> { var A a; } diff --git a/tests/error/template_no_match.gw b/tests/error/template_no_match.gw index dc7bff3b..1a19d773 100644 --- a/tests/error/template_no_match.gw +++ b/tests/error/template_no_match.gw @@ -4,6 +4,5 @@ class C { fun void test<~A~>() {} } var C c; -#!c.test<~int~>(); c.test<~int~>(2.3); c.test<~int~>(2.3, 2.3); diff --git a/tests/error/type_not_template.gw b/tests/error/type_not_template.gw index 248192a1..ee4ae5dc 100644 --- a/tests/error/type_not_template.gw +++ b/tests/error/type_not_template.gw @@ -1,2 +1,2 @@ #! [contains] is not template -var <~int~>Object o; +var Object<~int~> o; diff --git a/tests/error/typedef_func_tmpl_types.gw b/tests/error/typedef_func_tmpl_types.gw index e0b4cced..90d12511 100644 --- a/tests/error/typedef_func_tmpl_types.gw +++ b/tests/error/typedef_func_tmpl_types.gw @@ -1,7 +1,7 @@ #! [contains] pre-defined types typedef void t_ptr<~A~>(); -var <~int~>t_ptr iptr; +var t_ptr<~int~> iptr; fun void test<~A~>() { var A a; @@ -9,7 +9,6 @@ fun void test<~A~>() { } test @=> iptr; -#!<<< iptr<~int~>() >>>; <<< iptr() >>>; <<< iptr<~int~>() >>>; <<< iptr<~float~>() >>>; diff --git a/tests/error/typedef_func_tmpl_types2.gw b/tests/error/typedef_func_tmpl_types2.gw index 0523f5fc..5501a52f 100644 --- a/tests/error/typedef_func_tmpl_types2.gw +++ b/tests/error/typedef_func_tmpl_types2.gw @@ -1,12 +1,11 @@ #! [contains] pre-defined types typedef void t_ptr<~A~>(); -typedef <~int~>t_ptr B; +typedef t_ptr<~int~> B; fun void test<~A~>() { <<< __func__ >>>; } test @=> var B b; -#!<<< iptr<~int~>() >>>; <<< b() >>>; <<< b<~int~>() >>>; diff --git a/tests/fork/fork_call.gw b/tests/fork/fork_call.gw index 03ada613..0e3818eb 100644 --- a/tests/fork/fork_call.gw +++ b/tests/fork/fork_call.gw @@ -1,9 +1,8 @@ -#! fork me.id() @=> auto ref sh; fun int test() { return 12; } -fork test() @=> ref <~int~>TypedFork sh; +fork test() @=> ref TypedFork<~int~> sh; <<< typeof(sh) >>>; sh.ev => now; <<< sh.retval >>>; diff --git a/tests/import/class_template.gw b/tests/import/class_template.gw index c86a9339..2d123029 100644 --- a/tests/import/class_template.gw +++ b/tests/import/class_template.gw @@ -1,15 +1,2 @@ -#!class child {} -#!template<~A, B~> -#!class C{ A key; B value; } -#!<~int, int~>C c1; -#!C c2; -#!<<< c1 >>>; -#!<<< c2 >>>; -#!<<< c2.value >>>; - -var <~int, int~>ClassTemplate ct; +var ClassTemplate<~int, int~> ct; <<< ct.key >>>; -#!ClassTemplate ct2; -#!<<< ct2.key >>>; -#!ClassTemplate ct3; -#!<<< ct3.key >>>; diff --git a/tests/import/map2.gw b/tests/import/map2.gw index 08ea9faa..4726b275 100644 --- a/tests/import/map2.gw +++ b/tests/import/map2.gw @@ -1,4 +1,4 @@ -var <~int, float~>Map pp; +var Map<~int, float~> pp; <<< pp >>>; <<< pp.size() >>>; <<< pp.set(1, 2) >>>; diff --git a/tests/import/union_tmpl.gw b/tests/import/union_tmpl.gw index fcb69de5..dbd5c468 100644 --- a/tests/import/union_tmpl.gw +++ b/tests/import/union_tmpl.gw @@ -1,2 +1,2 @@ -<<< var <~Event~>U u>>>; +<<< var U<~Event~> u>>>; <<< u.a >>>; diff --git a/tests/new/dtor.gw b/tests/new/dtor.gw index 1d82ee41..f2042753 100644 --- a/tests/new/dtor.gw +++ b/tests/new/dtor.gw @@ -1,10 +1,10 @@ -class <~A~>C { +class C<~A~> { operator @dtor void () { <<< __func__ >>>; } } -class <~A~>D extends <~A~>C { +class D<~A~> extends C<~A~> { operator @dtor void () { <<< __func__ >>>; } } -class E extends <~int~>D { +class E extends D<~int~> { operator @dtor void () { <<< __func__ >>>; } } diff --git a/tests/new/extend_template_union.gw b/tests/new/extend_template_union.gw index 31708f3d..ded551f1 100644 --- a/tests/new/extend_template_union.gw +++ b/tests/new/extend_template_union.gw @@ -1,27 +1,25 @@ -union <~A~>U { +union U<~A~> { A a; int i; }; -#!<~float~>U u; -#!<<< u.i >>>; -class <~A~>C extends <~A~>U { +class C<~A~> extends U<~A~> { fun void test() { <<< this >>>; } operator @dtor void () { <<< __func__ >>>; } } -var <~float~>C c; +var C<~float~> c; <<< c >>>; <<< c.test() >>>; <<< c.i >>>; -class <~A,B~>D extends <~float~>C { +class D<~A,B~> extends C<~float~> { } -var <~int,int~>D d; -class <~A,B~>E extends <~float,B~>D { +var D<~int,int~> d; +class E<~A,B~> extends D<~float,B~> { } -var <~int,int~>E e; +var E<~int,int~> e; diff --git a/tests/new/parent.gw b/tests/new/parent.gw index 99e84d68..e2c240f6 100644 --- a/tests/new/parent.gw +++ b/tests/new/parent.gw @@ -1,14 +1,14 @@ class B { } -class <~A~> C extends B { +class C<~A~> extends B { } -class <~A,B~> D extends <~A~>C { - class <~A~>Child { +class D<~A,B~> extends C<~A~> { + class Child<~A~> { var A a; } - var <~A~>Child child; + var Child<~A~> child; } -var <~int~>D d; +var D<~int~> d; diff --git a/tests/new/template_class_in_template.gw b/tests/new/template_class_in_template.gw index bf9d88ec..4e0097a6 100644 --- a/tests/new/template_class_in_template.gw +++ b/tests/new/template_class_in_template.gw @@ -1,8 +1,8 @@ -class <~A~>Parent { - class <~B~>C { +class Parent<~A~> { + class C<~B~> { 12 => var A a; 13 => var B B; } } -var <~int, int~>Parent.C c; +var Parent.C<~int, int~> c; <<< c.a >>>; diff --git a/tests/new/test2.gw b/tests/new/test2.gw index 044dd500..2dae03fe 100644 --- a/tests/new/test2.gw +++ b/tests/new/test2.gw @@ -1,8 +1,8 @@ -class <~A~>C { +class C<~A~> { typedef static void func_t<~A~>(A a); fun static void myfunc<~A~>(A a) { <<< a >>>; } myfunc @=> var static func_t ptr; ptr(1); } -var <~int~>C c; +var C<~int~> c; diff --git a/tests/new/typedef_func_tmpl_class.gw b/tests/new/typedef_func_tmpl_class.gw index 77bbd95c..19cfb8ee 100644 --- a/tests/new/typedef_func_tmpl_class.gw +++ b/tests/new/typedef_func_tmpl_class.gw @@ -1,7 +1,7 @@ class C { typedef void t_ptr<~A~>(); - var <~int~>t_ptr iptr; + var t_ptr<~int~> iptr; fun void test<~A~>() { <<< this, " ", __func__ >>>; diff --git a/tests/new/typedef_func_tmpl_class_static.gw b/tests/new/typedef_func_tmpl_class_static.gw index 1da8290f..17e43fdd 100644 --- a/tests/new/typedef_func_tmpl_class_static.gw +++ b/tests/new/typedef_func_tmpl_class_static.gw @@ -1,7 +1,7 @@ class C { typedef static void t_ptr<~A~>(); - var <~int~>t_ptr iptr; + var t_ptr<~int~> iptr; fun static void test<~A~>() { <<< __func__ >>>; diff --git a/tests/new/typedef_func_tmpl_tmpl.gw b/tests/new/typedef_func_tmpl_tmpl.gw index d324c0f9..01835559 100644 --- a/tests/new/typedef_func_tmpl_tmpl.gw +++ b/tests/new/typedef_func_tmpl_tmpl.gw @@ -1,2 +1,2 @@ typedef void ptr_t<~A~>(myPtr ptr); -var <~ <~A~> Ptr~>ptr_t t; +var ptr_t<~ Ptr<~A~> ~> t; diff --git a/tests/regression/invalid_template.gw b/tests/regression/invalid_template.gw index 440fc150..b70439a3 100644 --- a/tests/regression/invalid_template.gw +++ b/tests/regression/invalid_template.gw @@ -1,12 +1,12 @@ class B {} -class<~A~>C extends B{} +class C<~A~> extends B{} -class<~A,B~>D extends<~A~>C{ - class<~A~> E{} +class D<~A,B~> extends C<~A~> { + class E<~A~> {} class G extends ld {A0I:} - var <~A~>d d; + var D<~A~> d; } -var <~int~>D d; +var D<~int~> d; diff --git a/tests/struct/struct_template.gw b/tests/struct/struct_template.gw index a983c2a3..54abfb9c 100644 --- a/tests/struct/struct_template.gw +++ b/tests/struct/struct_template.gw @@ -1,10 +1,10 @@ -struct <~A~> S{ +struct S<~A~> { var A a0; var A a1; } -var <~int~>S si; -var <~float~>S sf; +var D<~int~> si; +var D<~float~> sf; <<< si.a0 >>>; <<< sf.a0 >>>; diff --git a/tests/tree/auto_ptr.gw b/tests/tree/auto_ptr.gw index 244273d2..e770fb80 100644 --- a/tests/tree/auto_ptr.gw +++ b/tests/tree/auto_ptr.gw @@ -1,4 +1,4 @@ -var <~int~>Ptr ptr; +var Ptr<~int~> ptr; var int i[4]; foreach(ref a : i) <<< *a >>>; diff --git a/tests/tree/class_not_template_inside_template.gw b/tests/tree/class_not_template_inside_template.gw index 5a86af30..2c13b37f 100644 --- a/tests/tree/class_not_template_inside_template.gw +++ b/tests/tree/class_not_template_inside_template.gw @@ -1,7 +1,7 @@ -class <~A~>C { +class C<~A~> { class D { } } -var <~int~>C.D d; +var C.D<~int~> d; diff --git a/tests/tree/class_template.gw b/tests/tree/class_template.gw index c254fd7f..eb508866 100644 --- a/tests/tree/class_template.gw +++ b/tests/tree/class_template.gw @@ -1,4 +1,4 @@ -class<~A,B~> C { +class C<~A,B~> { var A a; var B b; fun A test() { @@ -9,9 +9,9 @@ class<~A,B~> C { } } -var <~int, int~>C c; -var <~float, int~>C d; -var <~Object, int~>C g; +var C<~int, int~> c; +var C<~float, int~> d; +var C<~Object, int~> g; <<< c.a >>>; <<< d.a >>>; <<< c.test() >>>; diff --git a/tests/tree/cpy_ast.gw b/tests/tree/cpy_ast.gw index 5dcd811c..52041acf 100644 --- a/tests/tree/cpy_ast.gw +++ b/tests/tree/cpy_ast.gw @@ -1,4 +1,4 @@ -class <~A~>C { +class C<~A~> { \a{}; [ 1 ]; var int i,j; @@ -9,7 +9,7 @@ class <~A~>C { i ? i : !i; ++i; union { int ui; } u; - union <~A~>U{ int ui; }; + union U<~A~> { int ui; }; typeof(i); if(i) i; else i; for(var int _i; _i < 1; ++_i); @@ -30,4 +30,4 @@ class <~A~>C { while(0){ <<< __func__ >>>; } } -var <~int~>C c; +var C<~int~> c; diff --git a/tests/tree/extent_template.gw b/tests/tree/extent_template.gw index 1bf01d87..51d194f9 100644 --- a/tests/tree/extent_template.gw +++ b/tests/tree/extent_template.gw @@ -1,8 +1,8 @@ -class <~A~> C { +class C<~A~> { var A a; } -class D extends <~int~>C {} +class D extends C<~int~> {} var D d; <<>>; diff --git a/tests/tree/get_type_name_test.gw b/tests/tree/get_type_name_test.gw index 055655ea..015bb344 100644 --- a/tests/tree/get_type_name_test.gw +++ b/tests/tree/get_type_name_test.gw @@ -1,4 +1,4 @@ -class <~A, B~> C{} -class <~A~> D {} -var <~ <~int~>D, <~int~>D ~>C c; +class C<~A, B~> {} +class D<~A~> {} +var C<~ D<~int~>, D<~int~> ~> c; <<< c >>>; diff --git a/tests/tree/static_template.gw b/tests/tree/static_template.gw index 784667ef..b4e9392a 100644 --- a/tests/tree/static_template.gw +++ b/tests/tree/static_template.gw @@ -1,9 +1,9 @@ -class<~A~> C { +class C<~A~> { var A a; } class D { - var static <~int~>C c; + var static C<~int~> c; } var D d; diff --git a/tests/tree/template_class_invalid_type_number.gw b/tests/tree/template_class_invalid_type_number.gw index 8529c33b..148c178b 100644 --- a/tests/tree/template_class_invalid_type_number.gw +++ b/tests/tree/template_class_invalid_type_number.gw @@ -1,3 +1,3 @@ -class <~A~>C {} +class C<~A~> {} -var <~int, float~>C c; +var C<~int, float~> c; diff --git a/tests/tree/template_class_ref.gw b/tests/tree/template_class_ref.gw index eeef0582..5448e880 100644 --- a/tests/tree/template_class_ref.gw +++ b/tests/tree/template_class_ref.gw @@ -1,4 +1,4 @@ -class<~A~> C {} +class C<~A~> {} -var <~int~>C c; +var C<~int~> c; <<< c >>>; diff --git a/tests/tree/template_self.gw b/tests/tree/template_self.gw index 632f97df..f47c25c8 100644 --- a/tests/tree/template_self.gw +++ b/tests/tree/template_self.gw @@ -1,7 +1,7 @@ -class <~A~>C { +class C<~A~> { fun void test() { - var <~A~>C c; + var C<~A~> c; } } -var <~int~>C c; +var C<~int~> c; diff --git a/tests/tree/typedef_func_tmpl.gw b/tests/tree/typedef_func_tmpl.gw index 0db03853..e56a09fa 100644 --- a/tests/tree/typedef_func_tmpl.gw +++ b/tests/tree/typedef_func_tmpl.gw @@ -1,7 +1,7 @@ typedef void t_ptr<~A~>(); -var <~int~>t_ptr iptr; -var <~float~>t_ptr fptr; +var t_ptr<~int~> iptr; +var t_ptr<~float~> fptr; fun void test<~A~>() { <<< __func__ >>>; diff --git a/tests/tree/typedef_func_tmpl2.gw b/tests/tree/typedef_func_tmpl2.gw index 6a3507db..e5d8c4d3 100644 --- a/tests/tree/typedef_func_tmpl2.gw +++ b/tests/tree/typedef_func_tmpl2.gw @@ -3,7 +3,7 @@ fun void test<~A~>() { <<< __func__ >>>; } -typedef <~int~>t_ptr B; +typedef t_ptr<~int~> B; var B b; <<< b >>>; test @=> b; @@ -12,7 +12,7 @@ test @=> b; <<< b() >>>; -typedef <~float~>t_ptr C; +typedef t_ptr<~float~> C; var C c; <<< c >>>; test @=> c; diff --git a/tests/tree/typedef_func_tmpl_class.gw b/tests/tree/typedef_func_tmpl_class.gw index 3bf281c3..f2636871 100644 --- a/tests/tree/typedef_func_tmpl_class.gw +++ b/tests/tree/typedef_func_tmpl_class.gw @@ -1,7 +1,7 @@ class C { typedef void t_ptr<~A~>(); - var <~int~>t_ptr iptr; + var t_ptr<~int~> iptr; fun void test<~A~>() { <<< this, " ", __func__ >>>; diff --git a/tests/tree/union_tmpl.gw b/tests/tree/union_tmpl.gw index 0cc89600..c19b43f5 100644 --- a/tests/tree/union_tmpl.gw +++ b/tests/tree/union_tmpl.gw @@ -1,7 +1,7 @@ -union <~A~> U{ +union U<~A~>{ int i; A a; }; -var <~float~>U u; +var U<~float~> u; <<< u.a >>>; diff --git a/tests/xxxfix/post_func.gw b/tests/xxxfix/post_func.gw index eb7b75de..d4adfdbb 100644 --- a/tests/xxxfix/post_func.gw +++ b/tests/xxxfix/post_func.gw @@ -2,4 +2,4 @@ fun int add(int i) { return i + 3; } -<<< 2 @add>>>; +<<< 2 $add>>>; diff --git a/tests/xxxfix/unary_func.gw b/tests/xxxfix/unary_func.gw index 20ea20f9..b82dc14a 100644 --- a/tests/xxxfix/unary_func.gw +++ b/tests/xxxfix/unary_func.gw @@ -2,4 +2,4 @@ fun int add(int i) { return i + 3; } -<<< (@add) 2 >>>; +<<< ($add) 2 >>>;