Skip to content

Commit

Permalink
fix plan_builder of compiler v2
Browse files Browse the repository at this point in the history
  • Loading branch information
rahxephon89 committed Nov 19, 2024
1 parent 8f02541 commit b1105c4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
11 changes: 9 additions & 2 deletions third_party/move/move-compiler-v2/src/plan_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,17 @@ fn convert_location(env: &GlobalEnv, attr: Attribute) -> Option<ModuleId> {
match value {
AttributeValue::Name(id, opt_module_name, _sym) => {
let vloc = env.get_node_loc(id);
convert_module_id(env, vloc, opt_module_name)
let module_id_opt = convert_module_id(env, vloc.clone(), opt_module_name);
if !_sym.display(env.symbol_pool()).to_string().is_empty() || module_id_opt.is_none() {
env.error_with_labels(&loc, "invalid attribute value", vec![(
vloc,
"Expected a module identifier, e.g. 'std::vector'".to_string(),
)]);
}
module_id_opt
},
AttributeValue::Value(id, _val) => {
let vloc = env.get_node_loc(id);
let vloc: Loc = env.get_node_loc(id);
env.error_with_labels(&loc, "invalid attribute value", vec![(
vloc,
"Expected a module identifier, e.g. 'std::vector'".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ error: Expected `location` following `major_status`
22 │ #[expected_failure(major_status=4016, minor_code=0)]
│ ^^^^^^^^^^^^^^^^^

error: invalid attribute value
┌─ tests/unit_test/test/other_failures_invalid_location.move:26:38
26 │ #[expected_failure(vector_error, location=x)]
│ ^^^^^^^^^^
│ │
│ Expected a module identifier, e.g. 'std::vector'

error: invalid attribute value
┌─ tests/unit_test/test/other_failures_invalid_location.move:30:36
30 │ #[expected_failure(out_of_gas, location=0x1::m::t0)]
│ ^^^^^^^^^^^^^^^^^^^
│ │
│ Expected a module identifier, e.g. 'std::vector'

error: invalid attribute value
┌─ tests/unit_test/test/other_failures_invalid_location.move:34:43
34 │ #[expected_failure(major_status=4004, location=self)]
│ ^^^^^^^^^^^^^
│ │
│ Expected a module identifier, e.g. 'std::vector'

error: invalid attribute value
┌─ tests/unit_test/test/other_failures_invalid_location.move:38:59
Expand Down

0 comments on commit b1105c4

Please sign in to comment.