Explorer

core.reference-violation

description
Why a part of the module of the project cannot reference target, or none if it can. A private part can be referenced only from its module, and a part of a private module only from its project. See docs/visibility.md
type
Fn(project_name: String, module_name: String, target: @core.visibility-target) -> Union{#none, #some(@core.visibility-violation-reason)}
expression
fn(project_name$0, module_name$1, target$2) =>
  match @core.equal(left: $2.module_name, right: $1) {
    true =>
      #none,
    false =>
      match $2.visibility {
        #private(_) =>
          #some(#private_part<@core.visibility-violation-reason>),
        #public(_) =>
          match @core.and(
              left: @core.not(value: @core.equal(left: $2.project_name, right: $0)),
              right: match $2.module_visibility {
                #private(_) =>
                  true,
                #public(_) =>
                  false
              }
            ) {
            true =>
              #some(#private_module<@core.visibility-violation-reason>),
            false =>
              #none
          }
      }
  }
visibility
public
core.reference-violation (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: PtYSg8nsJc39NHbJDbKeNFVzyTor1Jlhaqw5KnzsCEI
content hash: OsZDFn-ls4W2Ap2q5u_nNc75HS7iNVn8CbhwNJlrL5Y