Explorer

core.type-reference-cycle

description
Whether following type part references from type returns to a reference without reaching a type constructor
type
Fn(type: @core.type-ast, env: @core.type-env, seen: List<String>) -> Boolean
expression
fn(type$0, env$1, seen$2) =>
  match $0 {
    #reference(reference$10) =>
      match @core.list-contains-string(list: $2, target: $10.part_hash, index: 0) {
        true =>
          true,
        false =>
          match @core.part-type-lookup(env: $1.parts, part_hash: @core.string-concat(left: $10.part_hash, right: "#definition")) {
            #ok(definition$11) =>
              @core.type-reference-cycle(type: $11, env: $1, seen: @core.list-append(list: $2, item: $10.part_hash)),
            #error(not_found$12) =>
              false
          }
      },
    #apply(reference$13) =>
      match @core.list-contains-string(list: $2, target: $13.part_hash, index: 0) {
        true =>
          true,
        false =>
          match @core.part-type-lookup(env: $1.parts, part_hash: @core.string-concat(left: $13.part_hash, right: "#definition")) {
            #ok(definition$14) =>
              @core.type-reference-cycle(type: $14, env: $1, seen: @core.list-append(list: $2, item: $13.part_hash)),
            #error(not_found$15) =>
              false
          }
      },
    _ =>
      false
  }
visibility
public
core.type-reference-cycle (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: RBSJ-u-pGFh_sjxVFwLs2tBCiV2h9wW5SWoi1EqTH8E
content hash: Fnfmk50Lfx3k0WfB0SEzbW7UMJmU3EvD7dmQnZv7a7c