From e3237eb17eee00781e0fc1084fe236120f649e8d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 30 Jun 2020 23:36:33 +0200 Subject: [PATCH] :art: Check shadowing in tests --- examples/complex/invalid_func0.gw | 2 +- examples/ptr_deref.gw | 4 ++-- examples/usr_postfix.gw | 3 --- tests/new/global_func0.gw | 10 +++++----- tests/{tree => new}/global_func1.gw | 2 +- tests/new/global_var.gw | 2 +- tests/new/recursive_template.gw | 3 +-- tests/regression/invalid_template.gw | 2 +- tests/struct/struct_global0.gw | 2 +- tests/tree/class_named_union.gw | 4 ++-- tests/tree/cpy_ast.gw | 2 +- tests/tree/fptr_class.gw | 4 ++-- tests/tree/global_named_union.gw | 8 ++++---- tests/tree/static_tmpl.gw | 8 ++++---- 14 files changed, 26 insertions(+), 30 deletions(-) rename tests/{tree => new}/global_func1.gw (77%) diff --git a/examples/complex/invalid_func0.gw b/examples/complex/invalid_func0.gw index 3edf1294..1a6c8f38 100644 --- a/examples/complex/invalid_func0.gw +++ b/examples/complex/invalid_func0.gw @@ -1 +1 @@ -fun global void global_func_err() { <<< _func__ >>>; } +fun global void global_func_err() { <<< __func__ >>>; } diff --git a/examples/ptr_deref.gw b/examples/ptr_deref.gw index e79165e6..4a5fd7a5 100644 --- a/examples/ptr_deref.gw +++ b/examples/ptr_deref.gw @@ -1,3 +1,3 @@ int i; -i :=> <~int~>Ptr pi; -<<<12 => *pi, " ", *pi>>>; +i :=> <~int~>Ptr pti; +<<<12 => *pti, " ", *pti>>>; diff --git a/examples/usr_postfix.gw b/examples/usr_postfix.gw index 84b3932e..815584f9 100644 --- a/examples/usr_postfix.gw +++ b/examples/usr_postfix.gw @@ -1,6 +1,3 @@ -int i; -i++; - class C { int i; } operator ++ int (C c) { <<< "here" >>>; diff --git a/tests/new/global_func0.gw b/tests/new/global_func0.gw index ee373b2e..a7037abe 100644 --- a/tests/new/global_func0.gw +++ b/tests/new/global_func0.gw @@ -1,11 +1,11 @@ -123 => global int g_i; -class global C { +123 => global int global_func_i; +class global GlobalFuncClass { 13 => int i; } -<<< g_i >>>; -global C g_c; +<<< global_func_i >>>; +global GlobalFuncClass g_c; <<< g_c, "->i => ", g_c.i >>>; -fun global void g_test() { <<< g_i >>>; <<< g_c >>>; <<< g_c.i >>>; <<< "test" >>>; } +fun global void g_test() { <<< global_func_i >>>; <<< g_c >>>; <<< g_c.i >>>; <<< "test" >>>; } #!fun global void g_test() { <<< "test" >>>; } <<< g_test >>>; <<< g_test() >>>; diff --git a/tests/tree/global_func1.gw b/tests/new/global_func1.gw similarity index 77% rename from tests/tree/global_func1.gw rename to tests/new/global_func1.gw index c12ad16d..80801795 100644 --- a/tests/tree/global_func1.gw +++ b/tests/new/global_func1.gw @@ -1,4 +1,4 @@ -<<< g_i >>>; +<<< global_func_i >>>; <<< g_c >>>; <<< g_c.i >>>; <<< g_test >>>; diff --git a/tests/new/global_var.gw b/tests/new/global_var.gw index 072245a2..85bdfc9c 100644 --- a/tests/new/global_var.gw +++ b/tests/new/global_var.gw @@ -1 +1 @@ -<<< global int g_i >>>; +<<< global int global_var_i >>>; diff --git a/tests/new/recursive_template.gw b/tests/new/recursive_template.gw index dab026b9..1b8b4074 100644 --- a/tests/new/recursive_template.gw +++ b/tests/new/recursive_template.gw @@ -3,7 +3,6 @@ fun void test<~A~>(int i, A a) { <<< __func__, " ", a >>>; <<< i, " ", a >>>; if(i) - test<~int~>((i-2, b)); -#! test((i-2.0)); + test<~int~>((i-2, b$int)); } test<~float~>(2, 2); diff --git a/tests/regression/invalid_template.gw b/tests/regression/invalid_template.gw index c7b4f5f0..1e27c410 100644 --- a/tests/regression/invalid_template.gw +++ b/tests/regression/invalid_template.gw @@ -3,7 +3,7 @@ class B {} class<~A~>C extends B{} class<~A,B~>D extends<~A~>C{ - class<~A~>int{} + class<~A~> E{} class G extends ld {A0I:} <~A~>d d; diff --git a/tests/struct/struct_global0.gw b/tests/struct/struct_global0.gw index 57abb9ed..e60d17fb 100644 --- a/tests/struct/struct_global0.gw +++ b/tests/struct/struct_global0.gw @@ -10,5 +10,5 @@ struct global GlobalStructWithCtor { string s; } -global GlobalStruct s; +global GlobalStruct global_s; GlobalStructWithCtor sctor; diff --git a/tests/tree/class_named_union.gw b/tests/tree/class_named_union.gw index 7eabcb2a..b892a523 100644 --- a/tests/tree/class_named_union.gw +++ b/tests/tree/class_named_union.gw @@ -1,5 +1,5 @@ class C { - 12 => int i; + 12 => int _i; union { int i; float f; @@ -26,5 +26,5 @@ C c; 1.23 => c.U.f; <<< c.U.f >>>; <<< c.U.i >>>; -<<< c.i >>>; +<<< c._i >>>; diff --git a/tests/tree/cpy_ast.gw b/tests/tree/cpy_ast.gw index f721f246..c0d2c2f9 100644 --- a/tests/tree/cpy_ast.gw +++ b/tests/tree/cpy_ast.gw @@ -20,7 +20,7 @@ class <~A~>C { match i,2 { case 12 when 0:; case _,2 when 0:; - } where int i; + } where int b; enum { zero }; typedef int Int; goto end; diff --git a/tests/tree/fptr_class.gw b/tests/tree/fptr_class.gw index cb798c5b..920569d1 100644 --- a/tests/tree/fptr_class.gw +++ b/tests/tree/fptr_class.gw @@ -1,8 +1,8 @@ class C { fun void test(int i) { <<< "int arg" >>>; } - typedef void Ptr(int i); + typedef void ptr_t(int i); test @=> - Ptr p; + ptr_t p; p(1); test @=> p; p(1); diff --git a/tests/tree/global_named_union.gw b/tests/tree/global_named_union.gw index a5e51c97..5eb4c3aa 100644 --- a/tests/tree/global_named_union.gw +++ b/tests/tree/global_named_union.gw @@ -1,8 +1,8 @@ union global { - int int_from_global_union; - float float_from_global_union; + int int_from_global_nanmed_union; + float float_from_global_named_union; } global_union; <<< "HERE", global_union >>>; -<<< 123.456 => global_union.float_from_global_union >>>; -<<< global_union.float_from_global_union >>>; +<<< 123.456 => global_union.float_from_global_named_union >>>; +<<< global_union.float_from_global_named_union >>>; diff --git a/tests/tree/static_tmpl.gw b/tests/tree/static_tmpl.gw index b024fdd2..d4483887 100644 --- a/tests/tree/static_tmpl.gw +++ b/tests/tree/static_tmpl.gw @@ -1,12 +1,12 @@ -class global C { +class global StaticTmpl { fun static void t<~A~>() { <<< __func__ >>>; } } -class D extends C { +class D extends StaticTmpl { } -fun void test(C c) { - C.t<~int~>(); +fun void test(StaticTmpl c) { + StaticTmpl.t<~int~>(); } #!D d; -- 2.43.0