diff --git a/third_party/move/move-compiler-v2/src/plan_builder.rs b/third_party/move/move-compiler-v2/src/plan_builder.rs index 517671e977785..b03c91c712938 100644 --- a/third_party/move/move-compiler-v2/src/plan_builder.rs +++ b/third_party/move/move-compiler-v2/src/plan_builder.rs @@ -503,10 +503,10 @@ fn get_assigned_attribute( fn convert_location(env: &GlobalEnv, attr: Attribute) -> Option { let (loc, value) = get_assigned_attribute(env, TestingAttribute::ERROR_LOCATION, attr)?; match value { - AttributeValue::Name(id, opt_module_name, _sym) => { + AttributeValue::Name(id, opt_module_name, sym) => { let vloc = env.get_node_loc(id); 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() { + 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(), @@ -515,7 +515,7 @@ fn convert_location(env: &GlobalEnv, attr: Attribute) -> Option { module_id_opt }, AttributeValue::Value(id, _val) => { - let vloc: Loc = env.get_node_loc(id); + let vloc = 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(), diff --git a/third_party/move/move-compiler-v2/tests/unit_test/test/other_failures_invalid_location.exp b/third_party/move/move-compiler-v2/tests/unit_test/test/other_failures_invalid_location.exp index f756284238751..133de995f34f7 100644 --- a/third_party/move/move-compiler-v2/tests/unit_test/test/other_failures_invalid_location.exp +++ b/third_party/move/move-compiler-v2/tests/unit_test/test/other_failures_invalid_location.exp @@ -47,17 +47,17 @@ error: invalid attribute value │ Expected a module identifier, e.g. 'std::vector' error: invalid attribute value - ┌─ tests/unit_test/test/other_failures_invalid_location.move:34:43 + ┌─ tests/unit_test/test/other_failures_invalid_location.move:38:43 │ -34 │ #[expected_failure(major_status=4004, location=self)] +38 │ #[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 + ┌─ tests/unit_test/test/other_failures_invalid_location.move:42:59 │ -38 │ #[expected_failure(major_status=4016, minor_status=0, location=0)] +42 │ #[expected_failure(major_status=4016, minor_status=0, location=0)] │ ^^^^^^^^^^ │ │ │ Expected a module identifier, e.g. 'std::vector' diff --git a/third_party/move/move-compiler-v2/tests/unit_test/test/other_failures_invalid_location.move b/third_party/move/move-compiler-v2/tests/unit_test/test/other_failures_invalid_location.move index 786652248169f..93bfcf8a4b695 100644 --- a/third_party/move/move-compiler-v2/tests/unit_test/test/other_failures_invalid_location.move +++ b/third_party/move/move-compiler-v2/tests/unit_test/test/other_failures_invalid_location.move @@ -30,6 +30,10 @@ module 0x1::m { #[expected_failure(out_of_gas, location=0x1::m::t0)] fun u2() { } + #[test] + #[expected_failure(out_of_gas, location=0x1::m)] + fun u2_correct() { } + #[test] #[expected_failure(major_status=4004, location=self)] fun u3() { }