| | 494 | |
| | 495 | By default only the first level of modified templates is checked in case a template modifies another template, and the field specifications in the base template are considered. With the option '''checkNoUnititializedFieldsInTemplatesRecursion''' multiple levels of modified templates are considered. |
| | 496 | |
| | 497 | {{{ |
| | 498 | module checkNoUnititializedFieldsInTemplatesRecursion { |
| | 499 | type record R { |
| | 500 | integer f1, |
| | 501 | integer f2, |
| | 502 | integer f3 |
| | 503 | } |
| | 504 | |
| | 505 | template R A := {f1 := 1} //base template, not fully-specified -> warning |
| | 506 | |
| | 507 | template R B1 modifies A := {f2 := 2, f3:= 3} //fully-specified, inherits f1 -> no warning |
| | 508 | |
| | 509 | template R B2 modifies A := {f2 := 2} //not fully-specified, inherits f1, misses f3 -> warning |
| | 510 | |
| | 511 | template R C1 modifies B1 := {f1 := 3} //fully-specified, inherits f2, f3 -> no warning |
| | 512 | |
| | 513 | template R C2 modifies B2 := {f3 := 3} //fully-specified, inherits f1 from A, f2 from B2 |
| | 514 | //-> no warning if checkNoUnititializedFieldsInTemplatesRecursion is true |
| | 515 | //-> warning if checkNoUnititializedFieldsInTemplatesRecursion is false (only f2 from B2 considered) |
| | 516 | } |
| | 517 | }}} |
| | 518 | |