Explorer

core.type-expand-alias

description
(en) If type is a reference to a type alias (a type part whose definition is a call of a part that returns a type, such as definy.service-io = definy.io(A: ...)), the call; otherwise type itself. Used to compare an alias with the call it stands for
type
Fn(type: @core.type-ast, env: @core.type-env) -> @core.type-ast
expression
fn(type$0, env$1) =>
  match $0 {
    #reference(reference$2) =>
      match @core.part-type-lookup(env: $1.parts, part_hash: @core.string-concat(left: $2.part_hash, right: "#definition")) {
        #ok(definition$3) =>
          match $3 {
            #apply(_) =>
              $3,
            _ =>
              $0
          },
        #error(_) =>
          $0
      },
    _ =>
      $0
  }
visibility
public
core.type-expand-alias (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: UY4vaqO8lB3kvk4qEMpxiyDp2vzTTJcw5dNGwxAJ46c
content hash: 6qlKQJgVpnwxsnBSqObfvxMQ2HZKC6oGAXO-GO4809c