-Subproject commit 39ad675551cd32f3ad2125f3cf9afe6ac416c99e
+Subproject commit d572b7d308e6948f0dd4d328aa07050d42e8fdcd
class D {
}
}
-fun void test<~A~>(A a) { <<< a >>>; }
+fun void test<~A](A a) { <<< a >>>; }
1 => test;
1.3 => test;
test(1);
-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;
-fun void test(Ptr<~int~> p) {
+fun void test(Ptr<~int] p) {
<<< *p >>>;
}
var int i => test;
class C {
- fun void test<~A~>(A a){ <<< a >>>; }
+ fun void test<~A](A a){ <<< a >>>; }
class D { var int i;}
}
class D extends C {
}
var D d;
-d :=> var Ptr<~C~> pd;
+d :=> var Ptr<~C] pd;
12 => var int i;
-<<<i $ Ptr<~int~> >>>;
+<<<i $ Ptr<~int] >>>;
var int i;
-i :=> var Ptr<~int~> pti;
+i :=> var Ptr<~int] pti;
<<<12 => *pti, " ", *pti>>>;
-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);
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__ >>>; }
}
-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);
-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);
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);
}
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;
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) {
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;
}
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;
}
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) {
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';
}
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))
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))
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,
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;
}
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;
#! [contains] template call of non-template function
fun void test(){}
-test<~int~>();
+test<~int]();
#! [contains] EmptyPointerException
-var Ptr<~int~> t;
+var Ptr<~int] t;
<<< *t >>>;
#! [contains] invalid pointer cast
-<<< 1 $ Ptr<~Object~> >>>;
+<<< 1 $ Ptr<~Object] >>>;
#! [contains] template call of non-function value
var int test;
-test<~int~>();
+test<~int]();
-1 :=> var Ptr<~int~> pd;
+1 :=> var Ptr<~int] pd;
class D extends C {}
var D d;
-d :=> var Ptr<~int~> pd;
+d :=> var Ptr<~int] pd;
-1 :=> var Ptr<~int~> i;
+1 :=> var Ptr<~int] i;
#! [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;
#! [contains] you must provide template types
-class C<~A~> {
+class C<~A] {
var A a;
}
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__ >>>; }
}
#! [contains]
-fun void test<~A,B~>(){}
+fun void test<~A,B](){}
test();
#! [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]();
#! [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);
#! [contains]
-Math.rand<~int~>();
+Math.rand<~int]();
#! [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);
#! [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){}
#! [contains] invalid expression for function call
-fun void test<~A~>(A a){}
+fun void test<~A](A a){}
(maybe ? test : test)(1);
#! [contains] unknown type
-fun void my_function<~A~>() { <<< "test" >>>; }
+fun void my_function<~A]() { <<< "test" >>>; }
-my_function<~unknown_type~>();
+my_function<~unknown_type]();
#! [contains] is not template
-var Object<~int~> o;
+var Object<~int] o;
#! [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]() >>>;
#! [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]() >>>;
return 12;
}
-fork test() @=> ref TypedFork<~int~> sh;
+fork test() @=> ref TypedFork<~int] sh;
<<< typeof(sh) >>>;
sh.ev => now;
<<< sh.retval >>>;
class C {
- typedef void ptr_t<~A~>();
- fun void test<~A~>() {}
+ typedef void ptr_t<~A]();
+ fun void test<~A]() {}
test $ ptr_t;
}
}
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;
}
-var ClassTemplate<~int, int~> ct;
+var ClassTemplate<~int, int] ct;
<<< ct.key >>>;
#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))
#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;
}
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;
}
#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;
}
#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))
#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))
#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;
}
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;
-test<~int~>(1);
+test<~int](1);
test(1);
}
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;
}
const Type t2 = gwi_mk_type(gwi, "T<a>", 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;
#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);
}
-var Map<~int, float~> pp;
+var Map<~int, float] pp;
<<< pp >>>;
<<< pp.size() >>>;
<<< pp.set(1, 2) >>>;
#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;
}
#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;
}
#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"))
-<<< var U<~Event~> u>>>;
+<<< var U<~Event] u>>>;
<<< u.a >>>;
#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"))
#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;
}
#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"))
class C {
- fun void test<~A~>(A a) { <<< a >>>; }
+ fun void test<~A](A a) { <<< a >>>; }
}
class D extends C {}
-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__ >>>; }
}
-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;
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;
-fun A pure<~A~>(A i) { return i; }
+fun A pure<~A](A i) { return i; }
<<< 2 => pure >>>;
<<< 2 => pure >>>;
<<< 3 => pure >>>;
class C {
- fun A pure<~A~>(A i) {
+ fun A pure<~A](A i) {
return i;
}
<<< 2 => pure >>>;
-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);
-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);
-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);
-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);
-fun void test<~A~>(A i) {
+fun void test<~A](A i) {
var A a;
<<< a >>>;
<<< i, " ", a, " ", i > 1 >>>;
-fun void test<~A~>(int i) {
+fun void test<~A](int i) {
<<< __func__ >>>;
<<< 1 >>>;
}
-test<~int~>(1);
+test<~int](1);
}
var D d;
<<< d >>>;
-<<< d.t<~int~>() >>>;
+<<< d.t<~int]() >>>;
-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 >>>;
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__ >>>; }
}
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);
}
-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;
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__ >>>;
}
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__ >>>;
}
-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]();
-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;
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;
-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 >>>;
-var Ptr<~int~> ptr;
+var Ptr<~int] ptr;
var int i[4];
foreach(ref a : i)
<<< *a >>>;
-typedef void test_t<~A~>();
+typedef void test_t<~A]();
nonnull test_t t;
-t<~int~>();
+t<~int]();
-class C<~A~> {
+class C<~A] {
class D {
}
}
-var C.D<~int~> d;
+var C.D<~int] d;
-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() >>>;
-class C<~A~> {
+class C<~A] {
\a{};
[ 1 ];
var int i,j;
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);
while(0){ <<< __func__ >>>; }
}
-var C<~int~> c;
+var C<~int] c;
-class C<~A~> {
+class C<~A] {
var A a;
}
-class D extends C<~int~> {}
+class D extends C<~int] {}
var D d;
<<<d.a>>>;
-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 >>>;
-class C<~A~> {
+class C<~A] {
var A a;
}
class D {
- var static C<~int~> c;
+ var static C<~int] c;
}
var D d;
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;
-class C<~A~> {}
+class C<~A] {}
-var C<~int, float~> c;
+var C<~int, float] c;
-class C<~A~> {}
+class C<~A] {}
-var C<~int~> c;
+var C<~int] c;
<<< c >>>;
-typedef int ptr_t<~A~>(A);
+typedef int ptr_t<~A](A);
var ptr_t ptr;
<<<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);
-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;
-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);
-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__ >>>;
}
-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;
<<< b() >>>;
-typedef t_ptr<~float~> C;
+typedef t_ptr<~float] C;
var C c;
<<< c >>>;
test @=> c;
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__ >>>;
}
-union U<~A~>{
+union U<~A]{
int i;
A a;
};
-var U<~float~> u;
+var U<~float] u;
<<< u.a >>>;