-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 2.0.4 to 2.0.6 cannot instantiate: 'SomeInteger' in return type #23730
Comments
Culprit is #23188, we check for generic parameters that are instantiated with unresolved statics, but in this case the parameter getting instantiated is only matching that it is |
metagn
added a commit
to metagn/Nim
that referenced
this issue
Jun 18, 2024
Araq
pushed a commit
that referenced
this issue
Jun 18, 2024
…3731) fixes #23730 Since #23188 the compiler errors when matching a type variable to an uninstantiated static value. However sometimes an uninstantiated static value is given even when only a type match is being performed to the base type of the static type, in the given issue this case is: ```nim proc foo[T: SomeInteger](x: T): int = int(x) proc bar(x: static int): array[foo(x), int] = discard discard bar(123) ``` To deal with this issue we only error when matching against a type variable constrained to `static`. Not sure if the `q.typ.kind == tyGenericParam and q.typ.genericConstraint == tyStatic` check is necessary, the code above for deciding whether the variable becomes `skConst` doesn't use it.
narimiran
pushed a commit
that referenced
this issue
Jun 24, 2024
…3731) fixes #23730 Since #23188 the compiler errors when matching a type variable to an uninstantiated static value. However sometimes an uninstantiated static value is given even when only a type match is being performed to the base type of the static type, in the given issue this case is: ```nim proc foo[T: SomeInteger](x: T): int = int(x) proc bar(x: static int): array[foo(x), int] = discard discard bar(123) ``` To deal with this issue we only error when matching against a type variable constrained to `static`. Not sure if the `q.typ.kind == tyGenericParam and q.typ.genericConstraint == tyStatic` check is necessary, the code above for deciding whether the variable becomes `skConst` doesn't use it. (cherry picked from commit 128090c)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When using a static parameter as right hand side argument to a function like
shl
(which takes a SomeInteger as 2nd argument) the Nim compiler throws an error. This is a regression I noticed when upgrading to Nim 2.0.6.Test code:
Nim Version
Nim Compiler Version 2.0.6 [Linux: amd64]
Compiled at 2024-06-17
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: c00e8e7
active boot switches: -d:release
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: