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

type doesn't work with generics (and default) in a function definition #11112

Closed
dawkot opened this issue Apr 25, 2019 · 1 comment · Fixed by #24005
Closed

type doesn't work with generics (and default) in a function definition #11112

dawkot opened this issue Apr 25, 2019 · 1 comment · Fixed by #24005

Comments

@dawkot
Copy link

dawkot commented Apr 25, 2019

proc foo[A, B]: type(A.default + B.default) =
  discard

system.+: proc (x: float32, y: float32): float32{.noSideEffect.}
ambiguous call; both system.+(x: float32, y: float32) [declared in C:\Users\dawkot.choosenim\toolchains\nim-#devel\lib\system.nim(1507, 6)] and system.+(x: int32, y: int32) [declared in C:\Users\dawkot.choosenim\toolchains\nim-#devel\lib\system.nim(1209, 6)] match for: (type(A.default), type(B.default))

Of course, something similiar works without generics:

proc foo[A, B]: type(int8.default + int16.default) =
  discard
@metagn
Copy link
Collaborator

metagn commented Sep 16, 2023

Related #15959 and more I can't find (early generics), default is evaluated eagerly on the unresolved generic types A and B

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