fixes 5870 (#11704)

* fixes #5870
* make tclosure test green again
* this check is correct but breaks some Nimble packages
This commit is contained in:
Andreas Rumpf 2019-08-29 07:49:58 +02:00 • committed by GitHub
commit 9203d3a982
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 26 deletions

17
tests/errmsgs/t5870.nim Normal file
View file

@ -0,0 +1,17 @@
discard """
errormsg: "invalid type for const: seq[SomeRefObj]"
line: 14
"""
# bug #5870
type SomeRefObj = ref object of RootObj
someIntMember: int
proc createSomeRefObj(v: int): SomeRefObj=
result.new()
result.someIntMember = v
const compileTimeSeqOfRefObjs = @[createSomeRefObj(100500), createSomeRefObj(2)]
for i in 0..1:
echo compileTimeSeqOfRefObjs[i].someIntMember