close #1570
This commit is contained in:
parent
e31575c27a
commit
52377740b6
1 changed files with 21 additions and 1 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''true'''
|
output: '''true
|
||||||
|
true
|
||||||
|
true
|
||||||
|
true'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# https://github.com/nim-lang/Nim/issues/1147
|
# https://github.com/nim-lang/Nim/issues/1147
|
||||||
|
|
@ -14,3 +17,20 @@ type CAddable = concept x
|
||||||
|
|
||||||
echo((ref TTest) is CAddable)
|
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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue