Skip to content

Commit

Permalink
Merge branch 'master' into asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Nov 22, 2024
2 parents 4252491 + 3232287 commit 09a5bcf
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
6 changes: 3 additions & 3 deletions test/src/highlight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ suite('Highlight uses', () => {

test('Should find highlights of Shape.Circle case', async () => {
await testHighlight(mainDocUri, new vscode.Position(3, 9), [
new vscode.Range(3, 9, 3, 15),
new vscode.Range(3, 9, 3, 22),
new vscode.Range(12, 46, 12, 58),
new vscode.Range(17, 17, 17, 29),
])
})
test('Should find highlights of Shape.Circle case-use', async () => {
await testHighlight(mainDocUri, new vscode.Position(12, 52), [
new vscode.Range(3, 9, 3, 15),
new vscode.Range(3, 9, 3, 22),
new vscode.Range(12, 46, 12, 58),
new vscode.Range(17, 17, 17, 29),
])
})
test('Should find highlights of Shape.Circle case-use from pattern match', async () => {
await testHighlight(mainDocUri, new vscode.Position(17, 23), [
new vscode.Range(3, 9, 3, 15),
new vscode.Range(3, 9, 3, 22),
new vscode.Range(12, 46, 12, 58),
new vscode.Range(17, 17, 17, 29),
])
Expand Down
4 changes: 2 additions & 2 deletions test/testWorkspaces/codeActions/src/Dividable.flix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ trait Dividable[t] {

mod Dividable {
// Unused effect
eff DivByZero{
pub def throw(): Void
eff DivByZero {
def raise(): Void
}
}
4 changes: 2 additions & 2 deletions test/testWorkspaces/findReferences/src/Dividable.flix.old
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Blank line
eff DivByZero {
pub def throw(): Void
def raise(): Void
}

trait Dividable[t] {
Expand All @@ -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
}
25 changes: 13 additions & 12 deletions test/testWorkspaces/goto/src/Rewind.flix
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
})
}
4 changes: 2 additions & 2 deletions test/testWorkspaces/highlight/src/Dividable.flix.old
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Blank line
eff DivByZero {
pub def throw(): Void
def raise(): Void
}

trait Dividable[t] {
Expand All @@ -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
}
4 changes: 2 additions & 2 deletions test/testWorkspaces/implementation/src/Dividable.flix.old
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Blank line
eff DivByZero {
pub def throw(): Void
def raise(): Void
}

trait Dividable[t] {
Expand All @@ -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
}

0 comments on commit 09a5bcf

Please sign in to comment.