mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
Improve error message even more
This commit is contained in:
parent
88ac76ada0
commit
690fa39db2
3 changed files with 10 additions and 8 deletions
|
|
@ -1696,15 +1696,17 @@ pub const ReportBuilder = struct {
|
|||
if (is_plus_operator) {
|
||||
try report.document.addReflowingText("The value before this ");
|
||||
try report.document.addAnnotated("+", .emphasized);
|
||||
try report.document.addReflowingText(" operator has a type with no ");
|
||||
try report.document.addReflowingText(" operator has the type ");
|
||||
try report.document.addAnnotated(snapshot_str, .emphasized);
|
||||
try report.document.addReflowingText(", which has no ");
|
||||
try report.document.addAnnotated(method_name_str, .emphasized);
|
||||
try report.document.addReflowingText(" method:");
|
||||
} else {
|
||||
try report.document.addReflowingText("The ");
|
||||
try report.document.addAnnotated(snapshot_str, .emphasized);
|
||||
try report.document.addReflowingText(" type does not have a ");
|
||||
try report.document.addReflowingText("This ");
|
||||
try report.document.addAnnotated(method_name_str, .emphasized);
|
||||
try report.document.addReflowingText(" method:");
|
||||
try report.document.addReflowingText(" method is being called on the type ");
|
||||
try report.document.addAnnotated(snapshot_str, .emphasized);
|
||||
try report.document.addReflowingText(", which has no method with that name:");
|
||||
}
|
||||
try report.document.addLineBreak();
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ But I expected it to be:
|
|||
_Adv, Str -> Adv_
|
||||
|
||||
**MISSING METHOD**
|
||||
The **Adv** type does not have a **update_strr** method:
|
||||
This **update_strr** method is being called on the type **Adv**, which has no method with that name:
|
||||
**Adv.md:23:13:23:33:**
|
||||
```roc
|
||||
next_val = val.update_strr(100)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ MISSING METHOD - plus_operator_vs_method.md:11:11:11:16
|
|||
MISSING METHOD - plus_operator_vs_method.md:15:11:15:20
|
||||
# PROBLEMS
|
||||
**MISSING METHOD**
|
||||
The value before this **+** operator has a type with no **plus** method:
|
||||
The value before this **+** operator has the type **MyType**, which has no **plus** method:
|
||||
**plus_operator_vs_method.md:11:11:11:16:**
|
||||
```roc
|
||||
result1 = a + b
|
||||
|
|
@ -38,7 +38,7 @@ result1 = a + b
|
|||
**Hint: **The **+** operator calls a method named **plus** on the value preceding it, passing the value after the operator as the one argument.
|
||||
|
||||
**MISSING METHOD**
|
||||
The **MyType** type does not have a **plus** method:
|
||||
This **plus** method is being called on the type **MyType**, which has no method with that name:
|
||||
**plus_operator_vs_method.md:15:11:15:20:**
|
||||
```roc
|
||||
result2 = a.plus(b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue