Skip to content

Commit 3fa87ae

Browse files
Enrico Granataegranata
authored andcommitted
Integrate the fix for Ariadne's ordering problem
1 parent cb33588 commit 3fa87ae

8 files changed

Lines changed: 43 additions & 111 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aria-bin/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ parser-lib = { path = "../parser-lib" }
99
compiler-lib = { path = "../compiler-lib" }
1010
vm-lib = { path = "../vm-lib" }
1111
clap = { version = "4.5.50", features = ["derive"] }
12-
ariadne = { version = "0.5.0", features = ["auto-color"] }
12+
ariadne = { git = "https://github.com/zesterer/ariadne.git", rev="b60b500" }
1313
reedline = "0.43.0"
1414

1515
[[bin]]

aria-bin/src/error_reporting.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ fn build_report_from_msg_and_location<'a>(
5656
.with_message(msg)
5757
.with_config(config);
5858
let mut cache = StringCache::default();
59-
for loc in &locations {
59+
for (idx, loc) in locations.iter().enumerate() {
6060
let loc = loc.clone();
6161
report = report.with_label(
6262
Label::new((
6363
loc.buffer.name.clone(),
6464
loc.location.start..loc.location.stop,
6565
))
6666
.with_message("here")
67+
.with_order(idx as i32)
6768
.with_color(magenta),
6869
);
6970
if !cache.buffers.contains_key(&loc.buffer.name) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
main.aria:6:9
2+
util.aria:3:13
3+
main.aria:6:9
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
import foo from util;
3+
4+
func op(x,y) {
5+
if x > 0 {
6+
throw "x is positive :(";
7+
}
8+
return y + x;
9+
}
10+
11+
func main() {
12+
# this is reported as 6:9 (the location of the throw, not the location of the call)
13+
# which is a bug, but I need to fix that orthogonally to this test
14+
foo(op,3);
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
func foo(f, n) {
3+
return f(3,n);
4+
}

t

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ if [ $EXIT_CODE -ne 42 ]; then
2121
exit 1
2222
fi
2323

24+
ERROR_REPORTING_TEMPLATE="$SELF_DIR"/aria-bin/src/error_reporting_test/expected.txt
25+
ERROR_REPORTING_OUTPUT=$(ARIA_LIB_DIR_EXTRA="$SELF_DIR"/aria-bin/src/error_reporting_test \
26+
ARIA_LIB_DIR="$ARIA_LIB_DIR" \
27+
cargo run --profile "$ARIA_BUILD_CONFIG" \
28+
--package aria-bin -- \
29+
"$SELF_DIR"/aria-bin/src/error_reporting_test/main.aria 2>&1)
30+
echo "$ERROR_REPORTING_OUTPUT" | awk '
31+
match($0, /\/[^[:space:]]+:[0-9]+:[0-9]+/) {
32+
path = substr($0, RSTART, RLENGTH)
33+
n = split(path, parts, "/")
34+
print parts[n]
35+
}
36+
' | diff -u "$ERROR_REPORTING_TEMPLATE" - && echo "OK" || { echo "Mismatch - actual output ${ERROR_REPORTING_OUTPUT}"; exit 1; }
37+
2438
ARIA_TEST_DIR="$ARIA_TEST_DIR" \
2539
ARIA_LIB_DIR="$ARIA_LIB_DIR" \
2640
RUST_MIN_STACK="$RUST_MIN_STACK" \

test-bin/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.9.20251013"
44
edition = "2024"
55

66
[dependencies]
7-
ariadne = { version = "0.5.0", features = ["auto-color"] }
7+
ariadne = { git = "https://github.com/zesterer/ariadne.git", rev="b60b500" }
88
clap = { version = "4.5.50", features = ["derive"] }
99
glob = "0.3.3"
1010
rayon = "1.11.0"

0 commit comments

Comments
 (0)