tests: add base_vararg3.nit
authorJean Privat <jean@pryen.org>
Wed, 15 Oct 2014 18:53:16 +0000 (14:53 -0400)
committerJean Privat <jean@pryen.org>
Fri, 17 Oct 2014 00:17:51 +0000 (20:17 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_vararg3.nit [new file with mode: 0644]
tests/sav/base_vararg3.res [new file with mode: 0644]
tests/sav/base_vararg3_alt1.res [new file with mode: 0644]
tests/sav/base_vararg3_alt2.res [new file with mode: 0644]
tests/sav/base_vararg3_alt3.res [new file with mode: 0644]
tests/sav/base_vararg3_alt4.res [new file with mode: 0644]

diff --git a/tests/base_vararg3.nit b/tests/base_vararg3.nit
new file mode 100644 (file)
index 0000000..6918fef
--- /dev/null
@@ -0,0 +1,45 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import array
+
+class A
+       fun foo(a: Int...) do a.first.output
+end
+
+class B
+       super A
+       redef fun foo(a)
+       do
+               'a'.output
+               super
+               'b'.output
+               super(a...)
+               'c'.output
+               super(4,5,6)
+               'd'.output
+               super([5,6,7]...)
+               #alt3#super(a)
+               #alt4#super(1...)
+       end
+end
+
+var a = new A
+a.foo(1,2,3)
+a.foo([2,3,4]...)
+#alt1#a.foo([1,2,3])
+#alt2#a.foo(1...)
+
+var b = new B
+b.foo(3,4,5)
diff --git a/tests/sav/base_vararg3.res b/tests/sav/base_vararg3.res
new file mode 100644 (file)
index 0000000..7d434e8
--- /dev/null
@@ -0,0 +1,6 @@
+1
+2
+a3
+b3
+c4
+d5
diff --git a/tests/sav/base_vararg3_alt1.res b/tests/sav/base_vararg3_alt1.res
new file mode 100644 (file)
index 0000000..1e24ee6
--- /dev/null
@@ -0,0 +1 @@
+alt/base_vararg3_alt1.nit:41,7--13: Type error: expected Int, got Array[Int]
diff --git a/tests/sav/base_vararg3_alt2.res b/tests/sav/base_vararg3_alt2.res
new file mode 100644 (file)
index 0000000..52bce29
--- /dev/null
@@ -0,0 +1 @@
+alt/base_vararg3_alt2.nit:42,7: Type error: expected Array[Int], got Int
diff --git a/tests/sav/base_vararg3_alt3.res b/tests/sav/base_vararg3_alt3.res
new file mode 100644 (file)
index 0000000..e7e44bc
--- /dev/null
@@ -0,0 +1 @@
+alt/base_vararg3_alt3.nit:33,9: Type error: expected Int, got Array[Int]
diff --git a/tests/sav/base_vararg3_alt4.res b/tests/sav/base_vararg3_alt4.res
new file mode 100644 (file)
index 0000000..caca43b
--- /dev/null
@@ -0,0 +1 @@
+alt/base_vararg3_alt4.nit:34,9: Type error: expected Array[Int], got Int