From 326212cb54c000258ed4e521671166dd53003e10 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 14 Sep 2020 01:19:45 +0200 Subject: [PATCH] :art: Open templates with ':' (first char) --- ast | 2 +- examples/binary_tmpl.gw | 2 +- examples/implicit_fptr_tmpl.gw | 4 ++-- examples/implicit_ptr.gw | 2 +- examples/in_class_class.gw | 2 +- examples/ptr_assign.gw | 2 +- examples/ptr_cast.gw | 2 +- examples/ptr_deref.gw | 2 +- examples/template.gw | 8 ++++---- examples/template_dyn.gw | 10 +++++----- examples/template_guess.gw | 2 +- examples/template_vararg.gw | 6 +++--- plug | 2 +- src/env/func.c | 2 +- src/env/type.c | 4 ++-- src/import/checker.c | 6 +++--- src/lib/object_op.c | 2 +- src/lib/ptr.c | 2 +- src/lib/shred.c | 2 +- src/parse/check.c | 2 +- src/parse/operator.c | 2 +- tests/bug/Tester.gw | 4 ++-- tests/error/call_non_template.gw | 2 +- tests/error/empty_ptr.gw | 2 +- tests/error/invalid_pointer_cast.gw | 2 +- tests/error/non_function_template.gw | 2 +- tests/error/ptr_assign_const.gw | 2 +- tests/error/ptr_assign_invalid.gw | 2 +- tests/error/ptr_from_const.gw | 2 +- tests/error/ptr_implicit_const.gw | 2 +- tests/error/template_class_no_type.gw | 2 +- tests/error/template_dyn2.gw | 10 +++++----- tests/error/template_enough.gw | 2 +- tests/error/template_n_mismatch.gw | 8 ++++---- tests/error/template_no_match.gw | 8 ++++---- tests/error/template_non_member.gw | 2 +- tests/error/template_not_able.gw | 2 +- tests/error/template_overload.gw | 2 +- tests/error/template_ternary.gw | 2 +- tests/error/template_unknown.gw | 4 ++-- tests/error/type_not_template.gw | 2 +- tests/error/typedef_func_tmpl_types.gw | 12 ++++++------ tests/error/typedef_func_tmpl_types2.gw | 8 ++++---- tests/fork/fork_call.gw | 2 +- tests/fptr/fptr_tmpl_cast.gw | 4 ++-- tests/import/class_template.c | 6 +++--- tests/import/class_template.gw | 2 +- tests/import/class_template_fail.c | 2 +- tests/import/class_template_invalid.c | 6 +++--- tests/import/fptr_tmpl.c | 2 +- tests/import/fptr_tmpl_fail.c | 2 +- tests/import/func_fail2.c | 2 +- tests/import/func_fail3.c | 2 +- tests/import/func_fail4.c | 2 +- tests/import/func_tmpl.c | 2 +- tests/import/func_tmpl.gw | 2 +- tests/import/func_tmpl_fail.c | 2 +- tests/import/invalid_names.c | 2 +- tests/import/invalid_names3.c | 2 +- tests/import/map2.gw | 2 +- tests/import/typedef_fail.c | 4 ++-- tests/import/typedef_tmpl.c | 2 +- tests/import/union_tmpl.c | 2 +- tests/import/union_tmpl.gw | 2 +- tests/import/union_tmpl_fail.c | 2 +- tests/import/union_tmpl_fail2.c | 4 ++-- tests/import/union_tmpl_fail3.c | 2 +- tests/new/dottmpl.gw | 2 +- tests/new/dtor.gw | 6 +++--- tests/new/extend_template_union.gw | 14 +++++++------- tests/new/parent.gw | 10 +++++----- tests/new/pure.gw | 2 +- tests/new/pure_member.gw | 2 +- tests/new/recursive_template.gw | 6 +++--- tests/new/recursive_template0.gw | 6 +++--- tests/new/recursive_template1.gw | 6 +++--- tests/new/recursive_template2.gw | 4 ++-- tests/new/recursive_template3.gw | 2 +- tests/new/recursive_template_test.gw | 4 ++-- tests/new/static_tmpl2.gw | 2 +- tests/new/template_class_in_template.gw | 6 +++--- tests/new/template_dyn.gw | 10 +++++----- tests/new/test.gw | 4 ++-- tests/new/test2.gw | 8 ++++---- tests/new/typedef_func_tmpl_class.gw | 6 +++--- tests/new/typedef_func_tmpl_class_static.gw | 6 +++--- tests/new/typedef_func_tmpl_err.gw | 6 +++--- tests/new/typedef_func_tmpl_tmpl.gw | 4 ++-- tests/regression/invalid_template.gw | 10 +++++----- tests/struct/struct_template.gw | 6 +++--- tests/tree/auto_ptr.gw | 2 +- tests/tree/call_nonnull.gw | 4 ++-- tests/tree/class_not_template_inside_template.gw | 4 ++-- tests/tree/class_template.gw | 10 +++++----- tests/tree/cpy_ast.gw | 6 +++--- tests/tree/extent_template.gw | 4 ++-- tests/tree/get_type_name_test.gw | 6 +++--- tests/tree/static_template.gw | 4 ++-- tests/tree/static_tmpl.gw | 6 +++--- tests/tree/template_class_invalid_type_number.gw | 4 ++-- tests/tree/template_class_ref.gw | 4 ++-- tests/tree/template_fptr.gw | 8 ++++---- tests/tree/template_self.gw | 6 +++--- tests/tree/tmpl_fail_inner.gw | 6 +++--- tests/tree/typedef_func_tmpl.gw | 8 ++++---- tests/tree/typedef_func_tmpl2.gw | 8 ++++---- tests/tree/typedef_func_tmpl_class.gw | 6 +++--- tests/tree/union_tmpl.gw | 4 ++-- 108 files changed, 223 insertions(+), 223 deletions(-) diff --git a/ast b/ast index 5dcf6d41..d460cbba 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 5dcf6d41e3441deafd0f76aae4b8797af0732339 +Subproject commit d460cbba959c3706c9488511c097fb6d0ed9e871 diff --git a/examples/binary_tmpl.gw b/examples/binary_tmpl.gw index 46a04c6c..6e6d0b4b 100644 --- a/examples/binary_tmpl.gw +++ b/examples/binary_tmpl.gw @@ -2,7 +2,7 @@ class C { class D { } } -fun void test<[A](A a) { <<< a >>>; } +fun void test:[A](A a) { <<< a >>>; } 1 => test; 1.3 => test; test(1); diff --git a/examples/implicit_fptr_tmpl.gw b/examples/implicit_fptr_tmpl.gw index 73ad996b..6e0e2105 100644 --- a/examples/implicit_fptr_tmpl.gw +++ b/examples/implicit_fptr_tmpl.gw @@ -1,8 +1,8 @@ -typedef void t_ptr<[A](); +typedef void t_ptr:[A](); fun void test(t_ptr p) { <<< p >>>; } -fun void t<[A]() { +fun void t:[A]() { } t => test; diff --git a/examples/implicit_ptr.gw b/examples/implicit_ptr.gw index 4f894a4d..58b94db1 100644 --- a/examples/implicit_ptr.gw +++ b/examples/implicit_ptr.gw @@ -1,4 +1,4 @@ -fun void test(Ptr<[int] p) { +fun void test(Ptr:[int] p) { <<< *p >>>; } var int i => test; diff --git a/examples/in_class_class.gw b/examples/in_class_class.gw index ee81714d..6b4fe396 100644 --- a/examples/in_class_class.gw +++ b/examples/in_class_class.gw @@ -1,5 +1,5 @@ class C { - fun void test<[A](A a){ <<< a >>>; } + fun void test:[A](A a){ <<< a >>>; } class D { var int i;} } diff --git a/examples/ptr_assign.gw b/examples/ptr_assign.gw index cd2628c5..ba71a88b 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 Ptr<[C] pd; +d :=> var Ptr:[C] pd; diff --git a/examples/ptr_cast.gw b/examples/ptr_cast.gw index eb499b5e..5a653f44 100644 --- a/examples/ptr_cast.gw +++ b/examples/ptr_cast.gw @@ -1,2 +1,2 @@ 12 => var int i; -<<>>; +<<>>; diff --git a/examples/ptr_deref.gw b/examples/ptr_deref.gw index e3e5f988..495280bb 100644 --- a/examples/ptr_deref.gw +++ b/examples/ptr_deref.gw @@ -1,3 +1,3 @@ var int i; -i :=> var Ptr<[int] pti; +i :=> var Ptr:[int] pti; <<<12 => *pti, " ", *pti>>>; diff --git a/examples/template.gw b/examples/template.gw index 5de4d699..a0848993 100644 --- a/examples/template.gw +++ b/examples/template.gw @@ -1,4 +1,4 @@ -fun void test<[A] (A a){ <<< a >>>; } -fun void test<[A,B] (A a, B b){ <<< a >>>; } -test<[int](1); -test<[float, float](3, 1.4); +fun void test:[A] (A a){ <<< a >>>; } +fun void test:[A,B] (A a, B b){ <<< a >>>; } +test:[int](1); +test:[float, float](3, 1.4); diff --git a/examples/template_dyn.gw b/examples/template_dyn.gw index 87cf3a4a..32e81dfe 100644 --- a/examples/template_dyn.gw +++ b/examples/template_dyn.gw @@ -4,15 +4,15 @@ fun void test(C cc, int i) { <<< 1 >>>; <<< cc.test(i, i) >>>; } class C { - fun int test<[A](A a) { <<< " A ", a >>>; } - fun int test<[A](A a, int i) { <<< " ", a >>>; } - fun int test<[A](A a, int i, int j) { <<< a >>>; } + fun int test:[A](A a) { <<< " A ", a >>>; } + fun int test:[A](A a, int i) { <<< " ", a >>>; } + fun int test:[A](A a, int i, int j) { <<< a >>>; } } class D extends C { - fun int test<[A](A a, int i) { <<< this, " extent ", a, __func__ >>>; } + fun int test:[A](A a, int i) { <<< this, " extent ", a, __func__ >>>; } } class E extends D { - fun int test<[A](A a, int i) { <<< this, " Extent ", a, __func__ >>>; } + fun int test:[A](A a, int i) { <<< this, " Extent ", a, __func__ >>>; } } diff --git a/examples/template_guess.gw b/examples/template_guess.gw index 6a95245e..64fab797 100644 --- a/examples/template_guess.gw +++ b/examples/template_guess.gw @@ -1,4 +1,4 @@ -fun void test<[A,B](A a, B b){<<< a, ", ", b >>>;} +fun void test:[A,B](A a, B b){<<< a, ", ", b >>>;} test(1, 2.1); test(1.1, 2.1); test(1.2, 2); diff --git a/examples/template_vararg.gw b/examples/template_vararg.gw index bc292725..a8d5ceb7 100644 --- a/examples/template_vararg.gw +++ b/examples/template_vararg.gw @@ -1,7 +1,7 @@ -fun void test<[A](...) { +fun void test:[A](...) { varloop vararg { <<< vararg $ int >>>; } } -test<[int](1, 2); -test<[float](1, 2, 3); +test:[int](1, 2); +test:[float](1, 2, 3); diff --git a/plug b/plug index cf2a0ab7..f0665cb2 160000 --- a/plug +++ b/plug @@ -1 +1 @@ -Subproject commit cf2a0ab7afe7f690fa043d6db8aba45c0621e2be +Subproject commit f0665cb2b05614dddb863fd3b28a9a2cc770fb3c diff --git a/src/env/func.c b/src/env/func.c index e039468f..a1bda102 100644 --- a/src/env/func.c +++ b/src/env/func.c @@ -30,7 +30,7 @@ ANN2(1,2) Symbol func_symbol(const Env env, const m_str nspc, const m_str base, const size_t len = base_len + tmpl_len + nspc_len + idx_len + 2; char name[len + 1]; CHECK_BO(sprintf(name, "%s%s%s%s@%" UINT_F "@%s", - base, !tmpl ? "" : "<[", !tmpl ? "" : tmpl, !tmpl ? "" : "]", + base, !tmpl ? "" : ":[", !tmpl ? "" : tmpl, !tmpl ? "" : "]", i, nspc)) return insert_symbol(env->gwion->st, name); } diff --git a/src/env/type.c b/src/env/type.c index a357b639..bc6e3126 100644 --- a/src/env/type.c +++ b/src/env/type.c @@ -148,7 +148,7 @@ ANN m_bool type_ref(Type t) { ANN m_str get_type_name(const Env env, const Type t, const m_uint index) { if(!index) return NULL; - m_str name = strchr(t->name, '<'); + m_str name = strchr(t->name, ':'); if(!name) return NULL; name += 2; @@ -157,7 +157,7 @@ ANN m_str get_type_name(const Env env, const Type t, const m_uint index) { m_uint n = 1; char c, buf[slen + 1], *tmp = buf; while((c = *name)) { - if(c == '<') + if(c == ':') ++lvl; else if(c == ']') { if(!lvl-- && n == index) diff --git a/src/import/checker.c b/src/import/checker.c index 14c2c86c..b10c9fa5 100644 --- a/src/import/checker.c +++ b/src/import/checker.c @@ -59,7 +59,7 @@ ANN static Symbol __str2sym(const Gwi gwi, struct td_checker *tdc) { ANN static inline Symbol _str2sym(const Gwi gwi, struct td_checker *tdc, const m_str path) { const Symbol sym = __str2sym(gwi, tdc); - if(*tdc->str && *tdc->str != '<') + if(*tdc->str && *tdc->str != ':') GWI_ERR_O(_("illegal character '%c' in path '%s'."), *tdc->str, path) return sym; } @@ -106,7 +106,7 @@ ANN static ID_List _tmpl_list(const Gwi gwi, struct td_checker *tdc) { } ANN static ID_List __tmpl_list(const Gwi gwi, struct td_checker *tdc) { - if(tdc->str[0] != '<') + if(tdc->str[0] != ':') return NULL; if(tdc->str[1] != '[') return (ID_List)GW_ERROR; @@ -192,7 +192,7 @@ ANN Type_List __str2tl(const Gwi gwi, struct td_checker *tdc) { } ANN static Type_List td_tmpl(const Gwi gwi, struct td_checker *tdc) { - if(*tdc->str != '<') + if(*tdc->str != ':') return NULL; // GW_PASS ++tdc->str; if(*tdc->str != '[') { diff --git a/src/lib/object_op.c b/src/lib/object_op.c index d26ef7a1..ef3f409f 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -313,7 +313,7 @@ ANN static void template_name(struct tmpl_info* info, m_str s) { m_str str = s; const m_uint size = info->index = vector_size(&info->type) -1; str = tmpl_get(info, str); - *str++ = '<'; + *str++ = ':'; *str++ = '['; for(info->index = 0; info->index < size; ++info->index) { str = tmpl_get(info, str); diff --git a/src/lib/ptr.c b/src/lib/ptr.c index ba9cd4a8..2cfbefb2 100644 --- a/src/lib/ptr.c +++ b/src/lib/ptr.c @@ -158,7 +158,7 @@ GWION_IMPORT(ptr) { GWI_BB(gwi_oper_ini(gwi, "@Ptr", NULL, NULL)) GWI_BB(gwi_oper_add(gwi, opck_ptr_scan)) GWI_BB(gwi_oper_end(gwi, "@scan", NULL)) - const Type t_ptr = gwi_class_ini(gwi, "Ptr<[A]", "@Ptr"); + const Type t_ptr = gwi_class_ini(gwi, "Ptr:[A]", "@Ptr"); gwi->gwion->type[et_ptr] = t_ptr; GWI_BB(gwi_item_ini(gwi, "@internal", "@val")) GWI_BB(gwi_item_end(gwi, 0, NULL)) diff --git a/src/lib/shred.c b/src/lib/shred.c index 13606b5b..9dc20c4b 100644 --- a/src/lib/shred.c +++ b/src/lib/shred.c @@ -403,7 +403,7 @@ GWION_IMPORT(shred) { GWI_BB(gwi_class_end(gwi)) SET_FLAG((t_fork), abstract); - const Type t_typed = gwi_class_ini(gwi, "TypedFork<[A]", "Fork"); + const Type t_typed = gwi_class_ini(gwi, "TypedFork:[A]", "Fork"); gwi_item_ini(gwi, "A", "retval"); GWI_BB((gwi_item_end(gwi, ae_flag_const, NULL))) GWI_BB(gwi_class_end(gwi)) diff --git a/src/parse/check.c b/src/parse/check.c index f2821824..b63c8dfc 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -704,7 +704,7 @@ ANN static Func get_template_func(const Env env, const Exp_Call* func, const Val assert(exp_self(func)); ERR_O(exp_self(func)->pos, _("function is template. automatic type guess not fully implemented yet.\n" - " please provide template types. eg: '<[type1, type2, ...]'")) + " please provide template types. eg: ':[type1, type2, ...]'")) } ANN static Func predefined_func(const Env env, const Value v, diff --git a/src/parse/operator.c b/src/parse/operator.c index 42231053..6e944279 100644 --- a/src/parse/operator.c +++ b/src/parse/operator.c @@ -39,7 +39,7 @@ ANN static Type op_parent(const Env env, const Type t) { const Type type = typedef_base(t); char name[strlen(type->name)]; strcpy(name, type->name); - const m_str post = strrchr(name, '<'); + const m_str post = strrchr(name, ':'); *post = '\0'; return nspc_lookup_type1(env->curr, insert_symbol(env->gwion->st, name)); } diff --git a/tests/bug/Tester.gw b/tests/bug/Tester.gw index 32820228..4c6f1800 100644 --- a/tests/bug/Tester.gw +++ b/tests/bug/Tester.gw @@ -1,7 +1,7 @@ class Tester { - fun int assert_equal<[A](string description, A a, A b){ if(a == b) return 0; return 1; } - fun int assert_not_equal<[A](string description, A a, A b){ if(a != b) return 0; return 1; } + fun int assert_equal:[A](string description, A a, A b){ if(a == b) return 0; return 1; } + fun int assert_not_equal:[A](string description, A a, A b){ if(a != b) return 0; return 1; } } var Tester t; diff --git a/tests/error/call_non_template.gw b/tests/error/call_non_template.gw index 53d98116..fbdb7cd6 100644 --- a/tests/error/call_non_template.gw +++ b/tests/error/call_non_template.gw @@ -1,3 +1,3 @@ #! [contains] template call of non-template function fun void test(){} -test<[int](); +test:[int](); diff --git a/tests/error/empty_ptr.gw b/tests/error/empty_ptr.gw index f00c1a23..9abb39ba 100644 --- a/tests/error/empty_ptr.gw +++ b/tests/error/empty_ptr.gw @@ -1,3 +1,3 @@ #! [contains] EmptyPointerException -var Ptr<[int] t; +var Ptr:[int] t; <<< *t >>>; diff --git a/tests/error/invalid_pointer_cast.gw b/tests/error/invalid_pointer_cast.gw index 831f2502..393b1519 100644 --- a/tests/error/invalid_pointer_cast.gw +++ b/tests/error/invalid_pointer_cast.gw @@ -1,2 +1,2 @@ #! [contains] invalid pointer cast -<<< 1 $ Ptr<[Object] >>>; +<<< 1 $ Ptr:[Object] >>>; diff --git a/tests/error/non_function_template.gw b/tests/error/non_function_template.gw index dc97b69c..8840211d 100644 --- a/tests/error/non_function_template.gw +++ b/tests/error/non_function_template.gw @@ -1,3 +1,3 @@ #! [contains] template call of non-function value var int test; -test<[int](); +test:[int](); diff --git a/tests/error/ptr_assign_const.gw b/tests/error/ptr_assign_const.gw index 998d8724..52f7effe 100644 --- a/tests/error/ptr_assign_const.gw +++ b/tests/error/ptr_assign_const.gw @@ -1 +1 @@ -1 :=> var Ptr<[int] pd; +1 :=> var Ptr:[int] pd; diff --git a/tests/error/ptr_assign_invalid.gw b/tests/error/ptr_assign_invalid.gw index fcc6da2d..5bab97e0 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 Ptr<[int] pd; +d :=> var Ptr:[int] pd; diff --git a/tests/error/ptr_from_const.gw b/tests/error/ptr_from_const.gw index 1d30894c..600b5b00 100644 --- a/tests/error/ptr_from_const.gw +++ b/tests/error/ptr_from_const.gw @@ -1 +1 @@ -1 :=> var Ptr<[int] i; +1 :=> var Ptr:[int] i; diff --git a/tests/error/ptr_implicit_const.gw b/tests/error/ptr_implicit_const.gw index 4c940a29..aa172bb2 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(Ptr<[int] 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 4e77515b..860b0d2c 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 C<[A] { +class C:[A] { var A a; } diff --git a/tests/error/template_dyn2.gw b/tests/error/template_dyn2.gw index 6d9e82fd..d13f2fc8 100644 --- a/tests/error/template_dyn2.gw +++ b/tests/error/template_dyn2.gw @@ -5,15 +5,15 @@ fun void test(C cc, int i) { <<< 1 >>>; <<< cc.test(i, i) >>>; } class C { - fun int test<[A](A a) { <<< " A ", a >>>; } - fun int test<[A](A a, int i) { <<< " ", a >>>; } - fun int test<[A](A a, int i, int j) { <<< a >>>; } + fun int test:[A](A a) { <<< " A ", a >>>; } + fun int test:[A](A a, int i) { <<< " ", a >>>; } + fun int test:[A](A a, int i, int j) { <<< a >>>; } } class D extends C { - fun int test<[A](A a, int i) { <<< this, " extent ", a, __func__ >>>; } + fun int test:[A](A a, int i) { <<< this, " extent ", a, __func__ >>>; } } class E extends D { - fun int test<[A](A a, int i) { <<< this, " Extent ", a, _func__ >>>; } + fun int test:[A](A a, int i) { <<< this, " Extent ", a, _func__ >>>; } } diff --git a/tests/error/template_enough.gw b/tests/error/template_enough.gw index 243a27ec..918708c3 100644 --- a/tests/error/template_enough.gw +++ b/tests/error/template_enough.gw @@ -1,3 +1,3 @@ #! [contains] -fun void test<[A,B](){} +fun void test:[A,B](){} test(); diff --git a/tests/error/template_n_mismatch.gw b/tests/error/template_n_mismatch.gw index b9f7ea44..bf66bc22 100644 --- a/tests/error/template_n_mismatch.gw +++ b/tests/error/template_n_mismatch.gw @@ -1,6 +1,6 @@ #! [contains] arguments do not match for template call -fun void test<[A](){ <<< "func" >>>;} -fun void test<[A](int i){<<< "other func" >>>;} +fun void test:[A](){ <<< "func" >>>;} +fun void test:[A](int i){<<< "other func" >>>;} -test<[int, float, int](); -#!test<[int](); +test:[int, float, int](); +#!test:[int](); diff --git a/tests/error/template_no_match.gw b/tests/error/template_no_match.gw index 64ad2a81..423127fa 100644 --- a/tests/error/template_no_match.gw +++ b/tests/error/template_no_match.gw @@ -1,8 +1,8 @@ #! [contains] arguments do not match for template call class C { - fun void test<[A](float f) {} - fun void test<[A]() {} + fun void test:[A](float f) {} + fun void test:[A]() {} } var C c; -c.test<[int](2.3); -c.test<[int](2.3, 2.3); +c.test:[int](2.3); +c.test:[int](2.3, 2.3); diff --git a/tests/error/template_non_member.gw b/tests/error/template_non_member.gw index 7c1fb564..ef2823ec 100644 --- a/tests/error/template_non_member.gw +++ b/tests/error/template_non_member.gw @@ -1,2 +1,2 @@ #! [contains] -Math.rand<[int](); +Math.rand:[int](); diff --git a/tests/error/template_not_able.gw b/tests/error/template_not_able.gw index 8047b213..247b2faa 100644 --- a/tests/error/template_not_able.gw +++ b/tests/error/template_not_able.gw @@ -1,3 +1,3 @@ #! [contains] not able to guess types for template call -fun void test<[A,B](A a) {} +fun void test:[A,B](A a) {} test(1); diff --git a/tests/error/template_overload.gw b/tests/error/template_overload.gw index 4247b7dd..60362027 100644 --- a/tests/error/template_overload.gw +++ b/tests/error/template_overload.gw @@ -1,3 +1,3 @@ #! [contains] must overload template function with template -fun void test<[A](int i){} +fun void test:[A](int i){} fun void test(int i, float f){} diff --git a/tests/error/template_ternary.gw b/tests/error/template_ternary.gw index f5c5384b..a6b03f20 100644 --- a/tests/error/template_ternary.gw +++ b/tests/error/template_ternary.gw @@ -1,4 +1,4 @@ #! [contains] invalid expression for function call -fun void test<[A](A a){} +fun void test:[A](A a){} (maybe ? test : test)(1); diff --git a/tests/error/template_unknown.gw b/tests/error/template_unknown.gw index 30b6a684..d3b6ca2f 100644 --- a/tests/error/template_unknown.gw +++ b/tests/error/template_unknown.gw @@ -1,4 +1,4 @@ #! [contains] unknown type -fun void my_function<[A]() { <<< "test" >>>; } +fun void my_function:[A]() { <<< "test" >>>; } -my_function<[unknown_type](); +my_function:[unknown_type](); diff --git a/tests/error/type_not_template.gw b/tests/error/type_not_template.gw index dd30ecf6..5520722e 100644 --- a/tests/error/type_not_template.gw +++ b/tests/error/type_not_template.gw @@ -1,2 +1,2 @@ #! [contains] is not template -var Object<[int] o; +var Object:[int] o; diff --git a/tests/error/typedef_func_tmpl_types.gw b/tests/error/typedef_func_tmpl_types.gw index 10bec2e9..502f3f31 100644 --- a/tests/error/typedef_func_tmpl_types.gw +++ b/tests/error/typedef_func_tmpl_types.gw @@ -1,15 +1,15 @@ #! [contains] pre-defined types -typedef void t_ptr<[A](); +typedef void t_ptr:[A](); -var t_ptr<[int] iptr; +var t_ptr:[int] iptr; -fun void test<[A]() { +fun void test:[A]() { var A a; <<< __func__, " ", a>>>; } test @=> iptr; <<< iptr() >>>; -<<< iptr<[int]() >>>; -<<< iptr<[float]() >>>; -<<< iptr<[Object]() >>>; +<<< iptr:[int]() >>>; +<<< iptr:[float]() >>>; +<<< iptr:[Object]() >>>; diff --git a/tests/error/typedef_func_tmpl_types2.gw b/tests/error/typedef_func_tmpl_types2.gw index 7fad8985..fcc804bf 100644 --- a/tests/error/typedef_func_tmpl_types2.gw +++ b/tests/error/typedef_func_tmpl_types2.gw @@ -1,11 +1,11 @@ #! [contains] pre-defined types -typedef void t_ptr<[A](); -typedef t_ptr<[int] B; +typedef void t_ptr:[A](); +typedef t_ptr:[int] B; -fun void test<[A]() { +fun void test:[A]() { <<< __func__ >>>; } test @=> var B b; <<< b() >>>; -<<< b<[int]() >>>; +<<< b:[int]() >>>; diff --git a/tests/fork/fork_call.gw b/tests/fork/fork_call.gw index abf5b351..9164468b 100644 --- a/tests/fork/fork_call.gw +++ b/tests/fork/fork_call.gw @@ -2,7 +2,7 @@ fun int test() { return 12; } -fork test() @=> ref TypedFork<[int] sh; +fork test() @=> ref TypedFork:[int] sh; <<< typeof(sh) >>>; sh.ev => now; <<< sh.retval >>>; diff --git a/tests/fptr/fptr_tmpl_cast.gw b/tests/fptr/fptr_tmpl_cast.gw index 778231db..670e3169 100644 --- a/tests/fptr/fptr_tmpl_cast.gw +++ b/tests/fptr/fptr_tmpl_cast.gw @@ -1,5 +1,5 @@ class C { - typedef void ptr_t<[A](); - fun void test<[A]() {} + typedef void ptr_t:[A](); + fun void test:[A]() {} test $ ptr_t; } diff --git a/tests/import/class_template.c b/tests/import/class_template.c index d52811a7..d7ea4297 100644 --- a/tests/import/class_template.c +++ b/tests/import/class_template.c @@ -25,17 +25,17 @@ static CTOR(class_template_ctor) { } GWION_IMPORT(class_template) { - GWI_OB(gwi_class_ini(gwi, "<[A,B]ClassTemplate", NULL)) + GWI_OB(gwi_class_ini(gwi, ":[A,B]ClassTemplate", NULL)) gwi_class_xtor(gwi, class_template_ctor, NULL); GWI_BB(gwi_item_ini(gwi, "A[]", "key")) GWI_BB((o_map_key = gwi_item_end(gwi, ae_flag_member | ae_flag_template, NULL))) GWI_BB(gwi_item_ini(gwi, "B[]", "value")) GWI_BB((o_map_value = gwi_item_end(gwi, ae_flag_member, NULL))) - GWI_BB(gwi_func_ini(gwi, "int", "<[C,D]test")) + GWI_BB(gwi_func_ini(gwi, "int", ":[C,D]test")) GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) GWI_BB(gwi_class_end(gwi)) - GWI_BB(gwi_item_ini(gwi, "<[<[int]Ptr,int[]]ClassTemplate", "testObject")) + GWI_BB(gwi_item_ini(gwi, ":[:[int]Ptr,int[]]ClassTemplate", "testObject")) GWI_BB(gwi_item_end(gwi, ae_flag_none, NULL)) return GW_OK; } diff --git a/tests/import/class_template.gw b/tests/import/class_template.gw index 17a85b24..38432690 100644 --- a/tests/import/class_template.gw +++ b/tests/import/class_template.gw @@ -1,2 +1,2 @@ -var ClassTemplate<[int, int] ct; +var ClassTemplate:[int, int] ct; <<< ct.key >>>; diff --git a/tests/import/class_template_fail.c b/tests/import/class_template_fail.c index 1b79d17f..b766a45e 100644 --- a/tests/import/class_template_fail.c +++ b/tests/import/class_template_fail.c @@ -10,7 +10,7 @@ #include "gwi.h" GWION_IMPORT(class_template_fail) { - GWI_OB(gwi_class_ini(gwi, "<[A,B]ClassTemplate", NULL)) + GWI_OB(gwi_class_ini(gwi, ":[A,B]ClassTemplate", NULL)) GWI_BB(gwi_func_ini(gwi, "int", "test")) GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) GWI_BB(gwi_class_end(gwi)) diff --git a/tests/import/class_template_invalid.c b/tests/import/class_template_invalid.c index d99513c2..fdd14dea 100644 --- a/tests/import/class_template_invalid.c +++ b/tests/import/class_template_invalid.c @@ -15,16 +15,16 @@ static m_int o_map_value; #define MAP_VAL(a) *((M_Object*)(a->data + o_map_value)) GWION_IMPORT(class_template) { - GWI_OB(gwi_class_ini(gwi, "ClassTemplate<[A,B]", NULL)) + GWI_OB(gwi_class_ini(gwi, "ClassTemplate:[A,B]", NULL)) GWI_BB(gwi_item_ini(gwi, "A[]", "key")) GWI_BB((o_map_key = gwi_item_end(gwi, ae_flag_member | ae_flag_template, NULL))) GWI_BB(gwi_item_ini(gwi, "B[]", "value")) GWI_BB((o_map_value = gwi_item_end(gwi, ae_flag_member, NULL))) - GWI_BB(gwi_func_ini(gwi, "int", "test<[C,D]")) + GWI_BB(gwi_func_ini(gwi, "int", "test:[C,D]")) GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) GWI_BB(gwi_class_end(gwi)) - GWI_BB(gwi_item_ini(gwi, "ClassTemplate<[<[int]Ptr,int[]]", "testObject")) + GWI_BB(gwi_item_ini(gwi, "ClassTemplate:[:[int]Ptr,int[]]", "testObject")) GWI_BB(gwi_item_end(gwi, ae_flag_none, NULL)) return GW_OK; } diff --git a/tests/import/fptr_tmpl.c b/tests/import/fptr_tmpl.c index ad8170ba..4fbbf110 100644 --- a/tests/import/fptr_tmpl.c +++ b/tests/import/fptr_tmpl.c @@ -11,7 +11,7 @@ GWION_IMPORT(typedef_test) { Type t_func_typedef; GWI_OB((t_func_typedef = gwi_mk_type(gwi, "FuncTypedef", SZ_INT , NULL))) - GWI_BB(gwi_fptr_ini(gwi, "int", "test<[test]")) + GWI_BB(gwi_fptr_ini(gwi, "int", "test:[test]")) GWI_OB(gwi_fptr_end(gwi, 0)) return GW_OK; } diff --git a/tests/import/fptr_tmpl_fail.c b/tests/import/fptr_tmpl_fail.c index c933e51d..e00773d2 100644 --- a/tests/import/fptr_tmpl_fail.c +++ b/tests/import/fptr_tmpl_fail.c @@ -9,7 +9,7 @@ #include "import.h" GWION_IMPORT(typedef_test) { - GWI_BB(gwi_fptr_ini(gwi, "int~", "test<[A]")) + GWI_BB(gwi_fptr_ini(gwi, "int~", "test:[A]")) GWI_OB(gwi_fptr_end(gwi, 0)) return GW_OK; } diff --git a/tests/import/func_fail2.c b/tests/import/func_fail2.c index f7ac835a..d848eaa6 100644 --- a/tests/import/func_fail2.c +++ b/tests/import/func_fail2.c @@ -10,7 +10,7 @@ #include "instr.h" GWION_IMPORT(too_many_args) { - GWI_BB(gwi_func_ini(gwi, "<[int]Ptr", "test")) + GWI_BB(gwi_func_ini(gwi, ":[int]Ptr", "test")) GWI_BB(gwi_func_arg(gwi, "int", "i[][]")) GWI_BB(gwi_func_arg(gwi, "int", "me")) GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) diff --git a/tests/import/func_fail3.c b/tests/import/func_fail3.c index 0a260a48..efd5c208 100644 --- a/tests/import/func_fail3.c +++ b/tests/import/func_fail3.c @@ -10,7 +10,7 @@ #include "instr.h" GWION_IMPORT(too_many_args) { - GWI_BB(gwi_func_ini(gwi, "Ptr<[int]", "test<[A]")) + GWI_BB(gwi_func_ini(gwi, "Ptr:[int]", "test:[A]")) GWI_BB(gwi_func_ini(gwi, "int", "test")) GWI_BB(gwi_func_arg(gwi, "int", "i[][]")) GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) diff --git a/tests/import/func_fail4.c b/tests/import/func_fail4.c index c7db6f12..0bb4c59b 100644 --- a/tests/import/func_fail4.c +++ b/tests/import/func_fail4.c @@ -10,7 +10,7 @@ #include "instr.h" GWION_IMPORT(too_many_args) { - GWI_BB(gwi_func_ini(gwi, "Ptr<[int]", "test<[A]")) + GWI_BB(gwi_func_ini(gwi, "Ptr:[int]", "test:[A]")) GWI_BB(gwi_func_arg(gwi, "int", "i[][]")) GWI_BB(gwi_item_end(gwi, ae_flag_none, NULL)) return GW_OK; diff --git a/tests/import/func_tmpl.c b/tests/import/func_tmpl.c index eb0aa9c2..5f3c22c9 100644 --- a/tests/import/func_tmpl.c +++ b/tests/import/func_tmpl.c @@ -14,7 +14,7 @@ static SFUN(func_tmpl_xfun) { } GWION_IMPORT(func_tmpl) { - GWI_BB(gwi_func_ini(gwi, "int[]", "test<[A]")) + GWI_BB(gwi_func_ini(gwi, "int[]", "test:[A]")) GWI_BB(gwi_func_arg(gwi, "A", "i")) GWI_BB(gwi_func_end(gwi, func_tmpl_xfun, ae_flag_none)) return GW_OK; diff --git a/tests/import/func_tmpl.gw b/tests/import/func_tmpl.gw index de01ac33..5916a402 100644 --- a/tests/import/func_tmpl.gw +++ b/tests/import/func_tmpl.gw @@ -1,2 +1,2 @@ -test<[int](1); +test:[int](1); test(1); diff --git a/tests/import/func_tmpl_fail.c b/tests/import/func_tmpl_fail.c index 0096a1e3..b61758ce 100644 --- a/tests/import/func_tmpl_fail.c +++ b/tests/import/func_tmpl_fail.c @@ -14,7 +14,7 @@ static SFUN(func_tmpl_xfun) { } GWION_IMPORT(func_tmpl) { - GWI_BB(gwi_func_ini(gwi, "voit", "test<[A]")) + GWI_BB(gwi_func_ini(gwi, "voit", "test:[A]")) GWI_BB(gwi_func_end(gwi, func_tmpl_xfun, ae_flag_none)) return GW_OK; } diff --git a/tests/import/invalid_names.c b/tests/import/invalid_names.c index 1340149c..6c70861e 100644 --- a/tests/import/invalid_names.c +++ b/tests/import/invalid_names.c @@ -22,7 +22,7 @@ GWION_IMPORT(trig) { const Type t2 = gwi_mk_type(gwi, "T", SZ_INT, NULL); gwi_add_type(gwi, t2); - const Type t3 = gwi_mk_type(gwi, "T<[a]", SZ_INT, NULL); + const Type t3 = gwi_mk_type(gwi, "T:[a]", SZ_INT, NULL); gwi_add_type(gwi, t3); return GW_OK; diff --git a/tests/import/invalid_names3.c b/tests/import/invalid_names3.c index 159640a9..4304e377 100644 --- a/tests/import/invalid_names3.c +++ b/tests/import/invalid_names3.c @@ -13,6 +13,6 @@ #include "gwi.h" GWION_IMPORT(trig) { - DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T<[a]", SZ_INT, NULL)) + DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T:[a]", SZ_INT, NULL)) return gwi_add_type(gwi, t0); } diff --git a/tests/import/map2.gw b/tests/import/map2.gw index f6f40abd..0d18b4b0 100644 --- a/tests/import/map2.gw +++ b/tests/import/map2.gw @@ -1,4 +1,4 @@ -var Map<[int, float] pp; +var Map:[int, float] pp; <<< pp >>>; <<< pp.size() >>>; <<< pp.set(1, 2) >>>; diff --git a/tests/import/typedef_fail.c b/tests/import/typedef_fail.c index 78bb00f7..a2a4dfc1 100644 --- a/tests/import/typedef_fail.c +++ b/tests/import/typedef_fail.c @@ -9,7 +9,7 @@ #include "import.h" GWION_IMPORT(typedef_test) { - GWI_BB(gwi_typedef_ini(gwi, "int", "Typedef<[A]")) - GWI_BB(gwi_typedef_ini(gwi, "int", "Typedef<[A]")) + GWI_BB(gwi_typedef_ini(gwi, "int", "Typedef:[A]")) + GWI_BB(gwi_typedef_ini(gwi, "int", "Typedef:[A]")) return GW_OK; } diff --git a/tests/import/typedef_tmpl.c b/tests/import/typedef_tmpl.c index 91e36b81..44575419 100644 --- a/tests/import/typedef_tmpl.c +++ b/tests/import/typedef_tmpl.c @@ -9,7 +9,7 @@ #include "import.h" GWION_IMPORT(typedef_test) { - GWI_BB(gwi_typedef_ini(gwi, "Ptr<[A]", "Typedef<[A]")) + GWI_BB(gwi_typedef_ini(gwi, "Ptr:[A]", "Typedef:[A]")) GWI_OB(gwi_typedef_end(gwi, ae_flag_none)) return GW_OK; } diff --git a/tests/import/union_tmpl.c b/tests/import/union_tmpl.c index 95208de4..049f6d40 100644 --- a/tests/import/union_tmpl.c +++ b/tests/import/union_tmpl.c @@ -9,7 +9,7 @@ #include "import.h" GWION_IMPORT(union_test) { - GWI_BB(gwi_union_ini(gwi, "U<[A]", NULL)) + GWI_BB(gwi_union_ini(gwi, "U:[A]", NULL)) GWI_BB(gwi_union_add(gwi,"float", "f")) GWI_BB(gwi_union_add(gwi,"int", "i")) GWI_BB(gwi_union_add(gwi,"A", "a")) diff --git a/tests/import/union_tmpl.gw b/tests/import/union_tmpl.gw index a8c2dc1a..5d6c0c60 100644 --- a/tests/import/union_tmpl.gw +++ b/tests/import/union_tmpl.gw @@ -1,2 +1,2 @@ -<<< var U<[Event] u>>>; +<<< var U:[Event] u>>>; <<< u.a >>>; diff --git a/tests/import/union_tmpl_fail.c b/tests/import/union_tmpl_fail.c index 1533c1ea..f38840f7 100644 --- a/tests/import/union_tmpl_fail.c +++ b/tests/import/union_tmpl_fail.c @@ -9,7 +9,7 @@ #include "import.h" GWION_IMPORT(union_test) { - GWI_BB(gwi_union_ini(gwi, "U<[A]", "My")) + GWI_BB(gwi_union_ini(gwi, "U:[A]", "My")) GWI_BB(gwi_union_add(gwi,"float", "f")) GWI_BB(gwi_union_add(gwi,"int", "i")) GWI_BB(gwi_union_add(gwi,"A", "a")) diff --git a/tests/import/union_tmpl_fail2.c b/tests/import/union_tmpl_fail2.c index f5377937..0cf882e5 100644 --- a/tests/import/union_tmpl_fail2.c +++ b/tests/import/union_tmpl_fail2.c @@ -9,11 +9,11 @@ #include "import.h" GWION_IMPORT(union_test) { - GWI_BB(gwi_union_ini(gwi, "U<[A]", NULL)) + GWI_BB(gwi_union_ini(gwi, "U:[A]", NULL)) GWI_BB(gwi_union_add(gwi,"float", "f")) GWI_BB(gwi_union_add(gwi,"int", "i")) GWI_BB(gwi_union_add(gwi,"A", "a")) - GWI_BB(gwi_union_ini(gwi, "U<[A]", NULL)) + GWI_BB(gwi_union_ini(gwi, "U:[A]", NULL)) GWI_OB(gwi_union_end(gwi, 0)) return GW_OK; } diff --git a/tests/import/union_tmpl_fail3.c b/tests/import/union_tmpl_fail3.c index 2973eff2..36afd1f0 100644 --- a/tests/import/union_tmpl_fail3.c +++ b/tests/import/union_tmpl_fail3.c @@ -9,7 +9,7 @@ #include "import.h" GWION_IMPORT(union_test) { - GWI_BB(gwi_union_ini(gwi, "U<[A]", "Test")) + GWI_BB(gwi_union_ini(gwi, "U:[A]", "Test")) GWI_BB(gwi_union_add(gwi,"float", "f")) GWI_BB(gwi_union_add(gwi,"int", "i")) GWI_BB(gwi_union_add(gwi,"A", "a")) diff --git a/tests/new/dottmpl.gw b/tests/new/dottmpl.gw index 1ec515e0..588a2856 100644 --- a/tests/new/dottmpl.gw +++ b/tests/new/dottmpl.gw @@ -1,5 +1,5 @@ class C { - fun void test<[A](A a) { <<< a >>>; } + fun void test:[A](A a) { <<< a >>>; } } class D extends C {} diff --git a/tests/new/dtor.gw b/tests/new/dtor.gw index ff2aa6ff..2d4afac4 100644 --- a/tests/new/dtor.gw +++ b/tests/new/dtor.gw @@ -1,10 +1,10 @@ -class C<[A] { +class C:[A] { operator @dtor void () { <<< __func__ >>>; } } -class D<[A] extends C<[A] { +class D:[A] extends C:[A] { operator @dtor void () { <<< __func__ >>>; } } -class E extends D<[int] { +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 01062dd9..6eb2e8f9 100644 --- a/tests/new/extend_template_union.gw +++ b/tests/new/extend_template_union.gw @@ -1,25 +1,25 @@ -union U<[A] { +union U:[A] { A a; int i; }; -class C<[A] extends U<[A] { +class C:[A] extends U:[A] { fun void test() { <<< this >>>; } operator @dtor void () { <<< __func__ >>>; } } -var C<[float] c; +var C:[float] c; <<< c >>>; <<< c.test() >>>; <<< c.i >>>; -class D<[A,B] extends C<[float] { +class D:[A,B] extends C:[float] { } -var D<[int,int] d; -class E<[A,B] extends D<[float,B] { +var D:[int,int] d; +class E:[A,B] extends D:[float,B] { } -var E<[int,int] e; +var E:[int,int] e; diff --git a/tests/new/parent.gw b/tests/new/parent.gw index 8b942f4b..5a92c75a 100644 --- a/tests/new/parent.gw +++ b/tests/new/parent.gw @@ -1,14 +1,14 @@ class B { } -class C<[A] extends B { +class C:[A] extends B { } -class D<[A,B] extends C<[A] { - class Child<[A] { +class D:[A,B] extends C:[A] { + class Child:[A] { var A a; } - var Child<[A] child; + var Child:[A] child; } -var D<[int] d; +var D:[int] d; diff --git a/tests/new/pure.gw b/tests/new/pure.gw index 768ad80e..8eaf8bea 100644 --- a/tests/new/pure.gw +++ b/tests/new/pure.gw @@ -1,4 +1,4 @@ -fun A pure<[A](A i) { return i; } +fun A pure:[A](A i) { return i; } <<< 2 => pure >>>; <<< 2 => pure >>>; <<< 3 => pure >>>; diff --git a/tests/new/pure_member.gw b/tests/new/pure_member.gw index 97b28985..15a20fc4 100644 --- a/tests/new/pure_member.gw +++ b/tests/new/pure_member.gw @@ -1,5 +1,5 @@ class C { - fun A pure<[A](A i) { + fun A pure:[A](A i) { return i; } <<< 2 => pure >>>; diff --git a/tests/new/recursive_template.gw b/tests/new/recursive_template.gw index 6ec6a78d..e85dbea0 100644 --- a/tests/new/recursive_template.gw +++ b/tests/new/recursive_template.gw @@ -1,8 +1,8 @@ -fun void test<[A](int i, A a) { +fun void test:[A](int i, A a) { var A b; <<< __func__, " ", a >>>; <<< i, " ", a >>>; if(i) - test<[int]((i-2, b$int)); + test:[int]((i-2, b$int)); } -test<[float](2, 2); +test:[float](2, 2); diff --git a/tests/new/recursive_template0.gw b/tests/new/recursive_template0.gw index 037b7cc0..1e3de8f5 100644 --- a/tests/new/recursive_template0.gw +++ b/tests/new/recursive_template0.gw @@ -1,8 +1,8 @@ -fun void test<[A](int i) { +fun void test:[A](int i) { var A a; <<< a >>>; <<< __func__, " ", i, " ", a >>>; if(i) - test<[float]((i-2)); + test:[float]((i-2)); } -test<[float](2); +test:[float](2); diff --git a/tests/new/recursive_template1.gw b/tests/new/recursive_template1.gw index cdc88c9f..a45d0525 100644 --- a/tests/new/recursive_template1.gw +++ b/tests/new/recursive_template1.gw @@ -1,7 +1,7 @@ -fun void test<[A](int i) { +fun void test:[A](int i) { var A a; <<< a >>>; if(i) - test<[float]((i-2)); + test:[float]((i-2)); } -test<[Object](2); +test:[Object](2); diff --git a/tests/new/recursive_template2.gw b/tests/new/recursive_template2.gw index 7f6b8924..f9ef97c5 100644 --- a/tests/new/recursive_template2.gw +++ b/tests/new/recursive_template2.gw @@ -1,8 +1,8 @@ -fun void test<[A](A i) { +fun void test:[A](A i) { var A a; <<< a , " ", __func__>>>; <<< i, " ", a >>>; if(i > 0) test(i-2.0); } -test<[int](2); +test:[int](2); diff --git a/tests/new/recursive_template3.gw b/tests/new/recursive_template3.gw index de5fd67a..dc7e31b9 100644 --- a/tests/new/recursive_template3.gw +++ b/tests/new/recursive_template3.gw @@ -1,4 +1,4 @@ -fun void test<[A](A i) { +fun void test:[A](A i) { var A a; <<< a >>>; <<< i, " ", a, " ", i > 1 >>>; diff --git a/tests/new/recursive_template_test.gw b/tests/new/recursive_template_test.gw index 84f91766..39d0b963 100644 --- a/tests/new/recursive_template_test.gw +++ b/tests/new/recursive_template_test.gw @@ -1,6 +1,6 @@ -fun void test<[A](int i) { +fun void test:[A](int i) { <<< __func__ >>>; <<< 1 >>>; } -test<[int](1); +test:[int](1); diff --git a/tests/new/static_tmpl2.gw b/tests/new/static_tmpl2.gw index e9ea5b68..7ceaca35 100644 --- a/tests/new/static_tmpl2.gw +++ b/tests/new/static_tmpl2.gw @@ -3,4 +3,4 @@ class D extends C { } var D d; <<< d >>>; -<<< d.t<[int]() >>>; +<<< d.t:[int]() >>>; diff --git a/tests/new/template_class_in_template.gw b/tests/new/template_class_in_template.gw index 324c0c06..efdc68c1 100644 --- a/tests/new/template_class_in_template.gw +++ b/tests/new/template_class_in_template.gw @@ -1,8 +1,8 @@ -class Parent<[A] { - class C<[B] { +class Parent:[A] { + class C:[B] { 12 => var A a; 13 => var B B; } } -var Parent.C<[int, int] c; +var Parent.C:[int, int] c; <<< c.a >>>; diff --git a/tests/new/template_dyn.gw b/tests/new/template_dyn.gw index aabab6c9..9f13a937 100644 --- a/tests/new/template_dyn.gw +++ b/tests/new/template_dyn.gw @@ -1,13 +1,13 @@ class C { - fun int test<[A](A a) { <<< " A ", a >>>; } - fun int test<[A](A a, int i) { <<< " A ", a, " ", __func__ >>>; } - fun int test<[A](A a, int i, int j) { <<< a >>>; } + fun int test:[A](A a) { <<< " A ", a >>>; } + fun int test:[A](A a, int i) { <<< " A ", a, " ", __func__ >>>; } + fun int test:[A](A a, int i, int j) { <<< a >>>; } } class D extends C { - fun int test<[A](A a, int i) { <<< this, " extent ", a, __func__ >>>; } + fun int test:[A](A a, int i) { <<< this, " extent ", a, __func__ >>>; } } class E extends D { - fun int test<[A](A a, int i) { <<< this, " Extent ", a, __func__ >>>; } + fun int test:[A](A a, int i) { <<< this, " Extent ", a, __func__ >>>; } } diff --git a/tests/new/test.gw b/tests/new/test.gw index dcce4fa8..fb9ebba0 100644 --- a/tests/new/test.gw +++ b/tests/new/test.gw @@ -1,6 +1,6 @@ class C { - typedef static void func_t<[A](A a); - fun static void myfunc<[A](A a) { <<< 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); } diff --git a/tests/new/test2.gw b/tests/new/test2.gw index 65ef15ef..760fa7a7 100644 --- a/tests/new/test2.gw +++ b/tests/new/test2.gw @@ -1,8 +1,8 @@ -class C<[A] { - typedef static void func_t<[A](A a); - fun static void myfunc<[A](A a) { <<< a >>>; } +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 C<[int] c; +var C:[int] c; diff --git a/tests/new/typedef_func_tmpl_class.gw b/tests/new/typedef_func_tmpl_class.gw index 798cc7d1..f87ad63a 100644 --- a/tests/new/typedef_func_tmpl_class.gw +++ b/tests/new/typedef_func_tmpl_class.gw @@ -1,9 +1,9 @@ class C { - typedef void t_ptr<[A](); + typedef void t_ptr:[A](); - var t_ptr<[int] iptr; + var t_ptr:[int] iptr; - fun void test<[A]() { + 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 347a7f85..d1403022 100644 --- a/tests/new/typedef_func_tmpl_class_static.gw +++ b/tests/new/typedef_func_tmpl_class_static.gw @@ -1,9 +1,9 @@ class C { - typedef static void t_ptr<[A](); + typedef static void t_ptr:[A](); - var t_ptr<[int] iptr; + var t_ptr:[int] iptr; - fun static void test<[A]() { + fun static void test:[A]() { <<< __func__ >>>; } diff --git a/tests/new/typedef_func_tmpl_err.gw b/tests/new/typedef_func_tmpl_err.gw index dbf92dc2..a23a1ec8 100644 --- a/tests/new/typedef_func_tmpl_err.gw +++ b/tests/new/typedef_func_tmpl_err.gw @@ -1,10 +1,10 @@ -typedef void t_ptr<[A](); +typedef void t_ptr:[A](); var t_ptr ptr; -fun void test<[A]() { +fun void test:[A]() { <<< __func_ >>>; } test @=> ptr; -ptr<[int](); +ptr:[int](); diff --git a/tests/new/typedef_func_tmpl_tmpl.gw b/tests/new/typedef_func_tmpl_tmpl.gw index c3cc7cfb..4e47c18e 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 ptr_t<[ Ptr<[A] ] t; +typedef void ptr_t:[A](myPtr ptr); +var ptr_t:[ Ptr:[A] ] t; diff --git a/tests/regression/invalid_template.gw b/tests/regression/invalid_template.gw index b82e5c28..9afbad7b 100644 --- a/tests/regression/invalid_template.gw +++ b/tests/regression/invalid_template.gw @@ -1,12 +1,12 @@ class B {} -class C<[A] extends B{} +class C:[A] extends B{} -class D<[A,B] extends C<[A] { - class E<[A] {} +class D:[A,B] extends C:[A] { + class E:[A] {} class G extends ld {A0I:} - var D<[A] d; + var D:[A] d; } -var D<[int] d; +var D:[int] d; diff --git a/tests/struct/struct_template.gw b/tests/struct/struct_template.gw index 054e3749..c9291cc2 100644 --- a/tests/struct/struct_template.gw +++ b/tests/struct/struct_template.gw @@ -1,10 +1,10 @@ -struct S<[A] { +struct S:[A] { var A a0; var A a1; } -var D<[int] si; -var D<[float] 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 c9889e48..a9ca992b 100644 --- a/tests/tree/auto_ptr.gw +++ b/tests/tree/auto_ptr.gw @@ -1,4 +1,4 @@ -var Ptr<[int] ptr; +var Ptr:[int] ptr; var int i[4]; foreach(ref a : i) <<< *a >>>; diff --git a/tests/tree/call_nonnull.gw b/tests/tree/call_nonnull.gw index 66d621d3..982684d0 100644 --- a/tests/tree/call_nonnull.gw +++ b/tests/tree/call_nonnull.gw @@ -1,3 +1,3 @@ -typedef void test_t<[A](); +typedef void test_t:[A](); nonnull test_t t; -t<[int](); +t:[int](); diff --git a/tests/tree/class_not_template_inside_template.gw b/tests/tree/class_not_template_inside_template.gw index 00fdecf8..74e28df8 100644 --- a/tests/tree/class_not_template_inside_template.gw +++ b/tests/tree/class_not_template_inside_template.gw @@ -1,7 +1,7 @@ -class C<[A] { +class C:[A] { class D { } } -var C.D<[int] d; +var C.D:[int] d; diff --git a/tests/tree/class_template.gw b/tests/tree/class_template.gw index 3cbeb052..5dbed0f8 100644 --- a/tests/tree/class_template.gw +++ b/tests/tree/class_template.gw @@ -1,17 +1,17 @@ -class C<[A,B] { +class C:[A,B] { var A a; var B b; fun A test() { <<< "lol" >>>; } - fun void test2<[C](C o) { + fun void test2:[C](C o) { <<< o >>>; } } -var C<[int, int] c; -var C<[float, int] d; -var C<[Object, int] 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 c95dd2c4..5e3c73cc 100644 --- a/tests/tree/cpy_ast.gw +++ b/tests/tree/cpy_ast.gw @@ -1,4 +1,4 @@ -class C<[A] { +class C:[A] { \a{}; [ 1 ]; var int i,j; @@ -9,7 +9,7 @@ class C<[A] { i ? i : !i; ++i; union { int ui; } u; - union U<[A] { 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 C<[A] { while(0){ <<< __func__ >>>; } } -var C<[int] c; +var C:[int] c; diff --git a/tests/tree/extent_template.gw b/tests/tree/extent_template.gw index 6fefe48a..fd8e5336 100644 --- a/tests/tree/extent_template.gw +++ b/tests/tree/extent_template.gw @@ -1,8 +1,8 @@ -class C<[A] { +class C:[A] { var A a; } -class D extends C<[int] {} +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 cb087261..b0f9f7dd 100644 --- a/tests/tree/get_type_name_test.gw +++ b/tests/tree/get_type_name_test.gw @@ -1,4 +1,4 @@ -class C<[A, B] {} -class D<[A] {} -var C<[ D<[int], D<[int] ] 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 35cb332f..704ad6b5 100644 --- a/tests/tree/static_template.gw +++ b/tests/tree/static_template.gw @@ -1,9 +1,9 @@ -class C<[A] { +class C:[A] { var A a; } class D { - var static C<[int] c; + var static C:[int] c; } var D d; diff --git a/tests/tree/static_tmpl.gw b/tests/tree/static_tmpl.gw index 6bc86483..b06f737b 100644 --- a/tests/tree/static_tmpl.gw +++ b/tests/tree/static_tmpl.gw @@ -1,14 +1,14 @@ class global StaticTmpl { - fun static void t<[A]() { <<< __func__ >>>; } + fun static void t:[A]() { <<< __func__ >>>; } } class D extends StaticTmpl { } fun void test(StaticTmpl c) { - StaticTmpl.t<[int](); + StaticTmpl.t:[int](); } #!D d; -#!d.t<[int](); +#!d.t:[int](); #!d => test; diff --git a/tests/tree/template_class_invalid_type_number.gw b/tests/tree/template_class_invalid_type_number.gw index bf9eae58..89d37a73 100644 --- a/tests/tree/template_class_invalid_type_number.gw +++ b/tests/tree/template_class_invalid_type_number.gw @@ -1,3 +1,3 @@ -class C<[A] {} +class C:[A] {} -var C<[int, float] c; +var C:[int, float] c; diff --git a/tests/tree/template_class_ref.gw b/tests/tree/template_class_ref.gw index 068edf84..95cc2ca3 100644 --- a/tests/tree/template_class_ref.gw +++ b/tests/tree/template_class_ref.gw @@ -1,4 +1,4 @@ -class C<[A] {} +class C:[A] {} -var C<[int] c; +var C:[int] c; <<< c >>>; diff --git a/tests/tree/template_fptr.gw b/tests/tree/template_fptr.gw index 29c4fc09..fa7bf24e 100644 --- a/tests/tree/template_fptr.gw +++ b/tests/tree/template_fptr.gw @@ -1,9 +1,9 @@ -typedef int ptr_t<[A](A); +typedef int ptr_t:[A](A); var ptr_t ptr; <<>>; -fun int test<[A](A a) { <<< a >>>; } +fun int test:[A](A a) { <<< a >>>; } test @=> ptr; <<< ptr >>>; -ptr<[int](2); -ptr<[float](2.3); +ptr:[int](2); +ptr:[float](2.3); diff --git a/tests/tree/template_self.gw b/tests/tree/template_self.gw index d1ec8de8..2e6d7470 100644 --- a/tests/tree/template_self.gw +++ b/tests/tree/template_self.gw @@ -1,7 +1,7 @@ -class C<[A] { +class C:[A] { fun void test() { - var C<[A] c; + var C:[A] c; } } -var C<[int] c; +var C:[int] c; diff --git a/tests/tree/tmpl_fail_inner.gw b/tests/tree/tmpl_fail_inner.gw index cbbff371..bc4e4271 100644 --- a/tests/tree/tmpl_fail_inner.gw +++ b/tests/tree/tmpl_fail_inner.gw @@ -1,5 +1,5 @@ -fun void test<[A](int i) { - test<[A](2.3); +fun void test:[A](int i) { + test:[A](2.3); } -test<[int](3); +test:[int](3); diff --git a/tests/tree/typedef_func_tmpl.gw b/tests/tree/typedef_func_tmpl.gw index d6a059f8..ef274bf1 100644 --- a/tests/tree/typedef_func_tmpl.gw +++ b/tests/tree/typedef_func_tmpl.gw @@ -1,9 +1,9 @@ -typedef void t_ptr<[A](); +typedef void t_ptr:[A](); -var t_ptr<[int] iptr; -var t_ptr<[float] fptr; +var t_ptr:[int] iptr; +var t_ptr:[float] fptr; -fun void test<[A]() { +fun void test:[A]() { <<< __func__ >>>; } diff --git a/tests/tree/typedef_func_tmpl2.gw b/tests/tree/typedef_func_tmpl2.gw index 7638b8df..af9900e5 100644 --- a/tests/tree/typedef_func_tmpl2.gw +++ b/tests/tree/typedef_func_tmpl2.gw @@ -1,9 +1,9 @@ -typedef void t_ptr<[A](); -fun void test<[A]() { +typedef void t_ptr:[A](); +fun void test:[A]() { <<< __func__ >>>; } -typedef t_ptr<[int] B; +typedef t_ptr:[int] B; var B b; <<< b >>>; test @=> b; @@ -12,7 +12,7 @@ test @=> b; <<< b() >>>; -typedef t_ptr<[float] 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 2ff8af8e..f5bb6e36 100644 --- a/tests/tree/typedef_func_tmpl_class.gw +++ b/tests/tree/typedef_func_tmpl_class.gw @@ -1,9 +1,9 @@ class C { - typedef void t_ptr<[A](); + typedef void t_ptr:[A](); - var t_ptr<[int] iptr; + var t_ptr:[int] iptr; - fun void test<[A]() { + fun void test:[A]() { <<< this, " ", __func__ >>>; } diff --git a/tests/tree/union_tmpl.gw b/tests/tree/union_tmpl.gw index 4ca78690..e01a87f5 100644 --- a/tests/tree/union_tmpl.gw +++ b/tests/tree/union_tmpl.gw @@ -1,7 +1,7 @@ -union U<[A]{ +union U:[A]{ int i; A a; }; -var U<[float] u; +var U:[float] u; <<< u.a >>>; -- 2.43.0