mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-30 00:35:12 +00:00
Merge branch 'devel' into pr_when_typ
This commit is contained in:
10
tests/compiler/tcmdline_import_std_prefix.nim
Normal file
10
tests/compiler/tcmdline_import_std_prefix.nim
Normal 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
|
||||
13
tests/errmsgs/tsso_string_index_var.nim
Normal file
13
tests/errmsgs/tsso_string_index_var.nim
Normal 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])
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user