mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 10:22:15 +00:00
This is a temporary fix that will be reworked in a follow up commit that aims to eliminate the tfExplicit flag from the compiler. The complete and proper fix was considered too risky for inclusion just before our 0.19 release.
26 lines
434 B
Nim
26 lines
434 B
Nim
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)
|
|
|