Files
Nim/tests/arc
metagn f201c4e225 fix compiler crash with uncheckedAssign and range/distinct discrims [backport] (#25585)
On simple code like:

```nim
type Foo = object
  case x: range[0..7]
  of 0..2:
    a: string
  else:
    b: string

var foo = Foo()
{.cast(uncheckedAssign).}:
  foo.x = 5
```

The compiler tries to generate a destructor for the variant fields by
checking if the discrim is equal to the old one, but the type is not
skipped when looking for an `==` operator in system, so any
discriminator with type `range`/`distinct`/etc crashes with:

```
(10, 9) Error: can't find magic equals operator for type kind tyRange
```

This is fixed by just skipping abstract types.

(cherry picked from commit 7a87e7d199)
2026-03-09 10:13:04 +01:00
..
2020-07-07 22:43:36 +02:00
2020-07-07 22:43:36 +02:00
2020-07-07 22:43:36 +02:00
2020-11-12 09:28:32 +01:00
2021-03-04 19:33:16 +01:00
2023-07-06 15:15:50 +02:00
2021-10-29 19:55:48 +02:00
2022-10-02 06:44:10 +02:00
2020-11-26 10:24:52 +01:00
2020-10-19 22:25:43 +02:00
2023-06-30 14:54:46 +02:00
2020-03-09 15:32:38 +01:00
2022-10-17 23:48:51 +02:00
2020-04-22 17:34:35 +02:00
2020-09-11 01:50:42 +02:00
2021-07-27 09:36:19 +02:00
2020-09-24 15:41:45 +02:00
2020-07-04 07:37:24 +02:00
2021-07-27 14:32:56 +02:00