This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object CC { | |
def connectedComponent(board: Board, color: Cell, toVisit: List[Point], component: List[Point] = List[Point]()): List[Point] = { | |
require(board.isValid && | |
board.isValidPoints(toVisit) && | |
board.isValidPoints(component) && | |
isComponent(board, addValidElements(board, component, toVisit), color) | |
) | |
if (toVisit.isEmpty) | |
component | |
else if (component.contains(toVisit.head)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object CC { | |
def connectedComponent(board: Board, color: Cell, toVisit: List[Point], component: List[Point] = List[Point]()): List[Point] = { | |
require(board.isValid && | |
board.isValidPoints(toVisit) && | |
board.isValidPoints(component) && | |
isComponent(board, addValidElements(board, component, toVisit), color) | |
) | |
if (toVisit.isEmpty) | |
component | |
else if (component.contains(toVisit.head)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package go.core | |
import go.util.conversions._ | |
import go.util.Logic._ | |
import go.collection.GoSet | |
import go.core.definitions._ | |
import leon.annotation.library | |
import leon.lang._ | |
import leon.collection._ | |
import leon.annotation._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ def numberOfStatements(tree: Tree): Int = { | |
var n = 0 | |
def loop(x: Tree): Unit = { | |
x match { | |
case t: Source => n += t.stats.length | |
case t: internal.ast.Pkg => n += t.stats.length | |
case t: internal.ast.Term.Match => n += t.cases.length | |
case t: internal.ast.Term.PartialFunction => n += t.cases.length | |
case t: internal.ast.Term.Block => n += t.stats.length | |
case t: internal.ast.Template if t.stats.isDefined => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ollie-scalafmt@ import scala.sys.process._ | |
import scala.sys.process._ | |
ollie-scalafmt@ import java.io.ByteArrayInputStream | |
import java.io.ByteArrayInputStream | |
ollie-scalafmt@ formatMe | |
res28: String = """ | |
Defn.Object(Nil, Term.Name("State"), Template(Nil, Seq(Ctor.Ref.Name("ScalaFmtLogger")), Term.Param(Nil, Name.Anonymous(), None, None), Some(Seq(Defn.Val(Nil, Seq(Pat.Var.Term(Term.Name("start"))), None, Term.Apply(Term.Name("State"), Seq(Lit(0), Term.Name("identity"), Term.ApplyType(Term.Select(Term.Name("Vector"), Term.Name("empty")), Seq(Type.Name("Split"))), Term.ApplyType(Term.Select(Term.Name("Vector"), Term.Name("empty")), Seq(Type.Name("State"))), Lit(0), Term.ApplyType(Term.Select(Term.Name("Vector"), Term.Name("empty")), Seq(Type.Apply(Type.Name("Indent"), Seq(Type.Name("Num"))))), Lit(0)))), Defn.Def(Nil, Term.Name("reconstructPath"), Nil, Seq(Seq(Term.Param(Nil, Term.Name("toks"), Some(Type.Apply(Type.Name("Array"), Seq(Type.Name("FormatToken")))), None), Term.Param(Nil, Term.Name("splits"), Some(T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ollie-scalameta@ """case x: (Int, Int) => 1""".parse[Case] | |
scala.meta.parsers.common.ParseException: identifier expected but integer literal found at 22..23 | |
ollie-scalameta@ """def macroTransform(annottees: Any*) = macro Cached.cachedImpl""".parse[Stat] | |
scala.meta.parsers.common.ParseException: macros must have explicitly specified return types at 4..18 | |
ollie-scalameta@ """for { ident @ (__ : Int) <- List(1, 2) } yield ident + 1""".parse[Stat] | |
scala.meta.parsers.common.ParseException: ) expected but : found at 18..19 | |
ollie-scalameta@ """import Predef.{ any2stringadd => _, _ => _ }""".parse[Stat] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ollie-scalafmt@ """foo(1, b = true, js = xs: _*)""".parse[Stat] | |
scala.meta.parsers.common.ParseException: ) expected but identifier found at 27..28 | |
ollie-scalafmt@ """case a: Array[_] ⇒ format(t, (a map (_.asInstanceOf[AnyRef]): _*))""".parse[Case] | |
scala.meta.parsers.common.ParseException: ) expected but identifier found at 63..64 | |
ollie-scalafmt@ """(new t1785)[Int](1)""".parse[Stat] | |
scala.meta.parsers.common.ParseException: ; expected but [ found at 11..12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def genArrayInstanceTests(tree: LinkedClass): js.Tree = { | |
import Definitions._ | |
import TreeDSL._ | |
implicit val pos = tree.pos | |
val className = tree.name.name | |
val displayName = decodeClassName(className) | |
val objParam = js.ParamDef(Ident("obj"), rest = false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object && { | |
def unapply[A](e: A) = Some(e -> e) | |
def test() { | |
val greaterThan10 = Find[Int](_ > 10) | |
List(1, 2, 11, 3) match { | |
// All must succeed | |
case greaterThan10(ten) && Last(last) && Head(head) => | |
println(ten) // 11 | |
println(last) // 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Test extends App { | |
import scala.meta._ | |
import scala.meta.tokens.Token.Comment | |
val tree = """ | |
|package io.buildo.baseexample | |
| | |
|package enums | |
| | |
|import ingredients.caseenum.annotations.enum | |
| |
OlderNewer