Skip to content

Fix warning about MultipleChildElementsWithSameName for hidden Elements #1415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -341,19 +341,30 @@ abstract class ModelGroup protected (index: Int)
}
}

final lazy val elementChildrenInNonHiddenContext: Seq[ElementBase] =
final def elementChildrenInNonHiddenContext: Seq[ElementBase] =
LV('elementChildrenInNonHiddenContext) {
val ebs = groupMembers
.filter {
case gr: GroupRef => !gr.isHidden
case _ => true
}
.flatMap { gm =>
gm match {
case eb: ElementBase => Seq(eb)
case gb: ModelGroup => gb.elementChildren
}
val ebs = this match {
case gr: GroupRef if gr.isHidden => Seq.empty
case stb: SequenceTermBase if stb.isHidden => Seq.empty
case _ => {
groupMembers
.filter {
case gr: GroupRef => !gr.isHidden
case stb: SequenceTermBase => !stb.isHidden
case eb: ElementBase =>
eb.optLexicalParent.forall {
case ref: GroupRef => !ref.isHidden
case stb: SequenceTermBase => !stb.isHidden
case _ => true
}
case _ => true
}
.flatMap {
case eb: ElementBase => Seq(eb)
case gb: ModelGroup => gb.elementChildrenInNonHiddenContext
}
}
}
ebs
}.value

Expand Down