Skip to content

Commit 1fdf28f

Browse files
committed
Revert
1 parent 11a0071 commit 1fdf28f

File tree

3 files changed

+21
-30
lines changed

3 files changed

+21
-30
lines changed

frontends/benchmarks/extraction/valid/Arrays.scala

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* Copyright 2009-2021 EPFL, Lausanne */
22

3-
// use `.updated` from Stainless library
43
import stainless.lang._
54

6-
// unimport implicit conversions for `.updated`
7-
import scala.Predef.{ genericArrayOps => _, genericWrapArray => _, _ }
8-
95
object Arrays {
106

7+
def len[T](a: Array[T]): Boolean = {
8+
a.length == a.size
9+
}.holds
10+
1111
def update[T](a: Array[T], i: Int, t: T) = {
1212
require(i >= 0 && i < a.length)
1313
val array: Array[Int] = Array(0, 1)
@@ -17,11 +17,24 @@ object Arrays {
1717
a.update(i, t)
1818
}
1919

20-
def updated[T](a: Array[T], i: Int, t: T): Array[T] = {
21-
require(i >= 0 && i < a.length)
2220

23-
a.updated(i, t)
24-
}
21+
// ArraySeq not supported.
22+
/*
23+
* import scala.collection.mutable.ArraySeq
24+
* def updated[T](a: Array[T], i: Int, t: T): ArraySeq[T] = {
25+
* require(i >= 0 && i < a.length)
26+
* a.updated(i, t)
27+
* }
28+
*/
29+
30+
// ClassTag not supported.
31+
/*
32+
* import scala.reflect.ClassTag
33+
* def updated[T](a: Array[T], i: Int, u: T)(implicit m: ClassTag[T]): Array[T] = {
34+
* require(i >= 0 && i < a.length)
35+
* a.updated(i, u)
36+
* }
37+
*/
2538

2639
def updated(a: Array[Int], i: Int, v: Int): Array[Int] = {
2740
require(i >= 0 && i < a.length)

frontends/library/stainless/lang/package.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,4 @@ package object lang {
145145

146146
@library
147147
def specialize[T](call: T): T = call
148-
149-
@ignore @library
150-
implicit class ArrayUpdating[T](a: Array[T]) {
151-
def updated(index: Int, value: T): Array[T] = {
152-
val res = a.clone
153-
res(index) = value
154-
res
155-
}
156-
}
157-
158148
}

frontends/scalac/src/main/scala/stainless/frontends/scalac/ASTExtractors.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -844,18 +844,6 @@ trait ASTExtractors {
844844
if (arrayOps.toString endsWith "ArrayOps") && (update.toString == "updated")
845845
=> Some((array, index, value))
846846

847-
case Apply(
848-
Select(
849-
Apply(
850-
TypeApply(ExSelected("stainless", "lang", "package", "ArrayUpdating"), tpe :: Nil),
851-
array :: Nil
852-
),
853-
ExNamed("updated")
854-
),
855-
index :: value :: Nil) =>
856-
857-
Some((array, index, value))
858-
859847
// There's no `updated` method in the Array class itself, only though implicit conversion.
860848
case _ => None
861849
}

0 commit comments

Comments
 (0)