Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_isa_gen8.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 import base_minimal
18
19 class X end
20 class Y end
21 class Z end
22
23 class A[T]
24 fun foo: B[T] do
25 return new B[T]
26 end
27 end
28
29 class B[U]
30 end
31
32 class C[V, W] end
33 class D[T, U, V] end
34 class E[T, U, V, W] end
35
36 var ax = new A[X]
37 var ay = new A[Y]
38 var az = new A[Z]
39
40 var b = ax.foo
41
42 var cxx = new C[X, X]
43 var cxy = new C[X, Y]
44 var cxz = new C[X, Z]
45
46 var d = new D[X, Y, Z]
47 var e = new E[X, Y, Z, Bool]
48
49 assert ax isa A[X]
50 assert ay isa A[Y]
51 assert az isa A[Z]
52
53 assert b isa B[Object]
54
55 assert cxx isa C[X, X]
56 assert cxy isa C[X, Y]
57 assert cxz isa C[X, Z]
58
59 assert d isa D[X, Y, Z]
60 assert e isa E[X, Y, Z, Bool]
61
62
63
64 true.output