func (p Path) Copy() Path {
	ret := make(Path, len(p))
	copy(ret, p)
	return ret
}
Copy makes a shallow copy of the receiver. Often when paths are passed to
caller code they come with the constraint that they are valid only until
the caller returns, due to how they are constructed internally. Callers
can use Copy to conveniently produce a copy of the value that _they_ control
the validity of.
package cty
import (
	"errors"
	"fmt"
)
type Path []PathStep
type PathStep interface {
	pathStepSigil() pathStepImpl
	Apply(Value) (Value, error)
}
type pathStepImpl struct{}
func (p pathStepImpl) pathStepSigil() pathStepImpl {
	return p
}
func (p Path) Index(v Value) Path {
	ret := make(Path, len(p)+1)
	copy(ret, p)
	ret[len(p)] = IndexStep{
		Key: v,
	}
	return ret
}
func IndexPath(v Value) Path {
	return Path{}.Index(v)
}
func (p Path) GetAttr(name string) Path {
	ret := make(Path, len(p)+1)
	copy(ret, p)
	ret[len(p)] = GetAttrStep{
		Name: name,
	}
	return ret
}
func (p Path) Equals(other Path) bool {
	if len(p) != len(other) {
		return false
	}
	for i := range p {
		pv := p[i]
		switch pv := pv.(type) {
		case GetAttrStep:
			ov, ok := other[i].(GetAttrStep)
			if !ok || pv != ov {
				return false
			}
		case IndexStep:
			ov, ok := other[i].(IndexStep)
			if !ok {
				return false
			}
			if !pv.Key.RawEquals(ov.Key) {
				return false
			}
		default:
			return false
		}
	}
	return true
}
func (p Path) HasPrefix(prefix Path) bool {
	if len(prefix) > len(p) {
		return false
	}
	return p[:len(prefix)].Equals(prefix)
}
func GetAttrPath(name string) Path {
	return Path{}.GetAttr(name)
}
func (p Path) Apply(val Value) (Value, error) {
	var err error
	for i, step := range p {
		val, err = step.Apply(val)
		if err != nil {
			return NilVal, fmt.Errorf("at step %d: %s", i, err)
		}
	}
	return val, nil
}
func (p Path) LastStep(val Value) (Value, PathStep, error) {
	var err error
	if len(p) == 0 {
		return val, nil, nil
	}
	journey := p[:len(p)-1]
	val, err = journey.Apply(val)
	if err != nil {
		return NilVal, nil, err
	}
	return val, p[len(p)-1], nil
}