Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close #10815 #15696

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions tests/vm/tvmmisc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,35 @@ block:
doAssert e == @[]
doAssert f == @[]

block: # bug #10815
block:
# this used to crash
type
Opcode = enum
iChar, iSet
Inst = object
case code: Opcode
of iChar:
c: char
of iSet:
cs: set[char]

Patt = seq[Inst]
proc `$`(p: Patt): string =
discard
proc P(): Patt =
result.add Inst(code: iSet)
const a = P()
doAssert $a == ""

block:
# probably used to crash
type CharSet {.union.} = object
cs: set[char]
vs: array[4, uint64]
const a = Charset(cs: {'a'..'z'})
doAssert a.repr.len > 0

import tables

block: # bug #8007
Expand Down Expand Up @@ -281,3 +310,4 @@ block: # bug #8007
# OK with seq & object variants
const d = @[Cost(kind: Fixed, cost: 999), Cost(kind: Dynamic, handler: foo)]
doAssert $d == "@[(kind: Fixed, cost: 999), (kind: Dynamic, handler: ...)]"