mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
fixes #23223
(cherry picked from commit 3379d26629)
This commit is contained in:
@@ -2426,6 +2426,8 @@ when hasAlloc or defined(nimscript):
|
||||
## var a = "abc"
|
||||
## a.insert("zz", 0) # a <- "zzabc"
|
||||
## ```
|
||||
if item.len == 0: # prevents self-assignment
|
||||
return
|
||||
var xl = x.len
|
||||
setLen(x, xl+item.len)
|
||||
var j = xl-1
|
||||
|
||||
@@ -212,3 +212,10 @@ block:
|
||||
doAssert not compiles(echo p.rawProc.repr)
|
||||
doAssert not compiles(echo p.rawEnv.repr)
|
||||
doAssert not compiles(echo p.finished)
|
||||
|
||||
proc bug23223 = # bug #23223
|
||||
var stuff = "hello"
|
||||
stuff.insert ""
|
||||
doAssert stuff == "hello"
|
||||
|
||||
bug23223()
|
||||
|
||||
Reference in New Issue
Block a user