Ticket #251: static-init-nil-chk.patch
File static-init-nil-chk.patch, 1.3 KB (added by hopscc, 12 years ago) |
---|
-
Source/Members.cobra
1197 1197 for decl in .parentBox.declsInOrder 1198 1198 if decl inherits BoxVar 1199 1199 assert decl.type 1200 if not decl.type inherits NilableType and decl.type.isReference and notdecl.isShared1200 if not decl.type inherits NilableType and decl.type.isReference and .isShared == decl.isShared 1201 1201 if decl.name.startsWith('_') 1202 1202 expr = IdentifierExpr(token, decl) to Expr 1203 1203 else -
Tests/400-misc-bugs/260-static-init-nil-check.cobra
1 # bug with erroneous null check on non shared var in static init 2 class A 3 4 var isntShared as String 5 6 cue init 7 base.init 8 .isntShared = '1' 9 10 shared 11 12 var isShared as String 13 14 cue init 15 .isShared = '2' 16 # failed here (inserted null checking) 17 class P 18 19 def main is shared 20 assert A().isntShared == '1' 21 assert A.isShared == '2'