diff --git a/effekt/jvm/src/test/scala/effekt/StdlibTests.scala b/effekt/jvm/src/test/scala/effekt/StdlibTests.scala index 58272dbe9..6017edc6d 100644 --- a/effekt/jvm/src/test/scala/effekt/StdlibTests.scala +++ b/effekt/jvm/src/test/scala/effekt/StdlibTests.scala @@ -66,9 +66,5 @@ class StdlibLLVMTests extends StdlibTests { override def ignored: Set[File] = Set( // String comparison using `<`, `<=`, `>`, `>=` is not implemented yet on LLVM examplesDir / "stdlib" / "string" / "compare.effekt", - - // Wrong codegen for negative types, see #801 - examplesDir / "stdlib" / "json.effekt", - examplesDir / "stdlib" / "buffer.effekt", ) } diff --git a/libraries/common/buffer.effekt b/libraries/common/buffer.effekt index 94d3c18bd..78548d74f 100644 --- a/libraries/common/buffer.effekt +++ b/libraries/common/buffer.effekt @@ -48,7 +48,7 @@ def arrayBuffer[T](initialCapacity: Int): Buffer[T] at global = { def full?() = capacity() <= 0 def empty?() = size() <= 0 def read() = { - if (buffer.empty?) None() + if (size() <= 0) None() else { val result: T = contents.unsafeGet(head.get) head.set(mod(head.get + 1, initialCapacity)) @@ -56,7 +56,7 @@ def arrayBuffer[T](initialCapacity: Int): Buffer[T] at global = { } } def write(el: T) = { - if (buffer.full?) <> // raise(BufferOverflow()) + if (capacity() <= 0) <> // raise(BufferOverflow()) contents.unsafeSet(tail.get, el) tail.set(mod(tail.get + 1, initialCapacity)) diff --git a/libraries/common/json.effekt b/libraries/common/json.effekt index f6bb773f3..b3db5cc4e 100644 --- a/libraries/common/json.effekt +++ b/libraries/common/json.effekt @@ -327,15 +327,18 @@ namespace test { def k = new JsonObjectBuilder { def field(k){v} = { println(k); ignore{v} } } - def d = new JsonBuilder { - def number(n) = println(n) - def bool(b) = () - def null() = println("NULL") - def string(s) = () - def list(){e} = handleJsonBuilder{d}{e} - def dict(){e} = handleJsonObjectBuilder{k}{e} + def jsonBuilder[R] {e: => R / JsonBuilder}: R = { + def d = new JsonBuilder { + def number(n) = println(n) + def bool(b) = () + def null() = println("NULL") + def string(s) = () + def list(){e} = jsonBuilder{e} + def dict(){e} = handleJsonObjectBuilder{k}{e} + } + handleJsonBuilder{d}{e} } - handleJsonBuilder{d}{ decodeJson() } + jsonBuilder { decodeJson() } } println("")