// SelectEqual creates accept function that could be used as Protocol/Extension
// select during upgrade.
499616
func SelectEqual(v string) func(string) bool {
	return func(p string) bool {
		return v == p
	}
}
912757
func TagFiltersEqual(o1, o2 *TagFiltersOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
696574
func ErrorEqual(err1, err2 error) bool {
	e1 := errors.Cause(err1)
	e2 := errors.Cause(err2)

	if e1 == e2 {
		return true
	}

	if e1 == nil || e2 == nil {
		return e1 == e2
	}

	te1, ok1 := e1.(*Error)
	te2, ok2 := e2.(*Error)
	if ok1 && ok2 {
		return te1.class == te2.class && te1.code == te2.code
	}

	return e1.Error() == e2.Error()
}
1088443
func (c DeclChecker) exprEqual(before, after ast.Expr) bool {
	if reflect.TypeOf(before) != reflect.TypeOf(after) {
		return false
	}

	switch before.(type) {
	case *ast.ChanType:
		change, _ := c.checkChan(before.(*ast.ChanType), after.(*ast.ChanType))
		return change.Change != Breaking
	case *ast.FuncType:
		change, _ := c.checkFunc(before.(*ast.FuncType), after.(*ast.FuncType))
		return change.Change != Breaking
	}

	// types.Identical returns false for any custom types when comparing
	// the results from two different type checkers. So, just compare by
	// name. Eg, func (_ CustomType) {}, CustomType is not identical, even
	// though comparing the type itself is. This applies to any non-built
	// in type, such as bytes.Buffer, *bytes.Buffer etc
	// https://play.golang.org/p/t6P5Uz6fIa
	//
	// Also compare types with types.TypeString to ignore any import aliases
	btype := c.binfo.TypeOf(before)
	atype := c.ainfo.TypeOf(after)
	if btype == nil || atype == nil {
		// Maybe nil when using exprInterfaceType which converts ast to string
		// and back to ast, without type checker knowing.
		return types.ExprString(before) == types.ExprString(after)
	}
	return types.TypeString(btype, nil) == types.TypeString(atype, nil)
}
580575
func attributeEqualsSelector(key, val string) Selector {
	return attributeSelector(key,
		func(s string) bool {
			return s == val
		})
}
85649
func QueryEqual(o1, o2 *QueryOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
827915
func ReferersEqual(o1, o2 *ReferersOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
1335806
func ValidUntilEqual(o1, o2 *ValidUntilOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
809242
func Select(a Type, x interface{}) Type {
	switch a := a.(type) {
	case *Array:
		n, ok := x.(json.Number)
		if !ok {
			return nil
		}
		pos, err := n.Int64()
		if err != nil {
			return nil
		}
		return a.Select(int(pos))
	case *Object:
		return a.Select(x)
	case *Set:
		tpe := TypeOf(x)
		if Compare(a.of, tpe) == 0 {
			return a.of
		}
		if any, ok := a.of.(Any); ok {
			if any.Contains(tpe) {
				return tpe
			}
		}
		return nil
	case Any:
		if Compare(a, A) == 0 {
			return A
		}
		var tpe Type
		for i := range a {
			// TODO(tsandall): test nil/nil
			tpe = Or(Select(a[i], x), tpe)
		}
		return tpe
	default:
		return nil
	}
}
1089901
func (o *ReplaceExistingSynonymsOption) Equal(o2 *ReplaceExistingSynonymsOption) bool {
	if o2 == nil {
		return o.value == false
	}
	return o.value == o2.value
}
576865
func (o *AroundPrecisionOption) Equal(o2 *AroundPrecisionOption) bool {
	if o2 == nil {
		return o.value == 1
	}
	return o.value == o2.value
}
1089851
func DistinctEqual(o1, o2 *DistinctOption) bool {
	if o1 != nil {
		return o1.Equal(o2)
	}
	if o2 != nil {
		return o2.Equal(o1)
	}
	return true
}
622556
func (e *Invocation) isEqual(other *Invocation) bool {
	return e == other || (e.ID == other.ID &&
		e.MutationsCount == other.MutationsCount && // compare it first, it changes most often
		e.JobID == other.JobID &&
		e.IndexedJobID == other.IndexedJobID &&
		e.Started.Equal(other.Started) &&
		e.Finished.Equal(other.Finished) &&
		e.TriggeredBy == other.TriggeredBy &&
		bytes.Equal(e.PropertiesRaw, other.PropertiesRaw) &&
		equalSortedLists(e.Tags, other.Tags) &&
		bytes.Equal(e.IncomingTriggersRaw, other.IncomingTriggersRaw) &&
		bytes.Equal(e.OutgoingTriggersRaw, other.OutgoingTriggersRaw) &&
		bytes.Equal(e.PendingTimersRaw, other.PendingTimersRaw) &&
		e.Revision == other.Revision &&
		e.RevisionURL == other.RevisionURL &&
		bytes.Equal(e.Task, other.Task) &&
		equalSortedLists(e.TriggeredJobIDs, other.TriggeredJobIDs) &&
		e.DebugLog == other.DebugLog &&
		e.RetryCount == other.RetryCount &&
		e.Status == other.Status &&
		e.ViewURL == other.ViewURL &&
		bytes.Equal(e.TaskData, other.TaskData))
}
97001
func (o *HighlightPostTagOption) Equal(o2 *HighlightPostTagOption) bool {
	if o2 == nil {
		return o.value == "</em>"
	}
	return o.value == o2.value
}
1023199
func (pg *GoEvtxMap) AnyEqual(path *GoEvtxPath, is []interface{}) bool {
	t, err := pg.Get(path)
	if err != nil {
		return false
	}
	for _, i := range is {
		if reflect.DeepEqual(i, *t) {
			return true
		}
	}
	return false
}
961502
func (o *ReplaceSynonymsInHighlightOption) Equal(o2 *ReplaceSynonymsInHighlightOption) bool {
	if o2 == nil {
		return o.value == true
	}
	return o.value == o2.value
}
824157
func (p *PublicKey) IsEqual(otherPubKey *PublicKey) bool {
	return p.X.Cmp(otherPubKey.X) == 0 &&
		p.Y.Cmp(otherPubKey.Y) == 0
}