From c981284ddcbfe192b3554c9730b5fa6fc1b35a17 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Fri, 28 Apr 2017 17:40:57 +0300 Subject: a simple way to simulate covariance in generic types --- tests/generics/tfakecovariance.nim | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/generics/tfakecovariance.nim (limited to 'tests/generics') diff --git a/tests/generics/tfakecovariance.nim b/tests/generics/tfakecovariance.nim new file mode 100644 index 000000000..835acd9d3 --- /dev/null +++ b/tests/generics/tfakecovariance.nim @@ -0,0 +1,11 @@ +type + BaseObj = object of RootObj + DerivedObj = object of BaseObj + + Container[T] = object + +proc doSomething(c: Container[BaseObj or DerivedObj]) = discard + +var t: Container[DerivedObj] +doSomething t + -- cgit 1.4.1-2-gfad0 c3e7'>this commit This repository contains the Nim compiler, Nim's stdlib, tools, and documentation. (mirror)ahoang <ahoang@tilde.institute>
summary refs log tree commit diff stats
path: root/tests/parser/toprprec.nim
blob: e6a43d42ee3bd19526d51fd534e68ba89e6edec6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37