diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-11-03 15:46:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-03 15:46:16 +0800 |
commit | c4e5dab4197ce57af03c5eaa6117b738279fa537 (patch) | |
tree | a9df84b105c6eede8ce20bf12215f7471b5096f4 /compiler/semobjconstr.nim | |
parent | 6b1e353aa109756cefc961c8a91d1df49912ab51 (diff) | |
download | Nim-c4e5dab4197ce57af03c5eaa6117b738279fa537.tar.gz |
fixes #20740; fixes pre-existing field visibility issues and removes `efSkipFieldVisibilityCheck` (#20741)
fixes #20740 pre-existing field visibility and refactoring
Diffstat (limited to 'compiler/semobjconstr.nim')
-rw-r--r-- | compiler/semobjconstr.nim | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index e51684913..1463ba833 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -76,8 +76,7 @@ proc semConstrField(c: PContext, flags: TExprFlags, let assignment = locateFieldInInitExpr(c, field, initExpr) if assignment != nil: if nfSem in assignment.flags: return assignment[1] - if nfUseDefaultField in assignment[1].flags or - efSkipFieldVisibilityCheck in flags: + if nfUseDefaultField in assignment[1].flags: discard elif not fieldVisible(c, field): localError(c.config, initExpr.info, @@ -416,10 +415,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType # field (if this is a case object, initialized fields in two different # branches will be reported as an error): var constrCtx = initConstrContext(t, result) - let (initResult, defaults) = if nfUseDefaultField in n.flags: - semConstructTypeAux(c, constrCtx, flags + {efSkipFieldVisibilityCheck}) - else: - semConstructTypeAux(c, constrCtx, flags) + let (initResult, defaults) = semConstructTypeAux(c, constrCtx, flags) result[0].sons.add defaults var hasError = false # needed to split error detect/report for better msgs |