From 6538c20adc41fdbd45a9e5830d57040c7f0f0100 Mon Sep 17 00:00:00 2001 From: Manos Koukoutos <emmanouil.koukoutos@epfl.ch> Date: Fri, 26 Jun 2015 15:23:02 +0200 Subject: [PATCH] Use proper API --- src/main/scala/leon/utils/Library.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/scala/leon/utils/Library.scala b/src/main/scala/leon/utils/Library.scala index aa9e60f4b..c38f3b4cd 100644 --- a/src/main/scala/leon/utils/Library.scala +++ b/src/main/scala/leon/utils/Library.scala @@ -8,17 +8,17 @@ import purescala.Types._ import purescala.DefOps._ case class Library(pgm: Program) { - lazy val List = lookup("leon.collection.List").collect{ case acd : AbstractClassDef => acd }.headOption - lazy val Cons = lookup("leon.collection.Cons").collect { case ccd : CaseClassDef => ccd }.headOption - lazy val Nil = lookup("leon.collection.Nil").collect { case ccd : CaseClassDef => ccd }.headOption + lazy val List = lookup("leon.collection.List").collectFirst { case acd : AbstractClassDef => acd } + lazy val Cons = lookup("leon.collection.Cons").collectFirst { case ccd : CaseClassDef => ccd } + lazy val Nil = lookup("leon.collection.Nil").collectFirst { case ccd : CaseClassDef => ccd } - lazy val Option = lookup("leon.lang.Option").collect { case acd : AbstractClassDef => acd }.headOption - lazy val Some = lookup("leon.lang.Some").collect { case ccd : CaseClassDef => ccd }.headOption - lazy val None = lookup("leon.lang.None").collect { case ccd : CaseClassDef => ccd }.headOption + lazy val Option = lookup("leon.lang.Option").collectFirst { case acd : AbstractClassDef => acd } + lazy val Some = lookup("leon.lang.Some").collectFirst { case ccd : CaseClassDef => ccd } + lazy val None = lookup("leon.lang.None").collectFirst { case ccd : CaseClassDef => ccd } - lazy val String = lookup("leon.lang.string.String").collect { case ccd : CaseClassDef => ccd }.headOption + lazy val String = lookup("leon.lang.string.String").collectFirst { case ccd : CaseClassDef => ccd } - lazy val setToList = lookup("leon.collection.setToList").collect { case fd : FunDef => fd }.headOption + lazy val setToList = lookup("leon.collection.setToList").collectFirst { case fd : FunDef => fd } def lookup(name: String): Seq[Definition] = { pgm.lookupAll(name) -- GitLab