Commit e32824e
committed
Gate complex default warning on class check
`new_property()` warned for any non-scalar `default` before checking whether the
value matched the declared property class.
With an invalid non-scalar default such as
`new_property(class_integer, default = c("x", "y"))`, this warning was emitted
before the class check, so callers saw both the new deprecation warning and the
existing type error. Under `options(warn = 2)`, they only saw the
warning-as-error and lost the real validation message.
Move this warning after confirming `class_inherits(default, class)` so invalid
defaults keep the existing clear error path.
Add regression coverage for the invalid complex default path with warnings
converted to errors.1 parent 8fc2a79 commit e32824e
3 files changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
437 | 446 | | |
438 | 447 | | |
439 | 448 | | |
| |||
0 commit comments