mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-02 05:29:01 +00:00
fixes genMagicExpr: handle mAsgn for Isolated[T] with primitive types in tuple assignment (#25955)
Explicit `=sink` calls such as `Isolated[T].=sink` can delegate to a
field type like `float`, which has no attached sink op. In that case
`replaceHookMagic` leaves the builtin `mAsgn` call in place.
`genMagicExpr` did not lower that shape, which caused the regression.
Mapping `=sink` to `nkSinkAsgn` and other builtin assignment hooks to
`nkAsgn`.
(cherry picked from commit 985b1125b1)
This commit is contained in:
12
tests/arc/tisolated_primitive.nim
Normal file
12
tests/arc/tisolated_primitive.nim
Normal file
@@ -0,0 +1,12 @@
|
||||
# Issue: genMagicExpr: mAsgn internal error when using Isolated[T] with primitive types
|
||||
# in tuple assignment to pointer dereference
|
||||
|
||||
import std/isolation
|
||||
|
||||
proc main() =
|
||||
var x: ptr Isolated[float]
|
||||
x = cast[ptr Isolated[float]](alloc0(sizeof(Isolated[float])))
|
||||
x[] = isolate(42.0)
|
||||
dealloc(x)
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user