Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concept cannot be overloaded with var concept #9733

Open
dawkot opened this issue Nov 16, 2018 · 1 comment
Open

concept cannot be overloaded with var concept #9733

dawkot opened this issue Nov 16, 2018 · 1 comment
Labels

Comments

@dawkot
Copy link

dawkot commented Nov 16, 2018

So this is valid code:

func foo(x: int): int = x
func foo(x: var int): var int = x
var x = 0
discard foo x

But this isn't:

type Foo = concept foo
func foo(x: Foo): Foo = x
func foo(x: var Foo): var Foo = x
var x = 0
discard foo x
Error: ambiguous call; both inim_1542378399.foo(x: Foo)[declared in inim_1542378399.nim(4, 5)] and inim_1542378399.foo(x: var Foo)[declared in inim_1542378399.nim(5, 5)] match for: (int)
@krux02
Copy link
Contributor

krux02 commented Nov 16, 2018

My personal opinion is, don't use concepts, they currently cause more problems than they solve. But yes, this is bad.

@krux02 krux02 changed the title Unexpected ambiguous call error when using a concept constrained function argument concept cannot be overloaded with var concept. Nov 16, 2018
@krux02 krux02 changed the title concept cannot be overloaded with var concept. concept cannot be overloaded with var concept Nov 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants