From: Jérémie Astor Date: Thu, 5 Mar 2020 21:33:37 +0000 (+0100) Subject: :art: Constructor for vec types X-Git-Tag: nightly~1726^2~49 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=d3b4e6ce0889403b8a3b3b6a69da7af4d1d8fc21;p=gwion.git :art: Constructor for vec types --- diff --git a/examples/array_lit.gw b/examples/array_lit.gw index e782b2a9..296985c8 100644 --- a/examples/array_lit.gw +++ b/examples/array_lit.gw @@ -15,6 +15,6 @@ int k[1][1]; <<< i, " ", j, " ", o, " ", p, " ", r, " ", s, " ", t, " ", k >>>; [ 1.0, 2, 3, 4, 5 ]; -[ #(0.0, 0.0) ]; -[ @(0.0, 0.0, 0.0) ]; -[ @(0.0, 0.0, 0.0, 0.0) ]; +[ complex(0.0, 0.0) ]; +[ Vec3(0.0, 0.0, 0.0) ]; +[ Vec4(0.0, 0.0, 0.0, 0.0) ]; diff --git a/examples/binary_tmpl.gw b/examples/binary_tmpl.gw index 3fb4c19d..e8e29b73 100644 --- a/examples/binary_tmpl.gw +++ b/examples/binary_tmpl.gw @@ -6,6 +6,6 @@ fun void test<~A~>(A a) { <<< a >>>; } 1 => test; 1.3 => test; test(1); -@(23) => test; +Vec3(23) => test; test(1.3); C->D d => test; diff --git a/examples/member.gw b/examples/member.gw index 6c041583..446a3cca 100644 --- a/examples/member.gw +++ b/examples/member.gw @@ -26,7 +26,7 @@ C c; #! write members <<< 12 => c.i >>>; <<< 1.2 => c.f >>>; -<<< #(0.1, 2.3) => c.c >>>; -<<< @(0.1, 2.3, 3.4) => c.v >>>; -<<< @(0.1, 2.3, 3.4, 5.4) => c.w >>>; +<<< complex(0.1, 2.3) => c.c >>>; +<<< Vec3(0.1, 2.3, 3.4) => c.v >>>; +<<< Vec4(0.1, 2.3, 3.4, 5.4) => c.w >>>; <<< null @=> c.o >>>; diff --git a/examples/op2.gw b/examples/op2.gw index e15552cb..7d9f0957 100644 --- a/examples/op2.gw +++ b/examples/op2.gw @@ -6,31 +6,31 @@ class C operator => float (C c, C d){ <<< "float => C: ", c.f => d.f >>>; return 2.0;} operator => int (int i, C d){ <<< "int => C: ", i => d.f >>>; return 2;} operator => float (float f, C d){ <<< "float => C: ", f => d.f >>>; return 2.0;} -operator => complex (complex c, C d){ <<< "complex => C: ", c.re => d.f >>>; return #(1.2, 6.1);} -operator => polar (polar c, C d){ <<< "complex => C: ", c.mod => d.f >>>; return %(2.3, 4.1);} -operator => Vec3 (Vec3 c, C d){ <<< c.z => d.f >>>; return @(1.2, 6.1, 2.3);} -operator => Vec4 (Vec4 c, C d){ <<< "Vec4 => C: ", c.w => d.f >>>; return @(1.2, 6.1, 2.3, 9.3);} +operator => complex (complex c, C d){ <<< "complex => C: ", c.re => d.f >>>; return complex(1.2, 6.1);} +operator => polar (polar c, C d){ <<< "complex => C: ", c.mod => d.f >>>; return polar(2.3, 4.1);} +operator => Vec3 (Vec3 c, C d){ <<< c.z => d.f >>>; return Vec3(1.2, 6.1, 2.3);} +operator => Vec4 (Vec4 c, C d){ <<< "Vec4 => C: ", c.w => d.f >>>; return Vec4(1.2, 6.1, 2.3, 9.3);} operator => float (C d, int c){ <<< "int => C: ", c => d.f >>>; return 2.0;} operator => float (C d, float f){ <<< "C => float: ", f => d.f >>>; return 2.0;} operator => float (Vec3 v, float f){ <<< "vec3 => C: ", f, " ", v.x => f >>>; return 2.0;} -operator => complex (C d, complex c){ <<< "complex => C: ", c.re => d.f >>>; return #(1.2, 6.1);} -operator => polar (C d, polar c){ <<< "complex => C: ", c.mod => d.f >>>; return %(2.3, 4.1);} -operator => Vec3 (C d, Vec3 c){ <<< c.z => d.f >>>; return @(1.2, 6.1, 2.3);} -operator => Vec4 (C d, Vec4 c){ <<< "Vec4 => C: ", c.w => d.f >>>; return @(1.2, 6.1, 2.3, 9.3);} +operator => complex (C d, complex c){ <<< "complex => C: ", c.re => d.f >>>; return complex(1.2, 6.1);} +operator => polar (C d, polar c){ <<< "complex => C: ", c.mod => d.f >>>; return polar(2.3, 4.1);} +operator => Vec3 (C d, Vec3 c){ <<< c.z => d.f >>>; return Vec3(1.2, 6.1, 2.3);} +operator => Vec4 (C d, Vec4 c){ <<< "Vec4 => C: ", c.w => d.f >>>; return Vec4(1.2, 6.1, 2.3, 9.3);} C c, d; 12.3 => c.f; <<< c => d >>>; <<< 2 => d >>>; <<< 2.3 => d >>>; -<<< #(7.2, 1.4) => d >>>; -<<< %(7.2, 1.4) => d >>>; -<<< @(7.2, 1.4, 8.3) >>>; -<<< @(7.2, 1.4, 8.3) => d >>>; -<<< @(7.2, 1.4, 8.3, 2.3) => d >>>; +<<< complex(7.2, 1.4) => d >>>; +<<< polar(7.2, 1.4) => d >>>; +<<< Vec3(7.2, 1.4, 8.3) >>>; +<<< Vec3(7.2, 1.4, 8.3) => d >>>; +<<< Vec4(7.2, 1.4, 8.3, 2.3) => d >>>; int i; 2 => float f; diff --git a/examples/static.gw b/examples/static.gw index 8e584f6d..f945cb6b 100644 --- a/examples/static.gw +++ b/examples/static.gw @@ -31,7 +31,7 @@ class C #! write members <<< 12 => C.i >>>; <<< 1.2 => C.f >>>; -<<< #(0.1, 2.3) => C.c >>>; -<<< @(0.1, 2.3, 3.4) => C.v >>>; -<<< @(0.1, 2.3, 3.4, 5.4) => C.w >>>; +<<< complex(0.1, 2.3) => C.c >>>; +<<< Vec3(0.1, 2.3, 3.4) => C.v >>>; +<<< Vec4(0.1, 2.3, 3.4, 5.4) => C.w >>>; <<< null @=> C.o >>>; diff --git a/examples/string.gw b/examples/string.gw index 22024437..2554d32e 100644 --- a/examples/string.gw +++ b/examples/string.gw @@ -4,10 +4,10 @@ string s; #!null @=> s; <<< 1 => s >>>; <<< 1.0 => s >>>; -<<< #(2,1) => s >>>; -<<< %(2,1) => s >>>; -<<< @(2,1,0) => s >>>; -<<< @(2,1,0,-1) => s >>>; +<<< complex(2,1) => s >>>; +<<< polar(2,1) => s >>>; +<<< Vec3(2,1,0) => s >>>; +<<< Vec4(2,1,0,-1) => s >>>; <<< "test" => s >>>; #! new <<< "test" => s >>>; #! new <<< s >>>; @@ -22,19 +22,19 @@ string s; { (1 + s) @=> string @str; } { (2.0 +s) @=> string @str; } -{ (#(2,1) + s) @=> string @str; } -{ (%(2,1) + s) @=> string @str; } -{ (@(2,1, 0) + s) @=> string @str; } -{ (@(2,1, 0, -1) + s) @=> string @str; } +{ (complex(2,1) + s) @=> string @str; } +{ (polar(2,1) + s) @=> string @str; } +{ (Vec3(2,1, 0) + s) @=> string @str; } +{ (Vec4(2,1, 0, -1) + s) @=> string @str; } #!{ ("test" + s) @=> string @str; } // leak <<< 11 +=> s >>>; <<< 11.0 +=> s >>>; -<<< #(21,11) +=> s >>>; -<<< %(22,12) +=> s >>>; -<<< @(22,11,11) +=> s >>>; -<<< @(22,11,11,-11) +=> s >>>; +<<< complex(21,11) +=> s >>>; +<<< polar(22,12) +=> s >>>; +<<< Vec3(22,11,11) +=> s >>>; +<<< Vec4(22,11,11,-11) +=> s >>>; <<< o +=> s >>>; <<< "test" + s >>>; #! also leak <<< null +=> s >>>; #! also hang diff --git a/examples/vararg.gw b/examples/vararg.gw index 4175fee6..a5b017e7 100644 --- a/examples/vararg.gw +++ b/examples/vararg.gw @@ -20,4 +20,4 @@ fun void test(...) { vararg.end; } test(1); -test(1, 2.3, #(3, 2), %(3, 2.1), @(1,2,3), @(1,2,3,4), null); +test(1, 2.3, complex(3, 2), polar(3, 2.1), Vec3(1,2,3), Vec4(1,2,3,4), null); diff --git a/examples/vec3.gw b/examples/vec3.gw index 1abb75f6..f1df76b4 100644 --- a/examples/vec3.gw +++ b/examples/vec3.gw @@ -15,7 +15,7 @@ Vec3 v, w; <<< 1 => v.x >>>; <<< 2 => v.y >>>; <<< -12 => v.z >>>; -<<< @(.1, .2, .4) => v >>>; +<<< Vec3(.1, .2, .4) => v >>>; <<< v >>>; <<< "set ", v.set(1,2,3) >>>; <<< "setAll ", v.setAll(1.2) >>>; @@ -43,4 +43,4 @@ w-10.; w/10.; 10.*w; w*10.; -<<< @(23).x >>>; +<<< Vec3(23).x >>>; diff --git a/examples/vec4.gw b/examples/vec4.gw index e876c603..4dc23d48 100644 --- a/examples/vec4.gw +++ b/examples/vec4.gw @@ -23,7 +23,7 @@ Vec4 v, w; <<< 1 => v.y >>>; <<< 1 => v.z >>>; <<< 1 => v.w >>>; -<<< @(.1, .2, .4, .5) => v >>>; +<<< Vec3(.1, .2, .4, .5) => v >>>; <<< "set ", v.set(1,2,3,4) >>>; <<< "setAll ", v.setAll(1.2) >>>; diff --git a/src/emit/emit.c b/src/emit/emit.c index 2a73a28c..dc47c637 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -534,21 +534,24 @@ ANN static m_bool emit_exp_slice(const Emitter emit, const Exp_Slice* range) { return GW_OK; } +ANN static void emit_vec_addr(const Emitter emit, const m_uint sz) { + emit_local(emit, sz, 0); + const m_uint offset = emit_local(emit, SZ_INT, 0); + const Instr cpy = emit_add_instr(emit, VecCpy); + cpy->m_val = offset; + cpy->m_val2 = sz; + const Instr instr = emit_add_instr(emit, RegPushMem); + instr->m_val = offset; +} + ANN static m_bool emit_prim_vec(const Emitter emit, const Vec *vec) { const ae_prim_t t = prim_self(vec)->prim_type; CHECK_BB(emit_exp(emit, vec->exp, 0)); m_int n = (m_int)((t == ae_prim_vec ? 3 : 2) - vec->dim + 1); while(--n > 0) emit_add_instr(emit, RegPushImm2); - if(prim_exp(vec)->emit_var) { - emit_local(emit, prim_exp(vec)->type->size, 0); - const m_uint offset = emit_local(emit, SZ_INT, 0); - const Instr cpy = emit_add_instr(emit, VecCpy); - cpy->m_val = offset; - cpy->m_val2 = prim_exp(vec)->type->size; - const Instr instr = emit_add_instr(emit, RegPushMem); - instr->m_val = offset; - } + if(prim_exp(vec)->emit_var) + emit_vec_addr(emit, prim_exp(vec)->type->size); return GW_OK; } @@ -804,8 +807,16 @@ ANN static m_bool prepare_call(const Emitter emit, const Exp_Call* exp_call) { } ANN static m_bool emit_exp_call(const Emitter emit, const Exp_Call* exp_call) { - CHECK_BB(prepare_call(emit, exp_call)) - return emit_exp_call1(emit, exp_call->m_func) ? GW_OK : GW_ERROR; + if(exp_call->m_func) { + CHECK_BB(prepare_call(emit, exp_call)) + return emit_exp_call1(emit, exp_call->m_func) ? GW_OK : GW_ERROR; + } + if(exp_call->args) + CHECK_BB(emit_exp(emit, exp_call->args, 1)) + const Exp e = exp_self(exp_call); + if(e->emit_var) + emit_vec_addr(emit, e->type->size); + return GW_OK; } ANN static m_uint get_decl_size(Var_Decl_List a) { diff --git a/src/lib/complex.c b/src/lib/complex.c index 5abd7981..b1f57ef0 100644 --- a/src/lib/complex.c +++ b/src/lib/complex.c @@ -123,7 +123,7 @@ static GACK(gack_polar) { } EQUALITY_OPER(complex, SZ_COMPLEX) - +OP_CHECK(vecx_ck); GWION_IMPORT(complex) { // should be special const Type t_complex = gwi_class_spe(gwi, "complex", SZ_COMPLEX); @@ -143,6 +143,13 @@ GWION_IMPORT(complex) { GWI_BB(gwi_item_ini(gwi, "float", "phase")) GWI_BB(gwi_item_end(gwi, ae_flag_member, NULL)) GWI_BB(gwi_class_end(gwi)) + + GWI_BB(gwi_oper_ini(gwi, "complex", NULL, NULL)) + GWI_BB(gwi_oper_add(gwi, vecx_ck)) + GWI_BB(gwi_oper_end(gwi, "@ctor", NULL)) + GWI_BB(gwi_oper_ini(gwi, "polar", NULL, NULL)) + GWI_BB(gwi_oper_add(gwi, vecx_ck)) + GWI_BB(gwi_oper_end(gwi, "@ctor", NULL)) GWI_BB(gwi_oper_ini(gwi, "complex", "complex", "bool")) GWI_BB(gwi_oper_end(gwi, "==", complex_eq)) GWI_BB(gwi_oper_end(gwi, "!=", complex_ne)) diff --git a/src/lib/vec.c b/src/lib/vec.c index 5f5bb40a..03795d75 100644 --- a/src/lib/vec.c +++ b/src/lib/vec.c @@ -163,6 +163,35 @@ static GACK(gack_vec3) { EQUALITY_OPER(vec3, SZ_VEC3); +OP_CHECK(vecx_ck) { + Exp_Call *call = (Exp_Call*)data; + Exp e = call->args, last = NULL; + int i = 0; + const Type t_float = env->gwion->type[et_float]; + while(e) { + CHECK_BO(check_implicit(env, e, t_float)) + i += SZ_FLOAT; + last = e; + e = e->next; + } + const Type t = call->func->type->e->d.base_type; + while(i > t->size) { + env_err(env, last->pos, "extraneous component of %s value", t->name); + return NULL; + } + if(!call->args) { + call->args = last = new_prim_float(env->gwion->mp, 0.0, loc_cpy(env->gwion->mp, call->func->pos)); + last->type = t_float; + i += SZ_FLOAT; + } + while(i < t->size) { + last = (last->next = new_prim_float(env->gwion->mp, 0.0, loc_cpy(env->gwion->mp, last->pos))); + last->type = t_float; + i += SZ_FLOAT; + } + return t; +} + GWION_IMPORT(vec3) { const Type t_vec3 = gwi_class_spe(gwi, "Vec3", SZ_VEC3); gwi->gwion->type[et_vec3] = t_vec3; @@ -204,6 +233,10 @@ GWION_IMPORT(vec3) { GWI_BB(gwi_func_end(gwi, vec3_update_set_slew, ae_flag_none)) GWI_BB(gwi_class_end(gwi)) + GWI_BB(gwi_oper_ini(gwi, "Vec3", NULL, NULL)) + GWI_BB(gwi_oper_add(gwi, vecx_ck)) + GWI_BB(gwi_oper_end(gwi, "@ctor", NULL)) + GWI_BB(gwi_oper_ini(gwi, "Vec3", "Vec3", "bool")) GWI_BB(gwi_oper_end(gwi, "==", vec3_eq)) GWI_BB(gwi_oper_end(gwi, "!=", vec3_ne)) @@ -337,6 +370,11 @@ GWION_IMPORT(vec4) { gwi_func_ini(gwi, "void", "normalize"); CHECK_BB(gwi_func_end(gwi, vec4_normalize, ae_flag_none)) CHECK_BB(gwi_class_end(gwi)) + + GWI_BB(gwi_oper_ini(gwi, "Vec4", NULL, NULL)) + GWI_BB(gwi_oper_add(gwi, vecx_ck)) + GWI_BB(gwi_oper_end(gwi, "@ctor", NULL)) + GWI_BB(gwi_oper_ini(gwi, "Vec4", "Vec4", "bool")) GWI_BB(gwi_oper_end(gwi, "==", vec4_eq)) GWI_BB(gwi_oper_end(gwi, "!=", vec4_ne)) diff --git a/src/parse/check.c b/src/parse/check.c index 57e093bd..4e2de6a5 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -28,7 +28,7 @@ ANN static m_bool check_internal(const Env env, const Symbol sym, return GW_OK; } -ANN static inline m_bool check_implicit(const Env env, const Exp e, const Type t) { +ANN /*static inline */m_bool check_implicit(const Env env, const Exp e, const Type t) { const Symbol sym = insert_symbol("@implicit"); return check_internal(env, sym, e, t); } @@ -446,6 +446,7 @@ ANN static m_bool func_match_inner(const Env env, const Exp e, const Type t, ANN2(1,2) static Func find_func_match_actual(const Env env, Func func, const Exp args, const m_bool implicit, const m_bool specific) { +printf("func %p %s\n", func, func->name); do { Exp e = args; Arg_List e1 = func->def->base->args; @@ -746,8 +747,15 @@ ANN static Type check_exp_call_template(const Env env, Exp_Call *exp) { ANN static m_bool check_exp_call1_check(const Env env, const Exp exp) { CHECK_OB(check_exp(env, exp)) - if(isa(exp->type, env->gwion->type[et_function]) < 0) + if(isa(exp->type, env->gwion->type[et_function]) < 0) { + if(isa(exp->type, env->gwion->type[et_class]) > 0) { +puts("here:!:"); +//const Type t = exp->type->e->d.base_type; +//const Func func = nspc_lookup_func0(t->e->owner, insert_symbol(t->name)); +//exp->type = func->value_ref->type; + } else ERR_B(exp->pos, _("function call using a non-function value")) + } return GW_OK; } @@ -773,6 +781,12 @@ ANN static Type check_lambda_call(const Env env, const Exp_Call *exp) { ANN Type check_exp_call1(const Env env, const Exp_Call *exp) { CHECK_BO(check_exp_call1_check(env, exp->func)) + if(isa(exp->func->type, env->gwion->type[et_function]) < 0) { + if(exp->args) + CHECK_OO(check_exp(env, exp->args)) + struct Op_Import opi = { .op=insert_symbol("@ctor"), .lhs=exp->func->type->e->d.base_type, .data=(uintptr_t)exp, .pos=exp_self(exp)->pos }; + return op_check(env, &opi); + } if(exp->func->type == env->gwion->type[et_lambda]) return check_lambda_call(env, exp); if(GET_FLAG(exp->func->type->e->d.func, ref)) { diff --git a/tests/bug/array.gw b/tests/bug/array.gw index 9d9a1625..89a42d8e 100644 --- a/tests/bug/array.gw +++ b/tests/bug/array.gw @@ -16,17 +16,17 @@ class Test_Array 2 => i[0]; 5.7 => f[0]; - #(2.1, 3.4) => c[0]; - %(2.3, 5.6) => p[0]; - @(2.1, 3.2, 4.3) => v[0]; - @(2.1, 3.2, 4.3, 5.4) => w[0]; + complex(2.1, 3.4) => c[0]; + polar(2.3, 5.6) => p[0]; + Vec3(2.1, 3.2, 4.3) => v[0]; + Vec4(2.1, 3.2, 4.3, 5.4) => w[0]; i << 1; f << 1.2; - c << #(2.1, 3.4); - p << %(2.3, 5.6); - v << @(2.1, 3.2, 4.3); - w << @(2.1, 3.2, 4.3, 5.4); + c << complex(2.1, 3.4); + p << polar(2.3, 5.6); + v << Vec3(2.1, 3.2, 4.3); + w << Vec4(2.1, 3.2, 4.3, 5.4); <<< i.size() >>>; } diff --git a/tests/error/complex_too_big.gw b/tests/error/complex_too_big.gw index c9c0c150..896c8a39 100644 --- a/tests/error/complex_too_big.gw +++ b/tests/error/complex_too_big.gw @@ -1,2 +1,2 @@ #! [contains] extraneous component of complex value - #(0,0,0,0); + complex(0,0,0,0); diff --git a/tests/error/divide_by_zero.gw b/tests/error/divide_by_zero.gw index 56a09b04..659e93f5 100644 --- a/tests/error/divide_by_zero.gw +++ b/tests/error/divide_by_zero.gw @@ -1,2 +1,2 @@ #! [contains] ZeroDivideException -[ #(0.0, 0/0) ]; +[ complex(0.0, 0/0) ]; diff --git a/tests/error/polar_too_big.gw b/tests/error/polar_too_big.gw index 5ad3b535..adff42cf 100644 --- a/tests/error/polar_too_big.gw +++ b/tests/error/polar_too_big.gw @@ -1,2 +1,2 @@ #! [contains] extraneous component of polar value -%(0,0,0,0); +polar(0,0,0,0); diff --git a/tests/error/vararg_invalid_acces.gw b/tests/error/vararg_invalid_acces.gw index d5c68447..4467d961 100644 --- a/tests/error/vararg_invalid_acces.gw +++ b/tests/error/vararg_invalid_acces.gw @@ -4,4 +4,4 @@ fun void test(...) { <<>>; vararg.end; } -@(1.3) => test; +Vec3(1.3) => test; diff --git a/tests/error/vector_too_big.gw b/tests/error/vector_too_big.gw index 0d5eb436..a2bf964f 100644 --- a/tests/error/vector_too_big.gw +++ b/tests/error/vector_too_big.gw @@ -1,2 +1,2 @@ #! [contains] extraneous component of - @(0,0,0,0,0); + Vec4(0,0,0,0,0); diff --git a/tests/import/coverage.gw b/tests/import/coverage.gw index 1cc4d722..2d92e690 100644 --- a/tests/import/coverage.gw +++ b/tests/import/coverage.gw @@ -21,8 +21,8 @@ c.s_i; <<< 1 => Coverage.s_i >>>; <<< 1.2 => Coverage.s_f >>>; -<<< #(1.2, 0.1) => Coverage.s_c >>>; -<<< @(1.2, 0.1, 2.6) => Coverage.s_v >>>; -<<< @(1.2, 0.1, 2.6, 4.6) => Coverage.s_w >>>; +<<< complex(1.2, 0.1) => Coverage.s_c >>>; +<<< Vec3(1.2, 0.1, 2.6) => Coverage.s_v >>>; +<<< Vec4(1.2, 0.1, 2.6, 4.6) => Coverage.s_w >>>; <<< c.test_array[0][0] >>>; diff --git a/tests/new/pure.gw b/tests/new/pure.gw index ff4379ac..7768f66c 100644 --- a/tests/new/pure.gw +++ b/tests/new/pure.gw @@ -4,4 +4,4 @@ fun A pure<~A~>(A i) { return i; } <<< 3 => pure >>>; <<< 4 => pure >>>; <<< 2.2 => pure >>>; -<<< @(2.3) => pure >>>; +<<< Vec3(2.3) => pure >>>; diff --git a/tests/new/pure_member.gw b/tests/new/pure_member.gw index 2fe91f9f..35240464 100644 --- a/tests/new/pure_member.gw +++ b/tests/new/pure_member.gw @@ -5,6 +5,6 @@ fun A pure<~A~>(A i) { return i; } <<< 3 => pure >>>; <<< 4 => pure >>>; <<< 2.2 => pure >>>; -<<< @(2.3) => pure >>>; +<<< Vec3(2.3) => pure >>>; } C c; diff --git a/tests/regression/invalid_template.gw b/tests/regression/invalid_template.gw new file mode 100644 index 00000000..c7b4f5f0 --- /dev/null +++ b/tests/regression/invalid_template.gw @@ -0,0 +1,12 @@ +class B {} + +class<~A~>C extends B{} + +class<~A,B~>D extends<~A~>C{ + class<~A~>int{} + class G extends ld + {A0I:} + <~A~>d d; +} + +<~int~>D d; diff --git a/tests/tree/balance.gw b/tests/tree/balance.gw index 50c65479..10f78a24 100644 --- a/tests/tree/balance.gw +++ b/tests/tree/balance.gw @@ -20,14 +20,14 @@ test(1); test(1.2); 1.2 => test; -test(#(2.3, 4.5)); -#(2.3, 4.5) => test; +test(complex(2.3, 4.5)); +complex(2.3, 4.5) => test; -test(@(1.2, 2.3, 3.4)); -@(1.2, 2.3, 3.4) => test; +test(Vec3(1.2, 2.3, 3.4)); +Vec3(1.2, 2.3, 3.4) => test; -test(@(1.2, 2.3, 3.4, 4.5)); -@(1.2, 2.3, 3.4, 4.5) => test; +test(Vec4(1.2, 2.3, 3.4, 4.5)); +Vec4(1.2, 2.3, 3.4, 4.5) => test; class C { @@ -56,14 +56,14 @@ c.test(1); c.test(1.2); 1.2 => c.test; -c.test(#(2.3, 4.5)); -#(2.3, 4.5) => c.test; +c.test(complex(2.3, 4.5)); +complex(2.3, 4.5) => c.test; -c.test(@(1.2, 2.3, 3.4)); -@(1.2, 2.3, 3.4) => c.test; +c.test(Vec3(1.2, 2.3, 3.4)); +Vec3(1.2, 2.3, 3.4) => c.test; -c.test(@(1.2, 2.3, 3.4, 4.5)); -@(1.2, 2.3, 3.4, 4.5) => c.test; +c.test(Vec4(1.2, 2.3, 3.4, 4.5)); +Vec4(1.2, 2.3, 3.4, 4.5) => c.test; c.s_test(); () => c.s_test; @@ -74,14 +74,14 @@ c.s_test(1); c.s_test(1.2); 1.2 => c.s_test; -c.s_test(#(2.3, 4.5)); -#(2.3, 4.5) => c.s_test; +c.s_test(complex(2.3, 4.5)); +complex(2.3, 4.5) => c.s_test; -c.s_test(@(1.2, 2.3, 3.4)); -@(1.2, 2.3, 3.4) => c.s_test; +c.s_test(Vec3(1.2, 2.3, 3.4)); +Vec3(1.2, 2.3, 3.4) => c.s_test; -c.s_test(@(1.2, 2.3, 3.4, 4.5)); -@(1.2, 2.3, 3.4, 4.5) => c.s_test; +c.s_test(Vec4(1.2, 2.3, 3.4, 4.5)); +Vec4(1.2, 2.3, 3.4, 4.5) => c.s_test; C.s_test(); () => C.s_test; @@ -92,12 +92,12 @@ C.s_test(1); C.s_test(1.2); 1.2 => C.s_test; -C.s_test(#(2.3, 4.5)); -#(2.3, 4.5) => C.s_test; +C.s_test(complex(2.3, 4.5)); +complex(2.3, 4.5) => C.s_test; -C.s_test(@(1.2, 2.3, 3.4)); -@(1.2, 2.3, 3.4) => C.s_test; +C.s_test(Vec3(1.2, 2.3, 3.4)); +Vec3(1.2, 2.3, 3.4) => C.s_test; -C.s_test(@(1.2, 2.3, 3.4, 4.5)); -@(1.2, 2.3, 3.4, 4.5) => C.s_test; +C.s_test(Vec4(1.2, 2.3, 3.4, 4.5)); +Vec4(1.2, 2.3, 3.4, 4.5) => C.s_test; diff --git a/tests/tree/cpy_ast.gw b/tests/tree/cpy_ast.gw index 3e95ee8d..f6d8a12e 100644 --- a/tests/tree/cpy_ast.gw +++ b/tests/tree/cpy_ast.gw @@ -3,7 +3,7 @@ class <~A~>C { [ 1 ]; int i,j; typeof(i) k; - @(0); + Vec3(0); 'a'; true $ int; i++; diff --git a/tests/tree/vec_num_dim.gw b/tests/tree/vec_num_dim.gw index 5f6e00bc..9aea1d1d 100644 --- a/tests/tree/vec_num_dim.gw +++ b/tests/tree/vec_num_dim.gw @@ -1,2 +1,2 @@ #! a vec3 with only two expressions -[ @(0.0- 0.0, 0.0) ]; +[ Vec3(0.0- 0.0, 0.0) ]; diff --git a/tests/tuple/tuple_member_float.gw b/tests/tuple/tuple_member_float.gw index d3fbc990..abb1b6e2 100644 --- a/tests/tuple/tuple_member_float.gw +++ b/tests/tuple/tuple_member_float.gw @@ -1,4 +1,4 @@ -<(.2, @(1), 3) @=> <~float, Vec3, int~>Tuple @t; +<(.2, Vec3(1), 3) @=> <~float, Vec3, int~>Tuple @t; t[0]; t[1]; 3 => t[2];