feat: improve borrow checker — reinitialization, assignment move, return move

- Add isOwn field to Symbol for tracking own T declarations
- Reinitialization after move: assigning to a moved variable removes it from movedVars
- Move tracking in let/var initialization: var b: own Box = a moves a
- Move tracking in assignment: x = y moves y if y is own T
- Move tracking in return: return x moves x if x is own T
- Expand borrow_test.nim to 10 tests (all passing)
This commit is contained in:
2026-06-05 21:56:47 +03:00
parent ce3b4c99f0
commit 636c49e9df
8 changed files with 145 additions and 27 deletions
+1
View File
@@ -16,6 +16,7 @@ type
decl*: Decl ## optional back-reference to AST decl
isMutable*: bool
isPublic*: bool
isOwn*: bool ## true if declared as own T
Scope* = ref object
parent*: Scope