mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes serious codegen regression that caused Nimble to misbehave
This commit is contained in:
@@ -63,7 +63,7 @@ proc genTraverseProc(c: var TTraversalClosure, accessor: Rope, typ: PType) =
|
||||
|
||||
var p = c.p
|
||||
case typ.kind
|
||||
of tyGenericInst, tyGenericBody, tyTypeDesc, tyAlias:
|
||||
of tyGenericInst, tyGenericBody, tyTypeDesc, tyAlias, tyDistinct:
|
||||
genTraverseProc(c, accessor, lastSon(typ))
|
||||
of tyArray:
|
||||
let arraySize = lengthOrd(typ.sons[0])
|
||||
|
||||
47
tests/ccgbugs/tmarkerproc_regression.nim
Normal file
47
tests/ccgbugs/tmarkerproc_regression.nim
Normal file
@@ -0,0 +1,47 @@
|
||||
discard """
|
||||
output: "done"
|
||||
"""
|
||||
|
||||
type
|
||||
Version* = distinct string
|
||||
Special* = distinct string
|
||||
|
||||
VersionRangeEnum* = enum
|
||||
verLater, # > V
|
||||
verEarlier, # < V
|
||||
verEqLater, # >= V -- Equal or later
|
||||
verEqEarlier, # <= V -- Equal or earlier
|
||||
verIntersect, # > V & < V
|
||||
verEq, # V
|
||||
verAny, # *
|
||||
verSpecial # #head
|
||||
|
||||
VersionRange* = ref VersionRangeObj
|
||||
VersionRangeObj = object
|
||||
case kind*: VersionRangeEnum
|
||||
of verLater, verEarlier, verEqLater, verEqEarlier, verEq:
|
||||
ver*: Version
|
||||
of verSpecial:
|
||||
spe*: Special
|
||||
of verIntersect:
|
||||
verILeft, verIRight: VersionRange
|
||||
of verAny:
|
||||
nil
|
||||
|
||||
proc foo(x: string): VersionRange =
|
||||
new(result)
|
||||
result.kind = verEq
|
||||
result.ver = Version(x)
|
||||
|
||||
proc main =
|
||||
var a: array[5000, VersionRange]
|
||||
for i in 0 ..< 5000:
|
||||
a[i] = foo($i & "some longer text here " & $i)
|
||||
GC_fullcollect()
|
||||
for i in 0 ..< 5000:
|
||||
let expected = $i & "some longer text here " & $i
|
||||
if a[i].ver.string != expected:
|
||||
quit "bug!"
|
||||
echo "done"
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user