Skip to content

Instantly share code, notes, and snippets.

@gkossakowski
Created December 22, 2016 01:05
Show Gist options
  • Save gkossakowski/35aab3b9d049ddf3541bb1a57cb08608 to your computer and use it in GitHub Desktop.
Save gkossakowski/35aab3b9d049ddf3541bb1a57cb08608 to your computer and use it in GitHub Desktop.
An example of an awkward code pattern caused by interruptible completers
val resolvedParents = new util.ArrayList[Type]()
var remainingParents = tmpl.parents
while (remainingParents.nonEmpty) {
val parent = remainingParents.head
val resolved = resolveTypeTree(parent, lookupScope)
// this is awkard and highly repetitive pattern
resolved match {
case CompletedType(tpe) => resolvedParents.add(tpe)
case _: IncompleteDependency | NotFound => return resolved
}
remainingParents = remainingParents.tail
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment