Skip to content

Commit

Permalink
bug fix for issue #39 Controlled vocabularies not working
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivan- committed Aug 30, 2017
1 parent 1d7db11 commit 3e26725
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ private object PackscanToList {
}

private def enclosingPackage = {
def loop(s: c.Symbol): c.Symbol = if (s.isPackage) s else loop(s.owner)
def loop(s: c.Symbol): c.Symbol = if (s.isPackage || s.isPackageClass) s else loop(s.owner)
loop(c.internal.enclosingOwner)
}

private def matchingDecls(decls: MemberScope): Seq[Symbol] = {
val localDecls = decls.filter { s => s.isModule && s.info <:< aTag.tpe }
val localModules = decls.filter { s => s.isModule }
val localDecls = localModules.filter { s => s.info <:< aTag.tpe }
val localPackages = decls.filter { s => s.isPackage || s.isPackageClass }
val subPackageDecls = localPackages.map(_.info.decls).map(matchingDecls)
(localDecls :: subPackageDecls.toList).flatten
val nestedDecls = localModules.map(_.info.decls).map(matchingDecls)
(localDecls :: nestedDecls.toList).flatten
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import longevity.model.annotations.polyComponent
sealed trait ControlledVocab

@derivedComponent[DomainModel, ControlledVocab]
case class VocabTerm1() extends ControlledVocab
case object VocabTerm1 extends ControlledVocab

@derivedComponent[DomainModel, ControlledVocab]
case object VocabTerm2 extends ControlledVocab

0 comments on commit 3e26725

Please sign in to comment.