mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-03 12:34:44 +00:00
fix https://github.com/nim-lang/RFCs/issues/311 remove unary slice (#16714)
This commit is contained in:
@@ -171,7 +171,7 @@ block tableconstr:
|
||||
# NEW:
|
||||
doAssert 56 in 50..100
|
||||
|
||||
doAssert 56 in ..60
|
||||
doAssert 56 in 0..60
|
||||
|
||||
|
||||
block ttables2:
|
||||
|
||||
@@ -11,10 +11,9 @@ verichtetd
|
||||
|
||||
# Test the new slices.
|
||||
|
||||
import strutils
|
||||
|
||||
var mystr = "Abgrund"
|
||||
mystr[..1] = "Zu"
|
||||
# mystr[..1] = "Zu" # deprecated
|
||||
mystr[0..1] = "Zu"
|
||||
|
||||
mystr[4..4] = "5"
|
||||
|
||||
@@ -23,7 +22,8 @@ type
|
||||
|
||||
var myarr: array[TEnum, int] = [1, 2, 3, 4, 5, 6]
|
||||
myarr[e1..e3] = myarr[e4..e6]
|
||||
myarr[..e3] = myarr[e4..e6]
|
||||
# myarr[..e3] = myarr[e4..e6] # deprecated
|
||||
myarr[0..e3] = myarr[e4..e6]
|
||||
|
||||
for x in items(myarr): stdout.write(x)
|
||||
echo()
|
||||
@@ -46,7 +46,8 @@ echo mystr
|
||||
mystr[4..4] = "u"
|
||||
|
||||
# test full replacement
|
||||
mystr[.. ^2] = "egerichtet"
|
||||
# mystr[.. ^2] = "egerichtet" # deprecated
|
||||
mystr[0 .. ^2] = "egerichtet"
|
||||
|
||||
echo mystr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user