From 7e04baad5c9e55b8f320f1cb030e2f77435ce22c Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Thu, 21 Nov 2024 19:51:16 +0100 Subject: [PATCH] test: reflect language changes --- .../codeActions/src/Dividable.flix | 4 +-- .../findReferences/src/Dividable.flix.old | 4 +-- test/testWorkspaces/goto/src/Rewind.flix | 25 ++++++++++--------- .../highlight/src/Dividable.flix.old | 4 +-- .../implementation/src/Dividable.flix.old | 4 +-- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/test/testWorkspaces/codeActions/src/Dividable.flix b/test/testWorkspaces/codeActions/src/Dividable.flix index 7a815cf..4eed475 100644 --- a/test/testWorkspaces/codeActions/src/Dividable.flix +++ b/test/testWorkspaces/codeActions/src/Dividable.flix @@ -6,7 +6,7 @@ trait Dividable[t] { mod Dividable { // Unused effect - eff DivByZero{ - pub def throw(): Void + eff DivByZero { + def raise(): Void } } diff --git a/test/testWorkspaces/findReferences/src/Dividable.flix.old b/test/testWorkspaces/findReferences/src/Dividable.flix.old index fc5fffc..704727f 100644 --- a/test/testWorkspaces/findReferences/src/Dividable.flix.old +++ b/test/testWorkspaces/findReferences/src/Dividable.flix.old @@ -2,7 +2,7 @@ // Blank line eff DivByZero { - pub def throw(): Void + def raise(): Void } trait Dividable[t] { @@ -13,5 +13,5 @@ trait Dividable[t] { instance Dividable[Int32] { type Aef = DivByZero pub def div(x: Int32, y: Int32): Int32 \ DivByZero = - if (y == 0) do DivByZero.throw() else x / y + if (y == 0) DivByZero.raise() else x / y } diff --git a/test/testWorkspaces/goto/src/Rewind.flix b/test/testWorkspaces/goto/src/Rewind.flix index 509854b..84bd23d 100644 --- a/test/testWorkspaces/goto/src/Rewind.flix +++ b/test/testWorkspaces/goto/src/Rewind.flix @@ -1,9 +1,9 @@ // Blank line eff Rewind { - pub def save(label: String): Unit + def save(label: String): Unit /// If you rewind to a non-saved label, it is like throwing an exception. - pub def rewind(label: String): Unit + def rewind(label: String): Unit } /// We want to find a number that is: @@ -13,14 +13,15 @@ eff Rewind { /// 4. not divisible by 3 (so not 0, 3, 6, 9, ...) /// And we will this by guessing and retrying def search(k: Int32): Int32 \ Rewind + IO = { - println("Beginning to search!"); - let random = Random.freshWithSeed(123i64); - do Rewind.save("start"); - let guess = Random.nextNatWithMax(random, k); - // 1. and 2. hold automatically - if (Int32.modulo(guess, 2) == 0) {println("retry for ${guess}"); do Rewind.rewind("start"); ?unreachable} - // now 3. holds - else if (Int32.modulo(guess, 3) == 0) {println("retry for ${guess}"); do Rewind.rewind("start"); ?unreachable} - // now 4. holds and we can return - else guess + Random.runWithSeed(123i64, _ -> { + println("Beginning to search!"); + Rewind.save("start"); + let guess = Int32.remainder(Random.randomInt32(), 5); + // 1. and 2. hold automatically + if (Int32.modulo(guess, 2) == 0) {println("retry for ${guess}"); Rewind.rewind("start"); ?unreachable} + // now 3. holds + else if (Int32.modulo(guess, 3) == 0) {println("retry for ${guess}"); Rewind.rewind("start"); ?unreachable} + // now 4. holds and we can return + else guess + }) } diff --git a/test/testWorkspaces/highlight/src/Dividable.flix.old b/test/testWorkspaces/highlight/src/Dividable.flix.old index fc5fffc..704727f 100644 --- a/test/testWorkspaces/highlight/src/Dividable.flix.old +++ b/test/testWorkspaces/highlight/src/Dividable.flix.old @@ -2,7 +2,7 @@ // Blank line eff DivByZero { - pub def throw(): Void + def raise(): Void } trait Dividable[t] { @@ -13,5 +13,5 @@ trait Dividable[t] { instance Dividable[Int32] { type Aef = DivByZero pub def div(x: Int32, y: Int32): Int32 \ DivByZero = - if (y == 0) do DivByZero.throw() else x / y + if (y == 0) DivByZero.raise() else x / y } diff --git a/test/testWorkspaces/implementation/src/Dividable.flix.old b/test/testWorkspaces/implementation/src/Dividable.flix.old index fc5fffc..704727f 100644 --- a/test/testWorkspaces/implementation/src/Dividable.flix.old +++ b/test/testWorkspaces/implementation/src/Dividable.flix.old @@ -2,7 +2,7 @@ // Blank line eff DivByZero { - pub def throw(): Void + def raise(): Void } trait Dividable[t] { @@ -13,5 +13,5 @@ trait Dividable[t] { instance Dividable[Int32] { type Aef = DivByZero pub def div(x: Int32, y: Int32): Int32 \ DivByZero = - if (y == 0) do DivByZero.throw() else x / y + if (y == 0) DivByZero.raise() else x / y }