Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve error highlighting range for M0072 #4897

Merged
merged 3 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mo_frontend/typing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ and infer_exp'' env exp : T.typ =
check_deprecation env exp.at "field" id.it (T.lookup_val_deprecation id.it tfs);
t
| exception Invalid_argument _ ->
error env exp1.at "M0072"
error env id.at "M0072"
"field %s does not exist in %a%s"
id.it
display_obj (s, tfs)
Expand Down
2 changes: 1 addition & 1 deletion test/fail/ok/modexp1.tc.ok
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
modexp1.mo:8.13-8.14: type error [M0072], field g does not exist in type:
modexp1.mo:8.15-8.16: type error [M0072], field g does not exist in type:
module {f : () -> ()}
2 changes: 1 addition & 1 deletion test/fail/ok/pretty.tc.ok
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pretty.mo:28.23-28.24: type error [M0096], expression of type
}
cannot produce expected type
Nat
pretty.mo:40.1-40.12: type error [M0072], field foo does not exist in type:
pretty.mo:40.13-40.16: type error [M0072], field foo does not exist in type:
module {
bar1 : Nat;
bar2 : Nat;
Expand Down
2 changes: 1 addition & 1 deletion test/fail/ok/suggest-long-ai.tc.ok
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
suggest-long-ai.mo:4.1-4.5: type error [M0072], field stableM does not exist in type:
suggest-long-ai.mo:4.6-4.13: type error [M0072], field stableM does not exist in type:
module {
type ErrorCode =
{
Expand Down
2 changes: 1 addition & 1 deletion test/fail/ok/suggest-long.tc.ok
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
suggest-long.mo:3.1-3.5: type error [M0072], field stableM does not exist in module.
suggest-long.mo:3.6-3.13: type error [M0072], field stableM does not exist in module.
Did you mean field stableMemoryGrow, stableMemorySize, stableMemoryLoadBlob, stableMemoryLoadInt8, stableMemoryLoadNat8, stableMemoryLoadFloat, stableMemoryLoadInt16, stableMemoryLoadInt32, stableMemoryLoadInt64, stableMemoryLoadNat16, stableMemoryLoadNat32, stableMemoryLoadNat64, stableMemoryStoreBlob, stableMemoryStoreInt8, stableMemoryStoreNat8, stableMemoryStoreFloat, stableMemoryStoreInt16, stableMemoryStoreInt32, stableMemoryStoreInt64, stableMemoryStoreNat16, stableMemoryStoreNat32 or stableMemoryStoreNat64?
2 changes: 1 addition & 1 deletion test/fail/ok/suggest-short-ai.tc.ok
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
suggest-short-ai.mo:4.1-4.5: type error [M0072], field s does not exist in type:
suggest-short-ai.mo:4.6-4.7: type error [M0072], field s does not exist in type:
module {
type ErrorCode =
{
Expand Down
2 changes: 1 addition & 1 deletion test/fail/ok/suggest-short.tc.ok
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
suggest-short.mo:3.1-3.5: type error [M0072], field s does not exist in module.
suggest-short.mo:3.6-3.7: type error [M0072], field s does not exist in module.
Did you mean field sin, setTimer, shiftLeft, shiftRight, stableVarQuery, setCandidLimits, setCertifiedData, stableMemoryGrow, stableMemorySize, stableMemoryLoadBlob, stableMemoryLoadInt8, stableMemoryLoadNat8, stableMemoryLoadFloat, stableMemoryLoadInt16, stableMemoryLoadInt32, stableMemoryLoadInt64, stableMemoryLoadNat16, stableMemoryLoadNat32, stableMemoryLoadNat64, stableMemoryStoreBlob, stableMemoryStoreInt8, stableMemoryStoreNat8, stableMemoryStoreFloat, stableMemoryStoreInt16, stableMemoryStoreInt32, stableMemoryStoreInt64, stableMemoryStoreNat16, stableMemoryStoreNat32 or stableMemoryStoreNat64?