{"record":{"id":"83581597ed6b82f0","repo":"apple/pkl","slug":"redundanthiddenmodifier","errorCode":"redundantHiddenModifier","errorMessage":"redundantHiddenModifier","messagePattern":"redundantHiddenModifier","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java","lineNumber":3016,"sourceCode":"        throw exceptionBuilder()\n            .evalError(errorMessage, ctx.getValue().name().toLowerCase(Locale.ROOT))\n            .withSourceSection(createSourceSection(ctx))\n            .build();\n      }\n      result += modifier;\n    }\n\n    // flag modifier combinations that are never valid right away\n\n    if (VmModifier.isExternal(result) && !ModuleKeys.isStdLibModule(moduleKey)) {\n      throw exceptionBuilder()\n          .evalError(\"cannotDefineExternalMember\")\n          .withSourceSection(createSourceSection(modifiers, ModifierValue.EXTERNAL))\n          .build();\n    }\n\n    if (VmModifier.isLocal(result) && VmModifier.isHidden(result)) {\n      throw exceptionBuilder()\n          .evalError(\"redundantHiddenModifier\")\n          .withSourceSection(createSourceSection(modifiers, ModifierValue.HIDDEN))\n          .build();\n    }\n\n    if (VmModifier.isLocal(result) && VmModifier.isFixed(result)) {\n      throw exceptionBuilder()\n          .evalError(\"redundantFixedModifier\")\n          .withSourceSection(createSourceSection(modifiers, ModifierValue.FIXED))\n          .build();\n    }\n\n    if (VmModifier.isAbstract(result) && VmModifier.isOpen(result)) {\n      throw exceptionBuilder()\n          .evalError(\"redundantOpenModifier\")\n          .withSourceSection(createSourceSection(modifiers, ModifierValue.OPEN))\n          .build();\n    }","sourceCodeStart":2998,"sourceCodeEnd":3034,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java#L2998-L3034","documentation":"`local` members are already confined to their enclosing object and invisible outside it, so adding `hidden` is meaningless. AstBuilder rejects the combination `local hidden` with `redundantHiddenModifier`, pointing at the HIDDEN modifier (AstBuilder.java:3016).","triggerScenarios":"Declaring `local hidden foo = ...` in a module, class, or object body.","commonSituations":"Piling modifiers on for safety without knowing their semantics; adding `hidden` after converting a property to `local`.","solutions":["Remove the redundant `hidden` modifier, keep `local`.","If the member should be visible but not rendered in output, drop `local` and keep `hidden`."],"exampleFix":"// before\nlocal hidden foo = 1\n// after\nlocal foo = 1","handlingStrategy":"validation","validationCode":"if (/local\\s+hidden\\b/.test(pklSource)) {\n  throw new Error(\"`hidden` is redundant on `local` members; remove one\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize: `local` already implies invisibility outside the object.","Lint with a regex or custom `pkl` codegen check in CI.","Choose between `local` (not visible) and `hidden` (visible but not rendered) — not both."],"tags":["pkl","parser","modifier","redundant"],"backgroundTag":"conflicting-config-options","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}