fixes #7637; assignments are not allowed to slice object; minor breaking change

This commit is contained in:
Andreas Rumpf 2018-04-21 21:22:36 +02:00
commit 85ea9593b3
5 changed files with 46 additions and 15 deletions

View file

@ -1,9 +1,7 @@
discard """
output: '''tbObj of TC false
false
output: '''tbObj of TC true
true
5
false'''
5'''
"""
# bug #1053
@ -20,10 +18,10 @@ type
proc test(p: TA) =
#echo "p of TB ", p of TB
if p of TB:
var tbObj = TB(p)
#var tbObj = TB(p)
# tbObj is actually no longer compatible with TC:
echo "tbObj of TC ", tbObj of TC
echo "tbObj of TC ", p of TC
var v = TC()
v.a = 1
@ -48,8 +46,8 @@ proc isMyObject(obj: TObject) =
asd.x = 5
var asdCopy = TObject(asd)
echo asdCopy of MyObject
#var asdCopy = TObject(asd)
#echo asdCopy of MyObject
isMyObject(asd)
isMyObject(asdCopy)
#isMyObject(asdCopy)