-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into genc-tailrec
- Loading branch information
Showing
19 changed files
with
174 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
20 changes: 20 additions & 0 deletions
20
frontends/benchmarks/extraction/valid/PatternAlternative1 copy.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
object PatternAlternative1 { | ||
sealed trait SignSet | ||
case object None extends SignSet | ||
case object Any extends SignSet | ||
case object Neg extends SignSet | ||
case object Zer extends SignSet | ||
case object Pos extends SignSet | ||
case object NegZer extends SignSet | ||
case object NotZer extends SignSet | ||
case object PosZer extends SignSet | ||
|
||
def subsetOf(a: SignSet, b: SignSet): Boolean = (a, b) match { | ||
case (None, _) => true | ||
case (_, Any) => true | ||
case (Neg, NegZer | NotZer) => true | ||
case (Zer, NegZer | PosZer) => true | ||
case (Pos, NotZer | PosZer) => true | ||
case _ => false | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
frontends/benchmarks/extraction/valid/PatternAlternative2.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
object PatternAlternative2 { | ||
sealed trait Tree | ||
case class Node(left: Tree, right: Tree) extends Tree | ||
case class IntLeaf(value: Int) extends Tree | ||
case class StringLeaf(value: String) extends Tree | ||
case class NoneLeaf() extends Tree | ||
|
||
def containsNoneLeaf(tree: Tree): Boolean = { | ||
tree match { | ||
case Node(left, right) => containsNoneLeaf(left) || containsNoneLeaf(right) | ||
case NoneLeaf() => true | ||
case _ => false | ||
} | ||
} | ||
|
||
def containsOnlyBinaryLeaves(tree: Tree): Boolean = { | ||
tree match { | ||
case Node(left, right) => containsOnlyBinaryLeaves(left) && containsOnlyBinaryLeaves(right) | ||
case IntLeaf(v) => v == 0 || v == 1 | ||
case StringLeaf(v) => v == "0" || v == "1" | ||
case _ => true | ||
} | ||
} | ||
|
||
def hasBinaryLeaves(tree: Tree): Boolean = { | ||
require(!containsNoneLeaf(tree) && containsOnlyBinaryLeaves(tree)) | ||
tree match { | ||
case a @ Node(left: (IntLeaf | StringLeaf), right: (IntLeaf | StringLeaf)) => hasBinaryLeaves(left) && hasBinaryLeaves(right) | ||
case b @ (IntLeaf(0 | 1) | StringLeaf("0" | "1")) => true | ||
case _ => false | ||
} | ||
} ensuring { res => res } | ||
} |
33 changes: 33 additions & 0 deletions
33
frontends/benchmarks/verification/valid/PatternAlternative.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
object PatternAlternative { | ||
sealed trait Tree | ||
case class Node(left: Tree, right: Tree) extends Tree | ||
case class IntLeaf(value: Int) extends Tree | ||
case class StringLeaf(value: String) extends Tree | ||
case class NoneLeaf() extends Tree | ||
|
||
def containsNoneLeaf(tree: Tree): Boolean = { | ||
tree match { | ||
case Node(left, right) => containsNoneLeaf(left) || containsNoneLeaf(right) | ||
case NoneLeaf() => true | ||
case _ => false | ||
} | ||
} | ||
|
||
def containsOnlyBinaryLeaves(tree: Tree): Boolean = { | ||
tree match { | ||
case Node(left, right) => containsOnlyBinaryLeaves(left) && containsOnlyBinaryLeaves(right) | ||
case IntLeaf(v) => v == 0 || v == 1 | ||
case StringLeaf(v) => v == "0" || v == "1" | ||
case _ => true | ||
} | ||
} | ||
|
||
def hasBinaryLeaves(tree: Tree): Boolean = { | ||
require(!containsNoneLeaf(tree) && containsOnlyBinaryLeaves(tree)) | ||
tree match { | ||
case a @ Node(left: (IntLeaf | StringLeaf), right: (IntLeaf | StringLeaf)) => hasBinaryLeaves(left) && hasBinaryLeaves(right) | ||
case b @ (IntLeaf(0 | 1) | StringLeaf("0" | "1")) => true | ||
case _ => false | ||
} | ||
} ensuring { res => res } | ||
} |
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