diff options
author | metagn <metagngn@gmail.com> | 2024-01-11 09:45:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-11 07:45:11 +0100 |
commit | e8092a54704be254cd7ccb4f5ecfca7cb059fe5c (patch) | |
tree | 3acf298421fcb77a23daba7b839ea73d48f2a338 /tests/generics/t6137.nim | |
parent | e20a2b1f2bd2a55f16ed5d66f37bbb562c27f7cd (diff) | |
download | Nim-e8092a54704be254cd7ccb4f5ecfca7cb059fe5c.tar.gz |
delay resolved procvar check for proc params + acknowledge unresolved statics (#23188)
fixes #23186 As explained in #23186, generics can transform `genericProc[int]` into a call `` `[]`(genericProc, int) `` which causes a problem when `genericProc` is resemmed, since it is not a resolved generic proc. `[]` needs unresolved generic procs since `mArrGet` also handles explicit generic instantiations, so delay the resolved generic proc check to `semFinishOperands` which is intentionally not called for `mArrGet`. The root issue for [t6137](https://github.com/nim-lang/Nim/blob/devel/tests/generics/t6137.nim) is also fixed (because this change breaks it otherwise), the compiler doesn't consider the possibility that an assigned generic param can be an unresolved static value (note the line `if t.kind == tyStatic: s.ast = t.n` below the change in sigmatch), now it properly errors that it couldn't instantiate it as it would for a type param. ~~The change in semtypinst is just for symmetry with the code above it which also gives a `cannot instantiate` error, it may or may not be necessary/correct.~~ Now removed, I don't think it was correct. Still possible that this has unintended consequences.
Diffstat (limited to 'tests/generics/t6137.nim')
-rw-r--r-- | tests/generics/t6137.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/generics/t6137.nim b/tests/generics/t6137.nim index 991f39dd1..fb7db22f8 100644 --- a/tests/generics/t6137.nim +++ b/tests/generics/t6137.nim @@ -1,6 +1,6 @@ discard """ - errormsg: "\'vectFunc\' doesn't have a concrete type, due to unspecified generic parameters." - line: 28 + errormsg: "cannot instantiate: 'T'" + line: 19 """ type |