This commit is contained in:
Zahary Karadjov 2017-03-24 15:29:40 +02:00
commit 52377740b6

View file

@ -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