func mustTypeCheck(required Type, ret Type, values ...Value) *Value {
	shortCircuit, err := typeCheck(required, ret, values...)
	if err != nil {
		panic(err)
	}
	return shortCircuit
}
mustTypeCheck is a wrapper around typeCheck that immediately panics if
any error is returned.
package cty
import (
	"fmt"
)
func anyUnknown(values ...Value) bool {
	for _, val := range values {
		if val.v == unknown {
			return true
		}
	}
	return false
}
func typeCheck(required Type, ret Type, values ...Value) (shortCircuit *Value, err error) {
	hasDynamic := false
	hasUnknown := false
	for i, val := range values {
		if val.ty == DynamicPseudoType {
			hasDynamic = true
			continue
		}
		if !val.Type().Equals(required) {
			return nil, fmt.Errorf(
				"type mismatch: want %s but value %d is %s",
				required.FriendlyName(),
				i, val.ty.FriendlyName(),
			)
		}
		if val.v == unknown {
			hasUnknown = true
		}
	}
	if hasDynamic {
		return &DynamicVal, nil
	}
	if hasUnknown {
		ret := UnknownVal(ret)
		return &ret, nil
	}
	return nil, nil
}