From a9ce51cc683616aefd3299b5136d31c596dcffef Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 14 Sep 2020 00:29:31 +0200 Subject: [PATCH] :art: Close templates with ']' --- 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 +++--- src/env/func.c | 2 +- src/env/type.c | 19 ++++++++++--------- src/import/checker.c | 8 ++++---- src/lib/object_op.c | 9 ++++----- src/lib/ptr.c | 2 +- src/lib/shred.c | 2 +- src/parse/check.c | 2 +- src/parse/operator.c | 7 +++++-- 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 ++-- .../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 +++--- .../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 ++-- 107 files changed, 238 insertions(+), 235 deletions(-) diff --git a/ast b/ast index 39ad6755..d572b7d3 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 39ad675551cd32f3ad2125f3cf9afe6ac416c99e +Subproject commit d572b7d308e6948f0dd4d328aa07050d42e8fdcd diff --git a/examples/binary_tmpl.gw b/examples/binary_tmpl.gw index 0978dc08..0b1d2e32 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 621474fa..c7f0361a 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 d0dd5f5a..8bbe4202 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 9337a789..e72f76b3 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 6ad53830..2d0ebca9 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 7de28025..a0355c24 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 c13384e0..90b6e818 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 64d76018..a893f702 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 85b2d1d8..922779d5 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 0cc9c740..a0a0be77 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 57552d84..82b82bbd 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/src/env/func.c b/src/env/func.c index 05303306..b33113bb 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 d67dea02..a357b639 100644 --- a/src/env/type.c +++ b/src/env/type.c @@ -144,22 +144,24 @@ ANN m_bool type_ref(Type t) { return 0; } + ANN m_str get_type_name(const Env env, const Type t, const m_uint index) { - if(!index || t->name[0] != '<') + if(!index) + return NULL; + m_str name = strchr(t->name, '<'); + if(!name) return NULL; - m_str name = t->name + 2; + name += 2; + const size_t slen = strlen(name); m_uint lvl = 0; m_uint n = 1; - const size_t slen = strlen(name); char c, buf[slen + 1], *tmp = buf; while((c = *name)) { if(c == '<') ++lvl; - else if(c == '>') { - if(!lvl-- && n == index) { - --tmp; + else if(c == ']') { + if(!lvl-- && n == index) break; - } } else if(c == ',') { if(!lvl && n++ == index) break; @@ -169,10 +171,9 @@ ANN m_str get_type_name(const Env env, const Type t, const m_uint index) { if(n == index) *tmp++ = *name; ++name; - } *tmp = '\0'; - return strlen(buf) ? s_name(insert_symbol(buf)) : NULL; + return tmp - buf ? s_name(insert_symbol(buf)) : NULL; } ANN m_uint get_depth(const Type type) { diff --git a/src/import/checker.c b/src/import/checker.c index d371e8ab..0b07cd84 100644 --- a/src/import/checker.c +++ b/src/import/checker.c @@ -114,13 +114,13 @@ ANN static ID_List __tmpl_list(const Gwi gwi, struct td_checker *tdc) { const ID_List list = _tmpl_list(gwi, tdc); if(list == (ID_List)GW_ERROR) return (ID_List)GW_ERROR; - if(tdc->str[0] != '~' || tdc->str[1] != '>') { + if(tdc->str[0] != ']') { // unfinished template if(list) free_id_list(gwi->gwion->mp, list); return (ID_List)GW_ERROR; } - tdc->str += 2; + ++tdc->str; return list; } @@ -203,12 +203,12 @@ ANN static Type_List td_tmpl(const Gwi gwi, struct td_checker *tdc) { Type_List tl = __str2tl(gwi, tdc); if(!tl) return (Type_List)GW_ERROR; - if(tdc->str[0] != '~' || tdc->str[1] != '>') { + if(tdc->str[0] != ']') { free_type_list(gwi->gwion->mp, tl); GWI_ERR("unfinished template"); return (Type_List)GW_ERROR; } - tdc->str += 2; + ++tdc->str; return tl; } diff --git a/src/lib/object_op.c b/src/lib/object_op.c index cfa04a18..f7897fb3 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -300,7 +300,7 @@ ANN static ssize_t template_size(const Env env, struct tmpl_info* info) { size += tmpl_set(info, t); } while((call = call->next) && (base = base->next) && ++size); size += tmpl_set(info, info->cdef->base.type); - return size + 16 + 3; + return size + 16 + 2; } ANN static inline m_str tmpl_get(struct tmpl_info* info, m_str str) { @@ -311,19 +311,18 @@ ANN static inline m_str tmpl_get(struct tmpl_info* info, m_str str) { 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++ = '~'; - const m_uint size = vector_size(&info->type) -1; for(info->index = 0; info->index < size; ++info->index) { str = tmpl_get(info, str); if(info->index < size - 1) *str++ = ','; else { - *str++ = '~'; - *str++ = '>'; + *str++ = ']'; } } - str = tmpl_get(info, str); *str = '\0'; } diff --git a/src/lib/ptr.c b/src/lib/ptr.c index 9395b348..9c827e31 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 d0a105c7..6470e0be 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 85b04535..f3ec8508 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 e516d555..42231053 100644 --- a/src/parse/operator.c +++ b/src/parse/operator.c @@ -37,8 +37,11 @@ ANN void free_op_map(Map map, struct Gwion_ *gwion) { ANN static Type op_parent(const Env env, const Type t) { if(GET_FLAG(t, template) && GET_FLAG(t, ref)) { const Type type = typedef_base(t); - const m_str post = strrchr(type->name, '>') + 1; - return nspc_lookup_type1(env->curr, insert_symbol(env->gwion->st, post)); + char name[strlen(type->name)]; + strcpy(name, type->name); + const m_str post = strrchr(name, '<'); + *post = '\0'; + return nspc_lookup_type1(env->curr, insert_symbol(env->gwion->st, name)); } return t->e->parent; } diff --git a/tests/bug/Tester.gw b/tests/bug/Tester.gw index 7cacda5e..9543fe41 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 ea998b0f..3f4fbc21 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 a6d90f3b..355f7714 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 686f8e8f..514ec198 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 9860779a..532b399a 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 05eab60e..8242be5a 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 7c37eeb6..b6199792 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 3a840ad7..6210cec9 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 e562e571..8d2f737a 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 98e981b7..fee35e0f 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 6f314a78..2ae3194c 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 2c0cef0e..58f7e56f 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 74b77c72..2bd8bc51 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 1a19d773..0c08e70e 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 6f6f232d..022789d2 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 2b804442..62c98fec 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 bcb667d0..3963711a 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 5c1e04d5..cf3cb59d 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 e9009fe1..53057e2c 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 ee4ae5dc..6e4c17ce 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 90d12511..eac690d1 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 5501a52f..b6048595 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 0e3818eb..37cdb045 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 b2271ef1..325e407f 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 191e7ac2..9cd61bc9 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 2d123029..de484b22 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 5bdccfb1..bc69736d 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 e3c6335b..34c30e6d 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 6fdcc1d6..c43a7576 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 2ec528c3..615638c6 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 972a5e5d..e58a38ed 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 09402e9a..c7e7b294 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 06c7f384..2a57fcfc 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 0214bd24..0d3ce57c 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 4866c009..e197f4d3 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 f01dddad..af683b11 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 66ec9711..71555bd2 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 02c7033a..e341b701 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 4726b275..646fb509 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 e3151146..07110b16 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 1ae96db9..68bb50b7 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 aa65700d..ebe75a33 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 dbd5c468..145a65ce 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 57da35a8..ed39fe50 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 994dd3ee..aa445b2d 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 f8fa4eb9..69c3cd87 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 bd23ed18..46059e84 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 f2042753..994ef812 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 ded551f1..86a28d10 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 e2c240f6..7a7a9540 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 be0bcf46..eb6ed66d 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 d0c73455..ddd7fdd6 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 31d2c74e..a2cd8a45 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 b8ae7469..6f4db423 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 a671390d..7d117e38 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 f28daaf9..d2d81cc3 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 3b2e2b4a..c4daa96a 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 3ba98942..e9979758 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 dc620da0..47413b3f 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 4e0097a6..68895230 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 3734c12e..192c794b 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 1472590d..f8668643 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 2dae03fe..01748a62 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 19cfb8ee..9d01d796 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 17e43fdd..0bd3e581 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 9a9e0b9f..d456c84d 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 01835559..5e72cf3d 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 b70439a3..099f00e9 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 54abfb9c..9389e121 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 e770fb80..9162990e 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 4c020dec..ffd26566 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 2c13b37f..3683b2db 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 eb508866..32a7dbac 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 52041acf..2dd2e143 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 51d194f9..630164f4 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 015bb344..c20cdbd5 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 b4e9392a..aeb6864d 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 d4483887..a4eafd0d 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 148c178b..e780ec10 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 5448e880..2c3317c3 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 1b0d0a4b..f964e5cd 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 f47c25c8..be9d76c2 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 48074b72..b447f4ab 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 e56a09fa..13226a55 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 e5d8c4d3..f6d6ee8d 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 f2636871..308ffc5d 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 c19b43f5..2e5e7f28 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