Files
Nim/compiler
metagn 817dd06eb2 fix compiler crash regression with explicit destructor calls [backport:2.2] (#25717)
Unfortunately I do not have a test case for this (although I can link
[this package
test](60f1be9037/tests/test_simple_combined.nim)
which broke), but this is a regression caused by #24841 (which was
backported to 2.2.4) that causes the following compiler crash:

```
assertions.nim(34)       raiseAssert
Error: unhandled exception: ccgtypes.nim(230, 13) `false` mapType: tyGenericInvocation [AssertionDefect]
```

Codegen is traversing the type of the symbol of an explicit destructor
call, but the symbol is the uninstantiated generic hook. This happens
because #24841 changed the code which gives explicit destructor calls
the proper attached destructor to use `replaceHookMagic`, which now
skips `abstractVar` from the type to get the destructor whereas
previously it was just `{tyAlias, tyVar}`. This skips `tyGenericInst`
and also `tyDistinct`. I cannot explain why the skipped `tyGenericInst`
does not have the right destructor but it's not really unexpected, and
skipping `tyDistinct` is just wrong.

To fix this, just `{tyAlias, tyVar, tySink}` are skipped.

(cherry picked from commit 0dc577a4dc)
2026-04-09 18:12:45 +02:00
..
2023-12-15 10:20:57 +01:00
2026-01-09 09:03:51 +01:00
2025-11-27 19:03:50 +01:00
2025-01-14 07:53:29 +01:00
2026-03-17 10:12:06 +01:00
2026-01-09 09:03:51 +01:00
2017-01-07 22:35:09 +01:00
2026-01-09 09:03:51 +01:00
2026-03-09 10:13:31 +01:00
2025-01-15 10:21:20 +01:00
2026-01-09 09:03:51 +01:00
2021-01-12 09:36:51 +01:00
2024-07-09 09:29:45 +02:00
2026-01-09 09:03:51 +01:00
2025-01-14 07:51:55 +01:00
2023-07-02 22:36:05 +02:00
2023-11-06 18:33:28 +01:00
2025-09-22 08:47:23 +02:00
2024-03-16 08:35:18 +08:00
2023-12-25 07:12:54 +01:00

Nim Compiler

  • This directory contains the Nim compiler written in Nim.
  • Note that this code has been translated from a bootstrapping version written in Pascal.
  • So the code is not a poster child of good Nim code.

See Internals of the Nim Compiler for more information.