Commit 74012d4
committed
Fix given_or_derived behavior in Pops Object initialization
The PCore specification states "The given_or_derived
attribute kind states that if the attribute is given
when the object is instantiated this value is used,
otherwise it is a computed value." and "It is
allowed to give the value when instantiating in
which case the given value overrides what would
be the computed value."
The current implementation treats an attribute
with the kind given_or_derived as a required
parameter during initialization (in the
init_hash used in from_asserted_hash or in the
generated `initialize` method).
This change enforces an implicit `value` parameter
of `nil` which causes the generated init_hash
type check and the generated initialize method
to treat given_or_derived attributes as optional.1 parent de1f7e4 commit 74012d4
File tree
2 files changed
+10
-8
lines changed- lib/puppet/pops/types
- spec/unit/pops/types
2 files changed
+10
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
| 320 | + | |
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
| |||
341 | 343 | | |
342 | 344 | | |
343 | 345 | | |
344 | | - | |
| 346 | + | |
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
700 | | - | |
| 700 | + | |
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
704 | | - | |
705 | | - | |
706 | | - | |
| 704 | + | |
| 705 | + | |
707 | 706 | | |
708 | 707 | | |
709 | 708 | | |
710 | 709 | | |
711 | | - | |
712 | 710 | | |
713 | 711 | | |
714 | 712 | | |
715 | 713 | | |
716 | 714 | | |
717 | 715 | | |
718 | 716 | | |
719 | | - | |
| 717 | + | |
| 718 | + | |
720 | 719 | | |
721 | 720 | | |
722 | 721 | | |
723 | 722 | | |
724 | | - | |
| 723 | + | |
| 724 | + | |
725 | 725 | | |
726 | 726 | | |
727 | 727 | | |
| |||
0 commit comments