Merge branch 'devel' into pr_when_typ

This commit is contained in:
ringabout
2026-05-18 20:08:23 +08:00
committed by GitHub
15 changed files with 83 additions and 23 deletions

View File

@@ -0,0 +1,10 @@
discard """
matrix: "-d:nimPreviewSlimSystem --warning:StdPrefix:on --warningAsError:StdPrefix:on --import:std/objectdollar"
output: "(a: 23, b: 45)"
"""
type Foo = object
a, b: int
let x = Foo(a: 23, b: 45)
echo x

View File

@@ -0,0 +1,13 @@
discard """
cmd: "nim check --strings:sso --mm:orc --hints:off $file"
action: "reject"
nimout: '''
tsso_string_index_var.nim(13, 12) Error: expression 's[0]' is immutable, not 'var'
'''
"""
proc passByVar(c: var char) =
c = 'x'
var s = "abc"
passByVar(s[0])

View File

@@ -544,6 +544,12 @@ proc main() =
var x = 5
doAssert fmt"{(x=7;123.456)=:13e}" == "(x=7;123.456)= 1.234560e+02"
doAssert x==7
block: # binary operators in interpolated expressions
let n = 1
doAssert &"{n-1}" == "0"
doAssert fmt"{n-1}" == "0"
block: #curly bracket expressions and tuples
proc formatValue(result: var string; value:Table|bool|JsonNode; specifier:string) = result.add $value