Files
Nim/tests/generics
metagn 5cbc7a6d1b fix regression with generic params in static type (#24075)
Caught in https://github.com/metagn/applicates, I'm not sure which
commit causes this but it's also in the 2.0 branch (but not 2.0.2), so
it's not any recent PRs.

If a proc has a static parameter with type `static Foo[T]`, then another
parameter with type `static Bar[T, U]`, the generic instantiation for
`Bar` doesn't match `U` which has type `tyGenericParam`, but matches `T`
since it has type `tyTypeDesc`. The reason is that `concreteType`
returns the type itself for `tyTypeDesc` if `c.isNoCall` (i.e. matching
a generic invocation), but returns `nil` for `tyGenericParam`. I'm
guessing `tyGenericParam` is received here because of #22618, but that
doesn't explain why `T` is still `tyTypeDesc`. I'm not sure.

Regardless, we can just copy the behavior for `tyTypeDesc` to
`tyGenericParam` and also return the type itself when `c.isNoCall`. This
feels like it defeats the purpose of `concreteType` but the way it's
used doesn't make sense without it (generic param can't match another
generic param?). Alternatively we could loosen the `if concrete == nil:
return isNone` checks in some places for specific conditions, whether
`c.isNoCall` or `c.inGenericContext == 0` (though this would need

(cherry picked from commit 24e5b21c90)
2024-12-16 15:11:47 +01:00
..
2015-09-13 23:26:44 +02:00
2015-08-10 01:31:42 +02:00
2015-07-02 16:29:22 +02:00
2022-10-26 19:45:51 +08:00
2020-07-14 11:24:17 +02:00
2020-07-11 17:09:41 +02:00
2020-09-21 13:37:14 +02:00
2023-06-05 16:30:08 +08:00
2022-12-04 20:37:23 +01:00
2024-04-17 10:55:19 +02:00
2020-03-11 09:26:57 +01:00
2017-04-15 02:53:28 +03:00
2016-03-28 02:26:38 +02:00
2020-07-14 19:50:42 +02:00
2022-10-02 06:42:41 +02:00
2018-11-08 22:28:29 +01:00
2019-05-15 08:17:29 +02:00
2022-09-23 13:05:05 +02:00
2015-10-27 08:37:56 +01:00
2018-12-11 21:23:22 +01:00