Version: allium 3.5.0 (language versions: 1, 2, 3).
Bug: allium.field.unused flags an entity field as unused even when it's set via a named argument in an Entity.created(field: value, ...) constructor call in a rule's ensures: clause.
Repro (widget.allium):
-- allium: 3
entity Widget {
name: String
}
rule MakeWidget {
when: MakeWidget(name)
ensures: Widget.created(name: name)
}
Actual:
Field 'Widget.name' is declared but not referenced elsewhere.
Expected: name is set by the Widget.created(name: name) call, so it shouldn't be flagged as unused. Usage tracking for this diagnostic appears to only look for member-access reads (entity.field), not named-argument writes in creation calls — which is the sole way most entity fields ever get populated in a typical spec (per the "Entity creation uses .created() exclusively" convention in the language reference).
Impact: this is the most disruptive of the three related reports (#58, #59) we filed — since .created() with named args is the canonical way to populate a new entity's fields, this diagnostic currently produces a false positive for nearly every field on every entity that's only ever created (not mutated) via a rule.
Version:
allium 3.5.0 (language versions: 1, 2, 3).Bug:
allium.field.unusedflags an entity field as unused even when it's set via a named argument in anEntity.created(field: value, ...)constructor call in a rule'sensures:clause.Repro (
widget.allium):Actual:
Expected:
nameis set by theWidget.created(name: name)call, so it shouldn't be flagged as unused. Usage tracking for this diagnostic appears to only look for member-access reads (entity.field), not named-argument writes in creation calls — which is the sole way most entity fields ever get populated in a typical spec (per the "Entity creation uses.created()exclusively" convention in the language reference).Impact: this is the most disruptive of the three related reports (#58, #59) we filed — since
.created()with named args is the canonical way to populate a new entity's fields, this diagnostic currently produces a false positive for nearly every field on every entity that's only ever created (not mutated) via a rule.