// isDyn returns true if the input t is either type DYN or a well-known ANY message. func isDyn(t *types.Type) bool { … } // isDynOrError returns true if the input is either an Error, DYN, or well-known ANY message. func isDynOrError(t *types.Type) bool { … } func isError(t *types.Type) bool { … } func isOptional(t *types.Type) bool { … } func maybeUnwrapOptional(t *types.Type) (*types.Type, bool) { … } // isEqualOrLessSpecific checks whether one type is equal or less specific than the other one. // A type is less specific if it matches the other type using the DYN type. func isEqualOrLessSpecific(t1, t2 *types.Type) bool { … } // / internalIsAssignable returns true if t1 is assignable to t2. func internalIsAssignable(m *mapping, t1, t2 *types.Type) bool { … } // isValidTypeSubstitution returns whether t2 (or its type substitution) is a valid type // substitution for t1, and whether t2 has a type substitution in mapping m. // // The type t2 is a valid substitution for t1 if any of the following statements is true // - t2 has a type substitution (t2sub) equal to t1 // - t2 has a type substitution (t2sub) assignable to t1 // - t2 does not occur within t1. func isValidTypeSubstitution(m *mapping, t1, t2 *types.Type) (valid, hasSub bool) { … } // internalIsAssignableList returns true if the element types at each index in the list are // assignable from l1[i] to l2[i]. The list lengths must also agree for the lists to be // assignable. func internalIsAssignableList(m *mapping, l1, l2 []*types.Type) bool { … } // internalIsAssignableNull returns true if the type is nullable. func internalIsAssignableNull(t *types.Type) bool { … } // isLegacyNullable preserves the null-ness compatibility of the original type-checker implementation. func isLegacyNullable(t *types.Type) bool { … } // isAssignable returns an updated type substitution mapping if t1 is assignable to t2. func isAssignable(m *mapping, t1, t2 *types.Type) *mapping { … } // isAssignableList returns an updated type substitution mapping if l1 is assignable to l2. func isAssignableList(m *mapping, l1, l2 []*types.Type) *mapping { … } // mostGeneral returns the more general of two types which are known to unify. func mostGeneral(t1, t2 *types.Type) *types.Type { … } // notReferencedIn checks whether the type doesn't appear directly or transitively within the other // type. This is a standard requirement for type unification, commonly referred to as the "occurs // check". func notReferencedIn(m *mapping, t, withinType *types.Type) bool { … } // substitute replaces all direct and indirect occurrences of bound type parameters. Unbound type // parameters are replaced by DYN if typeParamToDyn is true. func substitute(m *mapping, t *types.Type, typeParamToDyn bool) *types.Type { … } func substituteParams(m *mapping, typeParams []*types.Type, typeParamToDyn bool) []*types.Type { … } func newFunctionType(resultType *types.Type, argTypes ...*types.Type) *types.Type { … }