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.57k stars 1.47k forks source link

`type` proc used on a concept-constrained variable return void #9732

Open dawkot opened 5 years ago

dawkot commented 5 years ago
type Foo = concept foo
func foo(foo: Foo): type foo = discard
foo(0)
let x = foo(0)

Error: expression 'foo(0)' has no type (or is ambiguous)

dawkot commented 5 years ago

btw, this bug ban be bypassed by declaring the function like this:

func foo[T: Foo](foo: T): T = discard