Explorer

core.type-assignable-record-fields

description
Check if actual record fields satisfy expected fields (structural width subtyping)
type
Fn(
  expected_fields: List<Record{key: String, field_type: @core.type-ast}>,
  actual_fields: List<Record{key: String, field_type: @core.type-ast}>,
  index: Number,
  env: @core.type-env
) -> Boolean
expression
fn(expected_fields$0, actual_fields$1, index$2, env$90) =>
  match @core.list-get(list: $0, index: $2) {
    #none(_) =>
      true,
    #some(item$1091) =>
      match @core.record-field-type-lookup(fields: $1, key: $1091.key, index: 0) {
        #ok(act_type$10) =>
          match @core.type-assignable(actual_type: $10, expected_type: $1091.field_type, env: $90) {
            true =>
              @core.type-assignable-record-fields(expected_fields: $0, actual_fields: $1, index: @core.plus(left: $2, right: 1), env: $90),
            false =>
              false
          },
        #error(err$11) =>
          false,
        _ =>
          false
      }
  }
visibility
public
core.type-assignable-record-fields (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: GXfdAK4wTwwIwR2RpVJzXD2xYwF6vBe-Cj5K6fZ7mCY
content hash: 9vIzun1UC9ayarjcacBcx0JQq1TnT4kPAb6SbkFoLd4