Explorer

definy.run-expression-type-check

description
Type-check the expression of definy_run_expression in the type environment of the latest main snapshots with the parts of branch (the snapshot of the branch, or none) overlaid, as SubmitEvent does (definy.check-snapshot), and continue with the result
type
Fn(
  expression: @core.expression,
  commits: List<@definy.event-snapshot>,
  branch: List<@definy.event-snapshot>,
  then: Fn(result: @core.type-result) -> @definy.service-io
) -> @definy.service-io
expression
fn(expression$0, commits$1, branch$2, then$3) =>
  let latest_commits$4 = @definy.latest-main-snapshots(commits: $1);
  let branch_parts$5 = @definy.snapshot-parts-flat(commits: $2, index: 0);
  let latest_parts$6 = @core.list-map(
      T: @definy.event-snapshot,
      U: List<@definy.stored-snapshot-part>,
      f: fn(item$7) =>
        @definy.snapshot-parts(modules: $7.commit.modules, index: 0),
      xs: $4
    );
  let hashes$8 = @core.list-concat(
      left: @core.list-map(
        T: @definy.stored-snapshot-part,
        U: String,
        f: fn(item$9) =>
          $9.content_hash,
        xs: $5
      ),
      right: @definy.snapshot-parts-hashes(parts_list: $6, index: 0)
    );
  @definy.read-resolutions(
    content_hashes: $8,
    then: fn(resolutions$10) =>
      @definy.read-definitions(
        content_hashes: @definy.unresolved-hashes(hashes: $8, resolutions: $10),
        then: fn(definitions$11) =>
          @definy.resolve-latest-snapshots(
            commits: @core.list-map(
              T: @definy.event-snapshot,
              U: @definy.latest-snapshot-source,
              f: fn(item$12) =>
                {
                  project_name: $12.commit.project_name,
                  parts: @core.list-map(
                    T: @definy.stored-snapshot-part,
                    U: @definy.snapshot-check-source-part,
                    f: fn(item$13) =>
                      @definy.source-part-of(part: $13, definitions: $11),
                    xs: @definy.snapshot-parts(modules: $12.commit.modules, index: 0)
                  )
                },
              xs: $4
            ),
            index: 0,
            latest: [],
            environment: [],
            resolutions: @definy.resolution-index(resolutions: $10),
            fresh: [],
            then: fn(latest$14, environment$15, fresh$16) =>
              @definy.resolve-snapshot-contents(
                parts: @core.list-map(
                  T: @definy.stored-snapshot-part,
                  U: @definy.snapshot-check-source-part,
                  f: fn(item$17) =>
                    @definy.source-part-of(part: $17, definitions: $11),
                  xs: $5
                ),
                resolutions: @definy.resolution-index(resolutions: $10),
                then: fn(parts$18, fresh$19) =>
                  let others$20 = @core.module-entries-in-module(
                      entries: @definy.snapshot-check-latest-entries(
                        latest: $14,
                        replaced: @core.list-map(
                          T: @definy.snapshot-check-part,
                          U: String,
                          f: fn(item$21) =>
                            $21.module_id,
                          xs: $18
                        )
                      ),
                      module_id: "#replaced",
                      same: false,
                      index: 0,
                      accum: []
                    );
                  $3(
                    result: @core.type-check(
                      expr: $0,
                      env: @core.build-type-env(
                        entries: @core.module-entries-to-type-env-entries(
                          entries: @core.list-concat(left: $20, right: @definy.snapshot-check-entries(parts: $18, resolutions: $10)),
                          index: 0,
                          accum: []
                        )
                      )
                    )
                  )
              )
          )
      )
  )
visibility
public
definy.run-expression-type-check (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: DeYDneLdZMbvHHQLvuA8cLaGdvM7yabHbWRnxKpWlZk
content hash: ws1uuSCx_yAMlH7h7QoqbotQi3-VUFXhMsgh8oqhor0