The handling of deprecation marks is currently tested mainly in a context
test (i.e. integration test) over in package tofu, but it's nice to also
have some nearby unit test coverage and so this is an initial step in that
direction which we could choose to extend in later commits.
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
In the previous commit we upgraded to cty v1.17.0, which already gave us
some performance improvements for functions like UnmarkDeepWithPaths.
However, this release also includes some new functions that allow more
surgical work with marks, and so we can get some additional gains by using
those in the codepaths related to deprecation tracking.
In particular, using WrangleMarksDeep instead of UnmarkDeepWithPaths means
that we can tell cty that we only want to remove the deprecation-related
marks, and so when given a value that contains only non-deprecation-related
marks it can avoid constructing a new cty.Value altogether, and instead
just return the one that was given. In the case where there _are_
deprecation-related marks, it will rebuild only the parts of the data
structure that lead to those marks. Deprecation-related marks are rare in
practice, so this should be a relatively good payoff.
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit introduces a capsule type, `TypeType`, which is used to
extricate type information from the console-only `type` function. In
combination with the `TypeType` mark, this allows us to restrict the use
of this function to top-level display of a value's type. Any other use
of `type()` will result in an error diagnostic.