Commit 3617411
committed
hcldec: A test case for attributes set to cty.DynamicVal with refinements
This test case is here to anticipate a _possible_ bug that isn't actually
buggy in the current implementation: if an attribute spec is given a
non-dynamic type constraint and then refined based on that type constraint
then the hcldec implementation must perform the type conversion first and
only then attempt to add the refinements.
Another possible variation here would be for the attribute spec to have
a dynamic type constraint (cty.DynamicPseudoType) and then try to refine
its result. That case isn't tested here because that's always an
implementation error in the calling application: RefineValueSpec must be
used only in ways that are valid for the full range of types that the
nested spec could produce, and there are no refinements that are valid
for the full range of cty.DynamicPseudoType. That situation can and will
panic at runtime, alerting the application developer that they've used
hcldec incorrectly. There is no way for end-user input to cause this panic
if the calling application is written correctly.
This doesn't actually change the system behavior. It's a regression test
to catch possible regressions under future maintenance.1 parent ed6d4bf commit 3617411
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
| |||
257 | 258 | | |
258 | 259 | | |
259 | 260 | | |
| 261 | + | |
260 | 262 | | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
| 267 | + | |
265 | 268 | | |
266 | 269 | | |
267 | 270 | | |
| |||
276 | 279 | | |
277 | 280 | | |
278 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
279 | 287 | | |
280 | 288 | | |
281 | 289 | | |
| |||
0 commit comments