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

Regression from version-2-0 to devel with generic object param type with default value: Maybe generic arguments are missing? #24090

Closed
tersec opened this issue Sep 10, 2024 · 1 comment · Fixed by #24092
Assignees

Comments

@tersec
Copy link
Contributor

tersec commented Sep 10, 2024

Description

type M[V] = object
template y[V](N: type M, v: V): M[V] = default(M[V])
proc d(x: int | int, f: M[int] = M.y(0)) = discard
d(0, M.y(0))

Nim Version

Builds:

Nim Compiler Version 2.0.9 [Linux: amd64]
Compiled at 2024-09-10
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 8d254a5945c5cb7612dff2a53be8f8d12b846d60
active boot switches: -d:release

Does not build:

Nim Compiler Version 2.1.99 [Linux: amd64]
Compiled at 2024-09-10
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 21771765a2c1f1fc86d87ad6e032d4050d8a651b
active boot switches: -d:release

Current Output

/tmp/h.nim(4, 2) Error: cannot instantiate: 'M[V]'; Maybe generic arguments are missing?

Expected Output

Builds

Known Workarounds

No response

Additional Information

No response

@metagn
Copy link
Collaborator

metagn commented Sep 10, 2024

Not the same root problem as #23432 but this shows how typedesc isn't consistent in how it's only supposed to allow fully concrete types. Maybe type can keep this behavior along with allowing generic params but we can add a new concreteType or just use typedesc to enforce concrete types.

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

Successfully merging a pull request may close this issue.

3 participants