nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.63k stars 1.47k forks source link

Implicitly generic procs don't perform argument conversion for dependent types #7009

Open RedBeard0531 opened 6 years ago

RedBeard0531 commented 6 years ago
type Node[T] = object
    val: T

proc genericProc(s: Node; key: s.T) =
    discard # body doesn't matter
proc explicitGenericProc[T](s: Node[T]; key: T) =
    discard # body doesn't matter
proc concreteProc(s: Node[cstring]; key: s.T) =
    discard # body doesn't matter 

var strs: Node[cstring]
concreteProc(strs, "string") # string converts to cstring
explicitGenericProc(strs, "string") # still converts
genericProc(strs, "string") # doesn't convert: COMPILE ERROR
RedBeard0531 commented 6 years ago

7008 was discovered trying to make a minimal repro for this.

7006 may be related.

metagn commented 3 weeks ago

Works in 2.2, likely same fix as #7006