blob: e0e19adbc80951753130c6175de260f99fe34c38 (
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
|
discard """
output: '''true'''
"""
# bug #3686
type Monoid = concept x, y
x + y is type(x)
type(z(type(x))) is type(x)
proc z(x: typedesc[int]): int = 0
echo(int is Monoid)
# https://github.com/nim-lang/Nim/issues/8126
type AdditiveMonoid* = concept x, y, type T
x + y is T
# some redundant checks to test an alternative approaches:
type TT = type(x)
x + y is type(x)
x + y is TT
doAssert(1 is AdditiveMonoid)
|