Class RedundantTraitReference
with trait of
LoudSpeaker, Speaker where LoudSpeaker with trait of Speaker) - which has ONE reading: delete the
redundant name (Steve, 2026-10-11). Use this; do not re-derive it.
The compiler has proved that the second name adds nothing: everything it brings is already inherited through
the trait that has it, so deleting it leaves the type exactly as it was. The E02090 message names both traits
('Speaker' is already a trait of 'LoudSpeaker'); the diagnostic's line is the declaration's.
Deliberately conservative: applied only where the diagnostic's line holds a trait of list with the
redundant name in it exactly ONCE (a name listed twice is E02050, not this), as a bare name - an entry with a
by delegate is left alone, since dropping it would drop that delegation too. A qualified entry
(module::Speaker) matches by its simple name. Rewrites within one line; the caller re-verifies.
A listed trait the SUPER CLASS already has is the same error with the same reading (Steve, 2026-10-12,
decision (a)): 'Speaker' is already a trait of 'Base'. When it is the only trait listed, the whole
with trait of Speaker clause is deleted (Announcer extends Base).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe rewritten text and one note per rewrite;notesempty means nothing moved. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue whentextholds a trait list of more than one entry, or one after anextends- the cheap gate before a probe compile.Delete the redundant trait each E02090 diagnostic names.static StringOne line withredundantdeleted from its trait list, or null when the shape is not there.
-
Method Details
-
mayApply
True whentextholds a trait list of more than one entry, or one after anextends- the cheap gate before a probe compile. -
repaired
-
repair
-