File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -148,11 +148,14 @@ def throwAttrDeclNotOfExpectedType (attrName declName : Name) (givenType expecte
148148 throwError m!"Cannot add attribute `[{attrName}]`: Declaration `{.ofConstName declName}` has type{indentExpr givenType}\n \
149149 but `[{attrName}]` can only be added to declarations of type{indentExpr expectedType}"
150150
151- def ensureAttrDeclIsPublic [MonadEnv m] (attrName declName : Name) (attrKind : AttributeKind) : m Unit := do
152- if (← getEnv).header.isModule && attrKind != .local && !((← getEnv).setExporting true ).contains declName then
153- throwError m!"Cannot add attribute `[{attrName}]`: Declaration `{.ofConstName declName}` must be public"
154-
155- def ensureAttrDeclIsMeta [MonadEnv m] (attrName declName : Name) (attrKind : AttributeKind) : m Unit := do
151+ def ensureAttrDeclIsPublic (attrName declName : Name) (attrKind : AttributeKind) : AttrM Unit := do
152+ if (← getEnv).header.isModule && attrKind != .local then
153+ withExporting do
154+ checkPrivateInPublic declName
155+ if !(← hasConst declName) then
156+ throwError m!"Cannot add attribute `[{attrName}]`: Declaration `{.ofConstName declName}` must be public"
157+
158+ def ensureAttrDeclIsMeta (attrName declName : Name) (attrKind : AttributeKind) : AttrM Unit := do
156159 if (← getEnv).header.isModule && !isMeta (← getEnv) declName then
157160 throwError m!"Cannot add attribute `[{attrName}]`: Declaration `{.ofConstName declName}` must be marked as `meta`"
158161 -- Make sure attributed decls can't refer to private meta imports, which is already checked for
You can’t perform that action at this time.
0 commit comments