diff options
author | Zahary Karadjov <zahary@gmail.com> | 2017-03-24 15:29:40 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2017-03-24 17:07:30 +0200 |
commit | 52377740b6fe85b03f02552117ac92b82c2809a8 (patch) | |
tree | 143cc6fe37ea2bb0bc6a776c6dfa911b3aff38ee /tests/concepts | |
parent | e31575c27a7ef9543257aa613515fff7adf4ac84 (diff) | |
download | Nim-52377740b6fe85b03f02552117ac92b82c2809a8.tar.gz |
close #1570
Diffstat (limited to 'tests/concepts')
-rw-r--r-- | tests/concepts/tmisc_issues.nim | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/concepts/tmisc_issues.nim b/tests/concepts/tmisc_issues.nim index fad1cd6a7..556e0b9f5 100644 --- a/tests/concepts/tmisc_issues.nim +++ b/tests/concepts/tmisc_issues.nim @@ -1,5 +1,8 @@ discard """ -output: '''true''' +output: '''true +true +true +true''' """ # https://github.com/nim-lang/Nim/issues/1147 @@ -14,3 +17,20 @@ type CAddable = concept x echo((ref TTest) is CAddable) +# https://github.com/nim-lang/Nim/issues/1570 +type ConcretePointOfFloat = object + x, y: float + +type ConcretePoint[Value] = object + x, y: Value + +type AbstractPointOfFloat = generic p + p.x is float and p.y is float + +let p1 = ConcretePointOfFloat(x: 0, y: 0) +let p2 = ConcretePoint[float](x: 0, y: 0) + +echo p1 is AbstractPointOfFloat # true +echo p2 is AbstractPointOfFloat # true +echo p2.x is float and p2.y is float # true + |