Explorer

core.type-checker

description
Plan the check of a module commit: overlay the committed parts on the latest parts of all modules to build the type environment, and decide which committed parts to check (all of them if a declared type changed). Returns the parts to check, the parts without an expression or a type, and the checker for that environment. With no committed parts it is the checker for the latest parts
type
Fn(
  latest: List<Record{
    part_id: String,
    module_id: String,
    part_type: Union{#none, #some(@core.expression)},
    type_declaration: Union{#none, #some(@core.expression)},
    expression_key: Union{#none, #some(String)},
    has_expression: Boolean,
    references: List<String>
  }>,
  committed: List<Record{
    part_id: String,
    module_id: String,
    part_type: Union{#none, #some(@core.expression)},
    type_declaration: Union{#none, #some(@core.expression)},
    expression_key: Union{#none, #some(String)},
    has_expression: Boolean,
    references: List<String>
  }>,
  module_id: String
) -> Record{
  to_check: List<String>,
  without_expression: List<String>,
  check: Fn(expr: @core.expression, expected_type: @core.expression) -> @core.type-result
}
expression
fn(latest$0, committed$1, module_id$2) =>
  let previous$3 = @core.module-entries-in-module(entries: $0, module_id: $2, same: true, index: 0, accum: []);
  let others$4 = @core.module-entries-in-module(entries: $0, module_id: $2, same: false, index: 0, accum: []);
  let previous_index$9500 = @core.list-hash-index(list: $3, field: "part_id");
  let committed_index$9501 = @core.list-hash-index(list: $1, field: "part_id");
  let changed_signatures$5 = @core.module-entries-changed-signatures(previous: $9500, committed: $1, index: 0, changed: []);
  let plan$6 = let removed$8 = @core.module-entries-removed(previous: $3, committed: $9501, index: 0, removed: $5);
    let affected$7 = @core.module-entries-affected(entries: $1, marked: $8);
    @core.module-commit-classify(
      previous: $9500,
      committed: $1,
      affected: @core.string-set(items: $7),
      index: 0,
      to_check: [],
      without_expression: []
    );
  {
    to_check: $6.to_check,
    without_expression: $6.without_expression,
    check: @core.type-checker-in-env(
      env: @core.build-type-env(
        entries: @core.module-entries-to-type-env-entries(entries: @core.list-concat(left: $4, right: $1), index: 0, accum: [])
      )
    )
  }
visibility
public
core.type-checker (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: OMynIcc_cgqLMzbTO9Ov-4GdNwBrkaTYpYEd8IGfuMI
content hash: 7cG2pemKHkdJkcH24EDhyIPUqS2osRaSUx0t3Wyt9dI