Merge branch 'devel' into IOSelector_unregister_fix
This commit is contained in:
commit
92fa7e0579
94 changed files with 1729 additions and 1223 deletions
|
|
@ -4,6 +4,14 @@ int32
|
|||
int32
|
||||
1280
|
||||
1280
|
||||
3
|
||||
1
|
||||
2
|
||||
2
|
||||
3
|
||||
4294967295
|
||||
2
|
||||
0
|
||||
'''
|
||||
"""
|
||||
|
||||
|
|
@ -145,3 +153,17 @@ block tsubrange:
|
|||
|
||||
level = min(level + 2, maxLevel).n16
|
||||
doAssert level == 1
|
||||
|
||||
block tissue12177:
|
||||
var a: uint16 = 1
|
||||
var b: uint32 = 2
|
||||
|
||||
echo(b + a)
|
||||
echo(b - a)
|
||||
echo(b * a)
|
||||
echo(b div a)
|
||||
|
||||
echo(a + b)
|
||||
echo(a - b)
|
||||
echo(a * b)
|
||||
echo(a div b)
|
||||
|
|
|
|||
|
|
@ -582,3 +582,11 @@ template append2*(args: varargs[string, myAppend]): string =
|
|||
|
||||
let foo = append2("1", "2", "3")
|
||||
echo foo
|
||||
|
||||
block t12466:
|
||||
# https://github.com/nim-lang/Nim/issues/12466
|
||||
var a: array[288, uint16]
|
||||
for i in 0'u16 ..< 144'u16:
|
||||
a[0'u16 + i] = i
|
||||
for i in 0'u16 ..< 8'u16:
|
||||
a[0'u16 + i] = i
|
||||
|
|
|
|||
|
|
@ -43,4 +43,14 @@ block: #8399
|
|||
|
||||
waitFor foo("$asd")
|
||||
|
||||
block: # nkCheckedFieldExpr
|
||||
proc bar(): Future[JsonNode] {.async.} =
|
||||
return newJInt(5)
|
||||
|
||||
proc foo() {.async.} =
|
||||
let n = 10 + (await bar()).num
|
||||
doAssert(n == 15)
|
||||
|
||||
waitFor foo()
|
||||
|
||||
echo "ok"
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
discard """
|
||||
output: '''(1, 1)
|
||||
(2, 2)
|
||||
(3, 3)
|
||||
@[1, 2, 3, 4]
|
||||
'''
|
||||
"""
|
||||
|
||||
iterator zip[T1, T2](a: openarray[T1], b: openarray[T2]): iterator() {.inline.} =
|
||||
let len = min(a.len, b.len)
|
||||
for i in 0..<len:
|
||||
echo (a[i], b[i])
|
||||
|
||||
proc foo(args: varargs[int]) =
|
||||
for i in zip(args,args):
|
||||
discard
|
||||
|
||||
foo(1,2,3)
|
||||
|
||||
# 10999
|
||||
|
||||
proc varargsToSeq(vals: varargs[int32]): seq[int32] =
|
||||
result = newSeqOfCap[int32](vals.len)
|
||||
for v in vals:
|
||||
result.add v
|
||||
|
||||
echo varargsToSeq(1, 2, 3, 4)
|
||||
14
tests/ccgbugs/tccgissues.nim
Normal file
14
tests/ccgbugs/tccgissues.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
discard """
|
||||
output: '''
|
||||
@[1, 2, 3, 4]
|
||||
'''
|
||||
"""
|
||||
|
||||
# issue #10999
|
||||
|
||||
proc varargsToSeq(vals: varargs[int32]): seq[int32] =
|
||||
result = newSeqOfCap[int32](vals.len)
|
||||
for v in vals:
|
||||
result.add v
|
||||
|
||||
echo varargsToSeq(1, 2, 3, 4)
|
||||
|
|
@ -233,7 +233,7 @@ block tablesref:
|
|||
for y in 0..1:
|
||||
assert t[(x,y)] == $x & $y
|
||||
assert($t ==
|
||||
"{(x: 0, y: 1): \"01\", (x: 0, y: 0): \"00\", (x: 1, y: 0): \"10\", (x: 1, y: 1): \"11\"}")
|
||||
"{(x: 1, y: 1): \"11\", (x: 0, y: 0): \"00\", (x: 0, y: 1): \"01\", (x: 1, y: 0): \"10\"}")
|
||||
|
||||
block tableTest2:
|
||||
var t = newTable[string, float]()
|
||||
|
|
@ -340,7 +340,7 @@ block tablesref:
|
|||
block anonZipTest:
|
||||
let keys = @['a','b','c']
|
||||
let values = @[1, 2, 3]
|
||||
doAssert "{'a': 1, 'b': 2, 'c': 3}" == $ toTable zip(keys, values)
|
||||
doAssert "{'c': 3, 'a': 1, 'b': 2}" == $ toTable zip(keys, values)
|
||||
|
||||
block clearTableTest:
|
||||
var t = newTable[string, float]()
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ block tableTest1:
|
|||
for y in 0..1:
|
||||
assert t[(x,y)] == $x & $y
|
||||
assert($t ==
|
||||
"{(x: 0, y: 1): \"01\", (x: 0, y: 0): \"00\", (x: 1, y: 0): \"10\", (x: 1, y: 1): \"11\"}")
|
||||
"{(x: 1, y: 1): \"11\", (x: 0, y: 0): \"00\", (x: 0, y: 1): \"01\", (x: 1, y: 0): \"10\"}")
|
||||
|
||||
block tableTest2:
|
||||
var t = initTable[string, float]()
|
||||
|
|
|
|||
|
|
@ -9,23 +9,23 @@ proc test(foo: Foo[int])
|
|||
required type for foo: Foo[int]
|
||||
but expression 'bar' is of type: Bar[system.int]
|
||||
t3330.nim(63, 8) Hint: Non-matching candidates for add(k, string, T)
|
||||
proc add[T](x: var seq[T]; y: openArray[T])
|
||||
first type mismatch at position: 1
|
||||
required type for x: var seq[T]
|
||||
but expression 'k' is of type: Alias
|
||||
proc add[T](x: var seq[T]; y: T)
|
||||
first type mismatch at position: 1
|
||||
required type for x: var seq[T]
|
||||
but expression 'k' is of type: Alias
|
||||
proc add(x: var string; y: string)
|
||||
first type mismatch at position: 1
|
||||
required type for x: var string
|
||||
but expression 'k' is of type: Alias
|
||||
proc add(result: var string; x: float)
|
||||
first type mismatch at position: 1
|
||||
required type for result: var string
|
||||
but expression 'k' is of type: Alias
|
||||
proc add(x: var string; y: cstring)
|
||||
proc add(x: var string; y: char)
|
||||
first type mismatch at position: 1
|
||||
required type for x: var string
|
||||
but expression 'k' is of type: Alias
|
||||
proc add(x: var string; y: string)
|
||||
proc add(x: var string; y: cstring)
|
||||
first type mismatch at position: 1
|
||||
required type for x: var string
|
||||
but expression 'k' is of type: Alias
|
||||
|
|
@ -33,9 +33,9 @@ proc add(result: var string; x: int64)
|
|||
first type mismatch at position: 1
|
||||
required type for result: var string
|
||||
but expression 'k' is of type: Alias
|
||||
proc add(x: var string; y: char)
|
||||
proc add[T](x: var seq[T]; y: openArray[T])
|
||||
first type mismatch at position: 1
|
||||
required type for x: var string
|
||||
required type for x: var seq[T]
|
||||
but expression 'k' is of type: Alias
|
||||
|
||||
t3330.nim(63, 8) template/generic instantiation of `add` from here
|
||||
|
|
|
|||
28
tests/errmsgs/ttypeAllowed.nim
Normal file
28
tests/errmsgs/ttypeAllowed.nim
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
discard """
|
||||
cmd: "nim check $file"
|
||||
errmsg: ""
|
||||
nimout: '''
|
||||
ttypeAllowed.nim(13, 5) Error: invalid type: 'iterator (a: int, b: int, step: Positive): int{.inline, noSideEffect, gcsafe, locks: 0.}' for let
|
||||
ttypeAllowed.nim(17, 7) Error: invalid type for const: iterator (a: int, b: int, step: Positive): int{.inline, noSideEffect, gcsafe, locks: 0.}
|
||||
ttypeAllowed.nim(21, 5) Error: invalid type: 'iterator (a: int, b: int, step: Positive): int{.inline, noSideEffect, gcsafe, locks: 0.}' for var
|
||||
ttypeAllowed.nim(26, 10) Error: invalid type: 'iterator (a: int, b: int, step: Positive): int{.inline, noSideEffect, gcsafe, locks: 0.}' for result
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
let f1 = case true
|
||||
of true: countup[int]
|
||||
of false: countdown[int]
|
||||
|
||||
const f2 = case true
|
||||
of true: countup[int]
|
||||
of false: countdown[int]
|
||||
|
||||
var f3 = case true
|
||||
of true: countup[int]
|
||||
of false: countdown[int]
|
||||
|
||||
proc foobar(): auto =
|
||||
result = case true
|
||||
of true: countup[int]
|
||||
of false: countdown[int]
|
||||
|
|
@ -4,14 +4,14 @@ line: 22
|
|||
nimout: '''
|
||||
twrong_at_operator.nim(22, 30) Error: type mismatch: got <array[0..0, type int]>
|
||||
but expected one of:
|
||||
proc `@`[T](a: openArray[T]): seq[T]
|
||||
first type mismatch at position: 1
|
||||
required type for a: openArray[T]
|
||||
but expression '[int]' is of type: array[0..0, type int]
|
||||
proc `@`[IDX, T](a: sink array[IDX, T]): seq[T]
|
||||
first type mismatch at position: 1
|
||||
required type for a: sink array[IDX, T]
|
||||
but expression '[int]' is of type: array[0..0, type int]
|
||||
proc `@`[T](a: openArray[T]): seq[T]
|
||||
first type mismatch at position: 1
|
||||
required type for a: openArray[T]
|
||||
but expression '[int]' is of type: array[0..0, type int]
|
||||
|
||||
expression: @[int]
|
||||
'''
|
||||
|
|
|
|||
73
tests/generics/tforwardgenericconstrained.nim
Normal file
73
tests/generics/tforwardgenericconstrained.nim
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
discard """
|
||||
output: '''
|
||||
hello some integer
|
||||
hello range
|
||||
hello tuple
|
||||
hello seq
|
||||
hello object
|
||||
hello distinct
|
||||
hello enum
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
|
||||
# SomeInteger
|
||||
|
||||
proc foo[T : SomeInteger](arg: T)
|
||||
proc foo[T : SomeInteger](arg: T) =
|
||||
echo "hello some integer"
|
||||
foo(123)
|
||||
|
||||
# range
|
||||
|
||||
proc foo2[T : range[0..100]](arg: T)
|
||||
proc foo2[T : range[0..100]](arg: T) =
|
||||
echo "hello range"
|
||||
foo2(7)
|
||||
|
||||
# tuple
|
||||
|
||||
proc foo3[T : tuple](arg: T)
|
||||
proc foo3[T : tuple](arg: T) =
|
||||
echo "hello tuple"
|
||||
|
||||
foo3((a:123,b:321))
|
||||
|
||||
# seq
|
||||
|
||||
proc foo4[T: seq](arg: T)
|
||||
proc foo4[T: seq](arg: T) =
|
||||
echo "hello seq"
|
||||
|
||||
foo4(@[1,2,3])
|
||||
|
||||
# object
|
||||
|
||||
proc foo5[T : object](arg: T)
|
||||
proc foo5[T : object](arg: T) =
|
||||
echo "hello object"
|
||||
|
||||
type MyType = object
|
||||
var mt: MyType
|
||||
foo5(mt)
|
||||
|
||||
# distinct
|
||||
|
||||
proc foo6[T : distinct](arg: T)
|
||||
proc foo6[T : distinct](arg: T) =
|
||||
echo "hello distinct"
|
||||
|
||||
type MyDistinct = distinct string
|
||||
var md: MyDistinct
|
||||
foo6(md)
|
||||
|
||||
# enum
|
||||
|
||||
proc foo7[T : enum](arg: T)
|
||||
proc foo7[T : enum](arg: T) =
|
||||
echo "hello enum"
|
||||
|
||||
type MyEnum = enum
|
||||
ValueA
|
||||
foo7(ValueA)
|
||||
|
|
@ -762,11 +762,3 @@ block t3717:
|
|||
|
||||
var f: Foo[Foo[int]]
|
||||
discard foo(f)
|
||||
|
||||
|
||||
|
||||
block t5707:
|
||||
proc foo[T]: seq[int] =
|
||||
return lc[x | (x <- 1..10, x mod 2 == 0), int]
|
||||
|
||||
doAssert foo[float32]() == @[2, 4, 6, 8, 10]
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
discard """
|
||||
errormsg: "inline iterators are not first-class / cannot be assigned to variables"
|
||||
line: 8
|
||||
"""
|
||||
|
||||
iterator foo: int =
|
||||
yield 2
|
||||
let x = foo
|
||||
2
tests/modules/a/utils.nim
Normal file
2
tests/modules/a/utils.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
proc burnMem*(a: int) =
|
||||
discard
|
||||
2
tests/modules/b/utils.nim
Normal file
2
tests/modules/b/utils.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# module b/utils.nim
|
||||
let x* = 10
|
||||
5
tests/modules/tutils_ab.nim
Normal file
5
tests/modules/tutils_ab.nim
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import a/utils as autils, b/utils
|
||||
|
||||
# bug #12420
|
||||
|
||||
burnMem(x)
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
discard """
|
||||
errormsg: '''ambiguous call; both foobar.async'''
|
||||
line: 9
|
||||
line: 10
|
||||
disabled: "32bit"
|
||||
"""
|
||||
|
||||
import foobar
|
||||
|
|
|
|||
44
tests/stdlib/tbase64.nim
Normal file
44
tests/stdlib/tbase64.nim
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
discard """
|
||||
output: "OK"
|
||||
"""
|
||||
import base64
|
||||
|
||||
proc main() =
|
||||
doAssert encode("Hello World") == "SGVsbG8gV29ybGQ="
|
||||
doAssert encode("leasure.") == "bGVhc3VyZS4="
|
||||
doAssert encode("easure.") == "ZWFzdXJlLg=="
|
||||
doAssert encode("asure.") == "YXN1cmUu"
|
||||
doAssert encode("sure.") == "c3VyZS4="
|
||||
doAssert encode([1,2,3]) == "AQID"
|
||||
doAssert encode(['h','e','y']) == "aGV5"
|
||||
|
||||
doAssert encode("") == ""
|
||||
doAssert decode("") == ""
|
||||
|
||||
const testInputExpandsTo76 = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||
const testInputExpands = "++++++++++++++++++++++++++++++"
|
||||
const longText = """Man is distinguished, not only by his reason, but by this
|
||||
singular passion from other animals, which is a lust of the mind,
|
||||
that by a perseverance of delight in the continued and indefatigable
|
||||
generation of knowledge, exceeds the short vehemence of any carnal
|
||||
pleasure."""
|
||||
const tests = ["", "abc", "xyz", "man", "leasure.", "sure.", "easure.",
|
||||
"asure.", longText, testInputExpandsTo76, testInputExpands]
|
||||
|
||||
doAssert encodeMIME("foobarbaz", lineLen=4) == "Zm9v\r\nYmFy\r\nYmF6"
|
||||
doAssert decode("Zm9v\r\nYmFy\r\nYmF6") == "foobarbaz"
|
||||
|
||||
for t in items(tests):
|
||||
doAssert decode(encode(t)) == t
|
||||
doAssert decode(encodeMIME(t, lineLen=40)) == t
|
||||
doAssert decode(encodeMIME(t, lineLen=76)) == t
|
||||
|
||||
const invalid = "SGVsbG\x008gV29ybGQ="
|
||||
try:
|
||||
doAssert decode(invalid) == "will throw error"
|
||||
except ValueError:
|
||||
discard
|
||||
|
||||
echo "OK"
|
||||
|
||||
main()
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
discard """
|
||||
output: ""
|
||||
targets: "c js"
|
||||
"""
|
||||
|
||||
import json, strutils, options, tables
|
||||
|
||||
when true:
|
||||
|
|
@ -18,6 +20,11 @@ when true:
|
|||
case kind*: ReplayEventKind
|
||||
of FoodAppeared, FoodEaten:
|
||||
foodPos*: Point[float]
|
||||
case subKind*: bool
|
||||
of true:
|
||||
it: int
|
||||
of false:
|
||||
ot: float
|
||||
of DirectionChanged:
|
||||
playerPos*: float
|
||||
|
||||
|
|
@ -33,7 +40,9 @@ when true:
|
|||
ReplayEvent(
|
||||
time: 1.2345,
|
||||
kind: FoodEaten,
|
||||
foodPos: Point[float](x: 5.0, y: 1.0)
|
||||
foodPos: Point[float](x: 5.0, y: 1.0),
|
||||
subKind: true,
|
||||
it: 7
|
||||
)
|
||||
],
|
||||
test: 18827361,
|
||||
|
|
@ -592,3 +601,34 @@ static:
|
|||
doAssert t["fruit"]["color"].getInt == 10
|
||||
doAssert t["emails"][0].getStr == "abc"
|
||||
doAssert t["emails"][1].getStr == "123"
|
||||
|
||||
block:
|
||||
# ref objects with cycles.
|
||||
type
|
||||
Misdirection = object
|
||||
cycle: Cycle
|
||||
|
||||
Cycle = ref object
|
||||
foo: string
|
||||
cycle: Misdirection
|
||||
|
||||
let data = """
|
||||
{"cycle": null}
|
||||
"""
|
||||
|
||||
let dataParsed = parseJson(data)
|
||||
let dataDeser = to(dataParsed, Misdirection)
|
||||
|
||||
block:
|
||||
# ref object from #12316
|
||||
type
|
||||
Foo = ref Bar
|
||||
Bar = object
|
||||
|
||||
discard "null".parseJson.to Foo
|
||||
|
||||
block:
|
||||
# named array #12289
|
||||
type Vec = array[2, int]
|
||||
let arr = "[1,2]".parseJson.to Vec
|
||||
doAssert arr == [1,2]
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
discard """
|
||||
errormsg: "The `to` macro does not support ref objects with cycles."
|
||||
file: "tjsonmacro_reject2.nim"
|
||||
line: 10
|
||||
"""
|
||||
import json
|
||||
|
||||
type
|
||||
Misdirection = object
|
||||
cycle: Cycle
|
||||
|
||||
Cycle = ref object
|
||||
foo: string
|
||||
cycle: Misdirection
|
||||
|
||||
let data = """
|
||||
{"cycle": null}
|
||||
"""
|
||||
|
||||
let dataParsed = parseJson(data)
|
||||
let dataDeser = to(dataParsed, Cycle)
|
||||
|
|
@ -334,6 +334,21 @@ block ospaths:
|
|||
doAssert relativePath("/foo", "/fOO", '/') == (when FileSystemCaseSensitive: "../foo" else: "")
|
||||
doAssert relativePath("/foO", "/foo", '/') == (when FileSystemCaseSensitive: "../foO" else: "")
|
||||
|
||||
when doslikeFileSystem:
|
||||
doAssert relativePath(r"c:\foo.nim", r"C:\") == r"foo.nim"
|
||||
doAssert relativePath(r"c:\foo\bar\baz.nim", r"c:\foo") == r"bar\baz.nim"
|
||||
doAssert relativePath(r"c:\foo\bar\baz.nim", r"d:\foo") == r"c:\foo\bar\baz.nim"
|
||||
doAssert relativePath(r"\foo\baz.nim", r"\foo") == r"baz.nim"
|
||||
doAssert relativePath(r"\foo\bar\baz.nim", r"\bar") == r"..\foo\bar\baz.nim"
|
||||
doAssert relativePath(r"\\foo\bar\baz.nim", r"\\foo\bar") == r"baz.nim"
|
||||
doAssert relativePath(r"\\foo\bar\baz.nim", r"\\foO\bar") == r"baz.nim"
|
||||
doAssert relativePath(r"\\foo\bar\baz.nim", r"\\bar\bar") == r"\\foo\bar\baz.nim"
|
||||
doAssert relativePath(r"\\foo\bar\baz.nim", r"\\foo\car") == r"\\foo\bar\baz.nim"
|
||||
doAssert relativePath(r"\\foo\bar\baz.nim", r"\\goo\bar") == r"\\foo\bar\baz.nim"
|
||||
doAssert relativePath(r"\\foo\bar\baz.nim", r"c:\") == r"\\foo\bar\baz.nim"
|
||||
doAssert relativePath(r"\\foo\bar\baz.nim", r"\foo") == r"\\foo\bar\baz.nim"
|
||||
doAssert relativePath(r"c:\foo.nim", r"\foo") == r"c:\foo.nim"
|
||||
|
||||
doAssert joinPath("usr", "") == unixToNativePath"usr/"
|
||||
doAssert joinPath("", "lib") == "lib"
|
||||
doAssert joinPath("", "/lib") == unixToNativePath"/lib"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ abasdfdsmÄhmaИ
|
|||
Иnastystring
|
||||
A你好
|
||||
ИnastystringA你好
|
||||
ÖÜhmabasdfdsmÄhmaИ'''
|
||||
ÖÜhmabasdfdsmÄhmaИOK'''
|
||||
disabled: "posix"
|
||||
joinable: "false"
|
||||
"""
|
||||
|
|
@ -13,10 +13,10 @@ import winlean
|
|||
|
||||
echo "ÄhmÖÜ"
|
||||
echo "abasdfdsmÄhmaИ"
|
||||
echo "И\0nasty\0\0\0\0string\0"
|
||||
echo "Иnastystring"
|
||||
echo "A你好"
|
||||
|
||||
write stdout, "И\0nasty\0\0\0\0string\0"
|
||||
write stdout, "Иnastystring"
|
||||
writeLine stdout, "A你好"
|
||||
stdout.flushFile()
|
||||
|
||||
|
|
@ -25,3 +25,17 @@ var a = "ÖÜhmabasdfdsmÄhmaИ"
|
|||
var ac = 0'i32
|
||||
discard writeFile(handle, addr a[0], int32(len(a)), addr ac, nil)
|
||||
stdout.flushFile()
|
||||
|
||||
import os
|
||||
|
||||
let str = "some nulls: \0\0\0 (three of them)"
|
||||
|
||||
let fpath = getTempDir() / "file_with_nulls.bin"
|
||||
|
||||
writeFile(fpath, str)
|
||||
|
||||
doAssert(getFileSize(fpath) == 31)
|
||||
doAssert(readFile(fpath) == str)
|
||||
removeFile(fpath)
|
||||
|
||||
echo "OK"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ outputs = [
|
|||
]
|
||||
|
||||
for i, expected in enumerate(outputs):
|
||||
functionSymbol = gdb.selected_frame().block().function
|
||||
assert functionSymbol.line == 21
|
||||
|
||||
if i == 5:
|
||||
# myArray is passed as pointer to int to myDebug. I look up myArray up in the stack
|
||||
gdb.execute("up")
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
Loading Nim Runtime support.
|
||||
NimEnumPrinter: lookup global symbol 'NTI_z9cu80OJCfNgw9bUdzn5ZEzw_ failed for tyEnum_MyOtherEnum_z9cu80OJCfNgw9bUdzn5ZEzw.
|
||||
NimEnumPrinter: lookup global symbol 'NTI__z9cu80OJCfNgw9bUdzn5ZEzw_ failed for tyEnum_MyOtherEnum__z9cu80OJCfNgw9bUdzn5ZEzw.
|
||||
8
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
discard """
|
||||
output: '''[127, 127, 0, 255]
|
||||
[127, 127, 0, 255]
|
||||
|
||||
(data: 1)
|
||||
'''
|
||||
|
||||
nimout: '''caught Exception
|
||||
|
|
@ -180,3 +182,35 @@ static:
|
|||
var stream = initCtsStream(file)
|
||||
parseAtlas(stream)
|
||||
echo "Done!"
|
||||
|
||||
|
||||
# bug #12244
|
||||
|
||||
type
|
||||
Apple = object
|
||||
data: int
|
||||
|
||||
func what(x: var Apple) =
|
||||
x = Apple(data: 1)
|
||||
|
||||
func oh_no(): Apple =
|
||||
what(result)
|
||||
|
||||
const
|
||||
vmCrash = oh_no()
|
||||
|
||||
debugEcho vmCrash
|
||||
|
||||
|
||||
# bug #12310
|
||||
|
||||
proc someTransform(s: var array[8, uint64]) =
|
||||
var s1 = 5982491417506315008'u64
|
||||
s[1] += s1
|
||||
|
||||
static:
|
||||
var state: array[8, uint64]
|
||||
state[1] = 7105036623409894663'u64
|
||||
someTransform(state)
|
||||
|
||||
doAssert state[1] == 13087528040916209671'u64
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue