You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/build_tests/super_errors/expected/let_unwrap_return_type_mismatch.res.expected
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,11 @@
9
9
8 [2m│[0m }
10
10
11
11
This has type: [1;31moption<'a>[0m
12
-
But this [1;33mlet?[0m is used in a context expecting the type: [1;33mint[0m
12
+
But this [1;33mlet?[0m is used where this type is expected: [1;33mint[0m
13
13
14
-
[1;33mlet?[0m can only be used in a context that expects [1;33moption[0m or [1;33mresult[0m.
14
+
This [1;33mlet?[0m unwraps an [1;33moption[0m; use it where the enclosing function or let binding returns an [1;33moption[0m so [1;33mNone[0m can propagate.
15
+
16
+
Possible solutions:
17
+
- Change the enclosing function or let binding to return [1;33moption<'t>[0m and use [1;33mSome[0m for success; [1;33mlet?[0m will propagate [1;33mNone[0m.
18
+
- Replace [1;33mlet?[0m with a [1;33mswitch[0m and handle the [1;33mNone[0m case explicitly.
19
+
- If you want a default value instead of early return, unwrap using [1;33mOption.getOr(default)[0m.
But this [1;33mlet?[0m is used where this type is expected: [1;33mint[0m
13
+
14
+
This [1;33mlet?[0m unwraps an [1;33moption[0m; use it where the enclosing function or let binding returns an [1;33moption[0m so [1;33mNone[0m can propagate.
15
+
16
+
Possible solutions:
17
+
- Change the enclosing function or let binding to return [1;33moption<'t>[0m and use [1;33mSome[0m for success; [1;33mlet?[0m will propagate [1;33mNone[0m.
18
+
- Replace [1;33mlet?[0m with a [1;33mswitch[0m and handle the [1;33mNone[0m case explicitly.
19
+
- If you want a default value instead of early return, unwrap using [1;33mOption.getOr(default)[0m.
But this [1;33mlet?[0m is used where this type is expected: [1;33mint[0m
13
+
14
+
This [1;33mlet?[0m unwraps a [1;33mresult[0m; use it where the enclosing function or let binding returns a [1;33mresult[0m so [1;33mError[0m can propagate.
15
+
16
+
Possible solutions:
17
+
- Change the enclosing function or let binding to return [1;33mresult<'ok, 'error>[0m; use [1;33mOk[0m for success, and [1;33mlet?[0m will propagate [1;33mError[0m.
18
+
- Replace [1;33mlet?[0m with a [1;33mswitch[0m and handle the [1;33mError[0m case explicitly.
19
+
- If you want a default value instead of early return, unwrap using [1;33mResult.getOr(default)[0m.
0 commit comments