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

Generics: type mismatch with multi-range types #7447

Open
mratsim opened this issue Mar 30, 2018 · 0 comments
Open

Generics: type mismatch with multi-range types #7447

mratsim opened this issue Mar 30, 2018 · 0 comments

Comments

@mratsim
Copy link
Collaborator

mratsim commented Mar 30, 2018

In the Generics type mismatch series #7432 and #7446

type HexChars = range['0'..'9'] or range['A'..'F'] or range['a'..'f']

proc foo(x: HexChars) = discard

let a = '0'

foo(a)
Error: type mismatch: got <char>
but expected one of:
proc foo(x: HexChars)

expression: foo(a)

I'm not sure range can be used like that but there should be an error message "you cannot combine Generics with ranges" in case it's not supposed to work like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants