Skip to content

Commit

Permalink
Remove an error context
Browse files Browse the repository at this point in the history
Summary: Removing an anyhow context. The error message calls out the term that's causing the issue and prints the erroranous line. I believe it should be pretty obvious that the error is on RHS.

Reviewed By: JakobDegen

Differential Revision: D63057184

fbshipit-source-id: c904b323e91cfd8f81f0502f93d81676dd286c3e
  • Loading branch information
Will-MingLun-Li authored and facebook-github-bot committed Sep 23, 2024
1 parent 2b8ccb1 commit b16d886
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
8 changes: 1 addition & 7 deletions starlark/src/typing/tests/golden/bit_or_return_int.golden
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@ Approximation: Unknown type = "Span { begin: Pos(30), end: Pos(34) }"
Compiler typechecker (eval):
Compiler typechecker and eval results mismatch.

error: converting RHS to type
error: Type `3` is not a valid type annotation
--> filename:2:8
|
2 | test = int | 3
| ^^^^^^^
|


converting RHS to type

Caused by:
Type `3` is not a valid type annotation
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@ Approximation: Unknown type = "Span { begin: Pos(57), end: Pos(61) }"
Compiler typechecker (eval):
Compiler typechecker and eval results mismatch.

error: converting RHS to type
error: String literals are not allowed in type expressions: `"test"`
--> filename:3:8
|
3 | test = int | foo()
| ^^^^^^^^^^^
|


converting RHS to type

Caused by:
String literals are not allowed in type expressions: `"test"`
5 changes: 1 addition & 4 deletions starlark/src/values/typing/macro_refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
*/

#![doc(hidden)]

use anyhow::Context;

use crate::values::typing::type_compiled::compiled::TypeCompiled;
use crate::values::Heap;
use crate::values::StarlarkValue;
Expand All @@ -44,6 +41,6 @@ pub fn starlark_value_bit_or_for_type<'v, S: StarlarkValue<'v>>(
)));
};
let this = TypeCompiled::from_ty(&this, heap);
let other = TypeCompiled::new(other, heap).context("converting RHS to type")?;
let other = TypeCompiled::new(other, heap)?;
Ok(TypeCompiled::type_any_of_two(this, other, heap).to_inner())
}

0 comments on commit b16d886

Please sign in to comment.