Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##############
- # Module LIB #
- ##############
- type
- SomeConcept = concept c
- c.myProc() is int
- SomeType[T: SomeConcept] = object
- field: T
- # When this is uncommented, the code compiles and works as expeted.
- # proc myProc(c: SomeConcept): int = discard
- proc init*[T](t: T):SomeType[T] =
- result.field = t
- proc myProc*[T](t: SomeType[T]) =
- t.field.myProc()
- echo "outer"
- #####################
- # Some other Module #
- #####################
- import lib
- proc myProc(i: int) =
- echo "inner"
- var
- i = 5
- t = init(i)
- myProc(t)
- # lib.nim(15, 10) Error: type mismatch: got (int)
- # but expected one of:
- # proc myProc[T](t: SomeType[T])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement