]> Nishi Git Mirror - gwion.git/commitdiff
:art: Remove 'template' keyword
authorfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 4 Apr 2019 11:15:12 +0000 (13:15 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 4 Apr 2019 11:15:12 +0000 (13:15 +0200)
19 files changed:
ast
examples/binary_tmpl.gw
examples/in_class_class.gw
examples/template.gw
examples/template_dyn.gw
examples/template_guess.gw
examples/template_vararg.gw
tests/bug/Tester.gw
tests/bug/template_no_guess.gw
tests/error/template_class_no_type.gw
tests/error/template_enough.gw
tests/error/template_n_mismatch.gw
tests/error/template_no_match.gw
tests/error/template_ternary.gw
tests/error/template_unknown.gw
tests/tree/class_template.gw
tests/tree/static_template.gw
tests/tree/template_class_ref.gw
tests/tree/template_typedef.gw

diff --git a/ast b/ast
index fbd0bdbb2950dbfc8f62167c795390500d660cfa..334325fab4ff94b04713e87a5b1be4cd0ff24574 160000 (submodule)
--- a/ast
+++ b/ast
@@ -1 +1 @@
-Subproject commit fbd0bdbb2950dbfc8f62167c795390500d660cfa
+Subproject commit 334325fab4ff94b04713e87a5b1be4cd0ff24574
index 60253182f70a03b16d4f9969f3d9981de02920a1..34b11cc1c1f6fd4d1cb0640dad8258543d7a5557 100644 (file)
@@ -1,4 +1,4 @@
-template<~A~> fun void test(A a) { <<<a>>>; }
+fun<~A~> void test(A a) { <<<a>>>; }
 1 => test;
 1.3 => test;
 test(1);
index b0ab876890a979099add51138446ee389bb9c25c..3ef4deee7da9683beac440359d6e75f172ceca1e 100644 (file)
@@ -1,6 +1,5 @@
 class C {
-       template<~a~>
-       function void test(a var){ <<<var>>>; }
+       function<~a~> void test(a var){ <<<var>>>; }
        class D { int i;}
 }
 
index 23f8647e6ca450ec89c23301cc232066accb03ba..d4d2dfc489c831560f6d70521bd8b4ce8f60db39 100644 (file)
@@ -1,13 +1,4 @@
-template <~a~>
-function void test (a var){ <<< var>>>; }
-template <~a, b~>
-function void test (a var, b var2){ <<< var>>>; }
-//function void test (){ }
-
+function<~A~> void test (A var){ <<< var>>>; }
+function<~A,B~> void test (A var, B var2){ <<< var>>>; }
 test<~int~>(1);
-//test<float>(1.4);
-//test<int>(3, 1.4);
-//test<float>(3);
-//test(3, 1.4);
 test<~float, float~>(3, 1.4);
-//test<float, float, int>(3, 1.4);
index ebfa2514a40190a271d41087babf03871c6c2771..e5fe155fff92cf8d692704952f1eaf39fcd8a5fe 100644 (file)
@@ -4,20 +4,15 @@ fun void test(C cc, int i) { <<<1>>>; <<<cc.test(i, i)>>>; }
 
 
 class C {
-  template<~A~>
-  fun int test(A a) { <<<" A ", a>>>; }
-  template<~A~>
-  fun int test(A a, int i) { <<<" ", a >>>; }
-  template<~A~>
-  fun int test(A a, int i, int j) { <<<a>>>; }
+  fun<~A~> int test(A a) { <<<" A ", a>>>; }
+  fun<~A~> int test(A a, int i) { <<<" ", a >>>; }
+  fun<~A~> int test(A a, int i, int j) { <<<a>>>; }
 }
 class D extends C {
-  template<~A~>
-  fun int test(A a, int i) { <<<this, " extent ", a, __func__>>>; }
+  fun int<~A~> test(A a, int i) { <<<this, " extent ", a, __func__>>>; }
 }
 class E extends D {
-  template<~A~>
-  fun int test(A a, int i) { <<<this, " Extent ", a, __func__>>>; }
+  fun int<~A~> test(A a, int i) { <<<this, " Extent ", a, __func__>>>; }
 }
 
 
index 85d940843b05eb54c1f6ed4ca9150c2cea3d0600..f68ac1a35da1476f2ae226490ba3d9e0282935e9 100644 (file)
@@ -1,5 +1,4 @@
-template <~A, B~>
-function void test(A a, B b){<<<a, ", ", b>>>;}
+function void<~A,B~> test(A a, B b){<<<a, ", ", b>>>;}
 test(1, 2.1);
 test(1.1, 2.1);
 test(1.2, 2);
index d9914d32e486e97b70ac5a5da8cb61ff88f68af6..77ad4f94531ab3c9ab250163935dd4fcb4341a4a 100644 (file)
@@ -1,5 +1,4 @@
-template <~a~>
-fun void test(...) {
+fun<~A~> void test(...) {
   vararg.start;
   <<<vararg.i>>>;
   vararg.end;
index ee55739a8b09a143eacd5cf9f2cf37ae6b513363..73a675d78fe11aa56a830bd839a49c09182ea595 100644 (file)
@@ -1,9 +1,7 @@
 class Tester
 {
-       template<~A~>
-       function int assert_equal(string description, A a, A b){ if(a == b) return 0; return 1; }
-       template<~A~>
-       function int assert_not_equal(string description, A a, A b){ if(a != b) return 0; return 1; }
+       function<~A~> int assert_equal(string description, A a, A b){ if(a == b) return 0; return 1; }
+       function<~A~> int assert_not_equal(string description, A a, A b){ if(a != b) return 0; return 1; }
 }
 
 Tester t;
index 03ef8747588ead6b4bff2db88262b78e48e6e3b4..c160b6f287c77703f3da895c42dc54cd6b7e1e46 100644 (file)
@@ -1,6 +1,2 @@
-//template <~a~>
 function void test(){}
-//function void test(int i[]){<<<i>>>;}
-//function void test(Object o){}
-
 test([1], 2.3);
index d46f774505faca00fcb37521c9a3724cdad299d0..fd81f4ed15bdc449df167d08b59972a6ecf988f7 100644 (file)
@@ -1,6 +1,5 @@
 // [contains] you must provide template types
-template<~A~>
-class C {
+class<~A~> C {
   A a;
 }
 
index 2fd7cc12aa313e9aea743818cc1a8c37b5c40abf..6261d08400c65d6d927aab52fff5131bf496da6c 100644 (file)
@@ -1,4 +1,3 @@
 // [contains] 
- template<~a, b~>
-function void test(){}
+function<~A,B~> void test(){}
 test();
index 44a74172941428d5a788930372cfe2d51802aaa3..a5892457eb87447d9db684fae25b1603ff447c1e 100644 (file)
@@ -1,8 +1,6 @@
 // [contains] arguments do not match for template call
-template <~i~>
-function void test(){ <<<"func">>>;}
-template <~i~>
-function void test(int i){<<<"other func">>>;}
+function<~A~> void test(){ <<<"func">>>;}
+function<~A~> void test(int i){<<<"other func">>>;}
 
 test<~int, float, int~>();
 //test<~int~>();
index 02ed2e53493e1f6562d80dbb89acb45be3fcbed8..08586135cc4758c5a8bc4991b99351689f76e7b9 100644 (file)
@@ -1,9 +1,7 @@
 // [contains] arguments do not match for template call
 class C {
-       template <~a~>
-       function void test(float f) {}
-       template <~a~>
-       function void test() {}
+  function<~A~> void test(float f) {}
+  function<~A~> void test() {}
 }
 C c;
 //c.test<~int~>();
index 792855329285dc90ad0cc015209fd7df168b2e65..86318b6add5b3fce25bfbcbc63bb516a91d6adf2 100644 (file)
@@ -1,5 +1,4 @@
 // [contains] invalid expression for function call
-template<~A~>
-function void test(A a){}
+function<~A~> void test(A a){}
 
 (maybe ? test : test)(1);
index 85b4eaf0d546c80e3945dc134aed97e1a1b07e69..503d7a3e1ab08c9ba5cf3ba65d9ce51eb3491100 100644 (file)
@@ -1,5 +1,4 @@
 // [contains] unknown type
- template<~my_type~>
-function void my_function() { <<<"test">>>; }
+function<~A~> void my_function() { <<<"test">>>; }
 
 my_function<~unknown_type~>();
index 225eb4e6c400741e806b7bdcfd23bf1529f255ca..9501a3159457e6839757f615cf7e3bc341cb1780 100644 (file)
@@ -5,8 +5,7 @@ class C {
   fun A test() {
     <<<"lol">>>;
   }
-  template<~C~>
-  fun void test2(C c) {
+  fun<~C~> void test2(C c) {
     <<<c>>>;
   }
 }
index 8b91a6cf4d90b12d540bd26a91224bef04ee901e..a7077e0c32039d4c2cd93c92d93d69529adeaee2 100644 (file)
@@ -1,5 +1,4 @@
-template <~A~>
-class C {
+class<~A~> C {
   A a;
 }
 
index 96b9d1096ceab218e1c3ba42f3cf0e866f8f162d..263cc91898e58f81de16d35a47a420371d900962 100644 (file)
@@ -1,5 +1,4 @@
-template<~A~>
-class C {}
+class<~A~> C {}
 
 <~int~>C ref;
 <<<ref>>>;
index 7f7dc18995f485572f335d9e6d182c50464e9ec2..a15652177f8263edd3ad2304fe0c212945afee2d 100644 (file)
@@ -6,7 +6,7 @@ lol t;
 class C extends lol { int i;}
 C c;
 <<<c.i>>>;
-template <~A~> class D {
+class<~A~> D {
   <<<"lol">>>;
   int i;
 }