mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 14:23:45 +00:00
23 lines
347 B
Nim
23 lines
347 B
Nim
discard """
|
|
output: '''monkey'''
|
|
"""
|
|
# bug #5478
|
|
template creature*(name: untyped) =
|
|
type
|
|
name*[T] = object
|
|
color: T
|
|
|
|
proc `init name`*[T](c: T): name[T] =
|
|
mixin transform
|
|
transform()
|
|
|
|
creature(Lion)
|
|
|
|
type Monkey* = object
|
|
proc transform*() =
|
|
echo "monkey"
|
|
|
|
var
|
|
m: Monkey
|
|
y = initLion(m) #this one failed to compile
|