Explorer

core.type-equals

description
Compare all type-ast forms structurally
type
Fn(t1: @core.type-ast, t2: @core.type-ast) -> Boolean
expression
fn(t1$0, t2$1) =>
  match $0 {
    #number(_) =>
      match $1 {
        #number(_) =>
          true,
        _ =>
          false
      },
    #float(_) =>
      match $1 {
        #float(_) =>
          true,
        _ =>
          false
      },
    #string(_) =>
      match $1 {
        #string(_) =>
          true,
        _ =>
          false
      },
    #boolean(_) =>
      match $1 {
        #boolean(_) =>
          true,
        _ =>
          false
      },
    #type(_) =>
      match $1 {
        #type(_) =>
          true,
        _ =>
          false
      },
    #list(""$2) =>
      match $1 {
        #list(""$3) =>
          @core.type-equals(t1: $2.item_type, t2: $3.item_type),
        _ =>
          false
      },
    #function(""$4) =>
      match $1 {
        #function(""$5) =>
          @core.and(
            left: @core.type-equals-function-parameters(left_parameters: $4.parameters, right_parameters: $5.parameters, index: 0),
            right: @core.type-equals(t1: $4.return_type, t2: $5.return_type)
          ),
        _ =>
          false
      },
    #record(""$6) =>
      match $1 {
        #record(""$7) =>
          @core.type-equals-record-fields(left_fields: $6, right_fields: $7, index: 0),
        _ =>
          false
      },
    #reference(""$8) =>
      match $1 {
        #reference(""$9) =>
          @core.equal(left: $8.part_hash, right: $9.part_hash),
        _ =>
          false
      },
    #union(""$10) =>
      match $1 {
        #union(""$11) =>
          @core.type-equals-union-variants(left_variants: $10, right_variants: $11, index: 0),
        _ =>
          false
      },
    #builtin(left$20) =>
      match $1 {
        #builtin(right$21) =>
          @core.equal(left: $20, right: $21),
        _ =>
          false
      },
    #code(left_code$7001) =>
      match $1 {
        #code(right_code$7002) =>
          @core.type-equals(t1: $7001, t2: $7002),
        _$7003 =>
          false
      },
    #secret(_) =>
      match $1 {
        #secret(_) =>
          true,
        _$7103 =>
          false
      },
    #parameter(left$7104) =>
      match $1 {
        #parameter(right$7105) =>
          @core.equal(left: $7104, right: $7105),
        _ =>
          false
      },
    #apply(left$7106) =>
      match $1 {
        #apply(right$7107) =>
          @core.and(
            left: @core.equal(left: $7106.part_hash, right: $7107.part_hash),
            right: @core.type-equals-apply-arguments(left: $7106.arguments, right: $7107.arguments, index: 0)
          ),
        _ =>
          false
      },
    _ =>
      false
  }
visibility
public
core.type-equals (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: PPm1XO7a745v4p6n9Fe0ara_8LLGz3MJ5_u8wr_hUr4
content hash: Sqltl68eR1RIGmNL1yzaNx3dw_SOt9xYwjY2QJRIvnk