From 5258de5c861837ff1a0e00bc4932d5fbc4de8081 Mon Sep 17 00:00:00 2001 From: Zekun Wang Date: Tue, 17 Oct 2023 21:26:11 -0400 Subject: [PATCH] add backquote around code in warnings --- .../move/move-compiler/src/typing/expand.rs | 10 ++--- .../tests/move_check/typing/eq_invalid.exp | 2 +- .../move_check/typing/exp_list_nested.exp | 2 +- .../typing/exp_list_resource_drop.exp | 2 +- .../typing/ignore_inferred_resource.exp | 2 +- .../typing/invalid_type_acquire.exp | 6 +-- .../tests/move_check/typing/neq_invalid.exp | 6 +-- .../typing/number_literal_too_large.exp | 40 +++++++++---------- .../typing/uninferred_type_call.exp | 2 +- .../typing/uninferred_type_pack.exp | 2 +- .../typing/uninferred_type_unpack_assign.exp | 2 +- .../typing/uninferred_type_unpack_bind.exp | 2 +- .../typing/uninferred_type_unpack_decl.exp | 2 +- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/third_party/move/move-compiler/src/typing/expand.rs b/third_party/move/move-compiler/src/typing/expand.rs index 02ffaf20bd84ad..be1cbe1aafffef 100644 --- a/third_party/move/move-compiler/src/typing/expand.rs +++ b/third_party/move/move-compiler/src/typing/expand.rs @@ -67,7 +67,7 @@ fn type_struct_ty_param(context: &mut Context, ty: &mut Type, i: usize, ty_name: .param .user_specified_name .value; - let msg = format!("Cannot infer the type parameter {param_name} for generic struct {ty_name}. Try providing a type parameter."); + let msg = format!("Cannot infer the type parameter `{param_name}` for generic struct `{ty_name}`. Try providing a type parameter."); type_msg_(context, ty, &msg); }, _ => type_(context, ty), @@ -82,7 +82,7 @@ fn type_fun_ty_param( n: &FunctionName, ) { let param_name = context.function_info(m, n).signature.type_parameters[i].user_specified_name; - type_msg_(context, ty, &format!("Cannot infer the type parameter {param_name} for generic function {m}::{n}. Try providing a type parameter.")); + type_msg_(context, ty, &format!("Cannot infer the type parameter `{param_name}` for generic function `{m}::{n}`. Try providing a type parameter.")); } pub fn type_msg_(context: &mut Context, ty: &mut Type, msg_uninferred: &str) { @@ -238,7 +238,7 @@ pub fn exp(context: &mut Context, e: &mut T::Exp) { }; let new_exp = if v > max { let msg = format!( - "Expected a literal of type '{}', but the value is too large.", + "Expected a literal of type `{}`, but the value is too large.", bt ); let fix_bt = if v > u128_max { @@ -255,7 +255,7 @@ pub fn exp(context: &mut Context, e: &mut T::Exp) { }; let fix = format!( - "Annotating the literal might help inference: '{value}{type}'", + "Annotating the literal might help inference: `{value}{type}`", value=v, type=fix_bt, ); @@ -417,7 +417,7 @@ fn builtin_function(context: &mut Context, b: &mut T::BuiltinFunction) { type_msg_( context, bt, - &format!("Cannot infer a type parameter for built-in function '{f_name}'"), + &format!("Cannot infer a type parameter for built-in function `{f_name}`"), ); }, B::Assert(_) => (), diff --git a/third_party/move/move-compiler/tests/move_check/typing/eq_invalid.exp b/third_party/move/move-compiler/tests/move_check/typing/eq_invalid.exp index 0e734eda733970..a8faf97213bc2b 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/eq_invalid.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/eq_invalid.exp @@ -126,7 +126,7 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/eq_invalid.move:28:9 │ 28 │ G2{} == G2{}; - │ ^^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::G2. Try providing a type parameter. + │ ^^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::G2`. Try providing a type parameter. error[E05001]: ability constraint not satisfied ┌─ tests/move_check/typing/eq_invalid.move:29:9 diff --git a/third_party/move/move-compiler/tests/move_check/typing/exp_list_nested.exp b/third_party/move/move-compiler/tests/move_check/typing/exp_list_nested.exp index c7f5ee4757db43..9e8478006cc5f2 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/exp_list_nested.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/exp_list_nested.exp @@ -22,5 +22,5 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/exp_list_nested.move:6:19 │ 6 │ (0, (S{}, R{})) - │ ^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::R. Try providing a type parameter. + │ ^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::R`. Try providing a type parameter. diff --git a/third_party/move/move-compiler/tests/move_check/typing/exp_list_resource_drop.exp b/third_party/move/move-compiler/tests/move_check/typing/exp_list_resource_drop.exp index 43dc6ddf397a3b..c6eb1ec5e1e7fb 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/exp_list_resource_drop.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/exp_list_resource_drop.exp @@ -32,5 +32,5 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/exp_list_resource_drop.move:9:19 │ 9 │ (0, S{ }, Box { f: abort 0 }); - │ ^^^^^^^^^^^^^^^^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::Box. Try providing a type parameter. + │ ^^^^^^^^^^^^^^^^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::Box`. Try providing a type parameter. diff --git a/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource.exp b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource.exp index 0ab2930d79e06b..3e782099f9e139 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource.exp @@ -14,5 +14,5 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/ignore_inferred_resource.move:4:9 │ 4 │ S{}; - │ ^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::S. Try providing a type parameter. + │ ^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::S`. Try providing a type parameter. diff --git a/third_party/move/move-compiler/tests/move_check/typing/invalid_type_acquire.exp b/third_party/move/move-compiler/tests/move_check/typing/invalid_type_acquire.exp index 3dbedf079135ff..c441240c96133f 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/invalid_type_acquire.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/invalid_type_acquire.exp @@ -32,7 +32,7 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/invalid_type_acquire.move:30:9 │ 30 │ destroy(account, move_from(a)); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Cannot infer the type parameter T for generic function 0x2::M::destroy. Try providing a type parameter. + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Cannot infer the type parameter `T` for generic function `0x2::M::destroy`. Try providing a type parameter. error[E04009]: expected specific type ┌─ tests/move_check/typing/invalid_type_acquire.move:31:26 @@ -167,7 +167,7 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/invalid_type_acquire.move:48:9 │ 48 │ exists(a); - │ ^^^^^^^^^ Cannot infer a type parameter for built-in function 'exists' + │ ^^^^^^^^^ Cannot infer a type parameter for built-in function `exists` error[E04009]: expected specific type ┌─ tests/move_check/typing/invalid_type_acquire.move:49:9 @@ -212,7 +212,7 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/invalid_type_acquire.move:54:9 │ 54 │ move_to(account, any()); - │ ^^^^^^^^^^^^^^^^^^^^^^^ Cannot infer a type parameter for built-in function 'move_to' + │ ^^^^^^^^^^^^^^^^^^^^^^^ Cannot infer a type parameter for built-in function `move_to` error[E04009]: expected specific type ┌─ tests/move_check/typing/invalid_type_acquire.move:55:9 diff --git a/third_party/move/move-compiler/tests/move_check/typing/neq_invalid.exp b/third_party/move/move-compiler/tests/move_check/typing/neq_invalid.exp index 1855a50560d89f..1bd855ded2450a 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/neq_invalid.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/neq_invalid.exp @@ -106,7 +106,7 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/neq_invalid.move:26:9 │ 26 │ G0{} != G0{}; - │ ^^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::G0. Try providing a type parameter. + │ ^^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::G0`. Try providing a type parameter. error[E05001]: ability constraint not satisfied ┌─ tests/move_check/typing/neq_invalid.move:27:9 @@ -124,7 +124,7 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/neq_invalid.move:27:9 │ 27 │ G1{} != G1{}; - │ ^^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::G1. Try providing a type parameter. + │ ^^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::G1`. Try providing a type parameter. error[E05001]: ability constraint not satisfied ┌─ tests/move_check/typing/neq_invalid.move:27:17 @@ -154,7 +154,7 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/neq_invalid.move:28:9 │ 28 │ G2{} != G2{}; - │ ^^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::G2. Try providing a type parameter. + │ ^^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::G2`. Try providing a type parameter. error[E05001]: ability constraint not satisfied ┌─ tests/move_check/typing/neq_invalid.move:28:17 diff --git a/third_party/move/move-compiler/tests/move_check/typing/number_literal_too_large.exp b/third_party/move/move-compiler/tests/move_check/typing/number_literal_too_large.exp index 1a676a9b127b09..c4349a417e90ae 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/number_literal_too_large.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/number_literal_too_large.exp @@ -5,80 +5,80 @@ error[E04021]: invalid number after type inference │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '340282366920938463463374607431768211455u128' - │ Expected a literal of type 'u64', but the value is too large. + │ Annotating the literal might help inference: `340282366920938463463374607431768211455u128` + │ Expected a literal of type `u64`, but the value is too large. error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:5:10 │ 5 │ (340282366920938463463374607431768211454: u64); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- Expected a literal of type 'u64', but the value is too large. + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- Expected a literal of type `u64`, but the value is too large. │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '340282366920938463463374607431768211454u128' + │ Annotating the literal might help inference: `340282366920938463463374607431768211454u128` error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:6:10 │ 6 │ (340282366920938463463374607431768211454: u8); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- Expected a literal of type 'u8', but the value is too large. + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- Expected a literal of type `u8`, but the value is too large. │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '340282366920938463463374607431768211454u128' + │ Annotating the literal might help inference: `340282366920938463463374607431768211454u128` error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:8:10 │ 8 │ (18446744073709551616: u64); - │ ^^^^^^^^^^^^^^^^^^^^ --- Expected a literal of type 'u64', but the value is too large. + │ ^^^^^^^^^^^^^^^^^^^^ --- Expected a literal of type `u64`, but the value is too large. │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '18446744073709551616u128' + │ Annotating the literal might help inference: `18446744073709551616u128` error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:9:10 │ 9 │ (18446744073709551616: u8); - │ ^^^^^^^^^^^^^^^^^^^^ -- Expected a literal of type 'u8', but the value is too large. + │ ^^^^^^^^^^^^^^^^^^^^ -- Expected a literal of type `u8`, but the value is too large. │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '18446744073709551616u128' + │ Annotating the literal might help inference: `18446744073709551616u128` error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:11:10 │ 11 │ (18446744073709551615: u8); - │ ^^^^^^^^^^^^^^^^^^^^ -- Expected a literal of type 'u8', but the value is too large. + │ ^^^^^^^^^^^^^^^^^^^^ -- Expected a literal of type `u8`, but the value is too large. │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '18446744073709551615u64' + │ Annotating the literal might help inference: `18446744073709551615u64` error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:13:10 │ 13 │ (256: u8); - │ ^^^ -- Expected a literal of type 'u8', but the value is too large. + │ ^^^ -- Expected a literal of type `u8`, but the value is too large. │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '256u16' + │ Annotating the literal might help inference: `256u16` error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:19:10 │ 19 │ (3402534025: u16); - │ ^^^^^^^^^^ --- Expected a literal of type 'u16', but the value is too large. + │ ^^^^^^^^^^ --- Expected a literal of type `u16`, but the value is too large. │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '3402534025u32' + │ Annotating the literal might help inference: `3402534025u32` error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:22:10 │ 22 │ (3402534025534025: u32); - │ ^^^^^^^^^^^^^^^^ --- Expected a literal of type 'u32', but the value is too large. + │ ^^^^^^^^^^^^^^^^ --- Expected a literal of type `u32`, but the value is too large. │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '3402534025534025u64' + │ Annotating the literal might help inference: `3402534025534025u64` error[E04021]: invalid number after type inference ┌─ tests/move_check/typing/number_literal_too_large.move:24:9 @@ -87,6 +87,6 @@ error[E04021]: invalid number after type inference │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ Invalid numerical literal - │ Annotating the literal might help inference: '340282366920938463463374607431768211455607431768211455u256' - │ Expected a literal of type 'u64', but the value is too large. + │ Annotating the literal might help inference: `340282366920938463463374607431768211455607431768211455u256` + │ Expected a literal of type `u64`, but the value is too large. diff --git a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_call.exp b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_call.exp index d565494206a143..786062a5c5d2a2 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_call.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_call.exp @@ -2,5 +2,5 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/uninferred_type_call.move:3:9 │ 3 │ foo() - │ ^^^^^ Cannot infer the type parameter T for generic function 0x8675309::M::foo. Try providing a type parameter. + │ ^^^^^ Cannot infer the type parameter `T` for generic function `0x8675309::M::foo`. Try providing a type parameter. diff --git a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_pack.exp b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_pack.exp index faac0185211ddd..32e3a1206ee810 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_pack.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_pack.exp @@ -2,5 +2,5 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/uninferred_type_pack.move:5:9 │ 5 │ S{}; - │ ^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::S. Try providing a type parameter. + │ ^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::S`. Try providing a type parameter. diff --git a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_assign.exp b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_assign.exp index 2d499c79ac21c9..8313a6a63945e4 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_assign.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_assign.exp @@ -2,5 +2,5 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/uninferred_type_unpack_assign.move:5:9 │ 5 │ S{} = S{}; - │ ^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::S. Try providing a type parameter. + │ ^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::S`. Try providing a type parameter. diff --git a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_bind.exp b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_bind.exp index ed50e049e94f0e..423b1e3d17b1b6 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_bind.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_bind.exp @@ -2,5 +2,5 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/uninferred_type_unpack_bind.move:5:13 │ 5 │ let S{} = S{}; - │ ^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::S. Try providing a type parameter. + │ ^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::S`. Try providing a type parameter. diff --git a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_decl.exp b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_decl.exp index b1073fa1502759..16194fd72c983c 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_decl.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/uninferred_type_unpack_decl.exp @@ -2,5 +2,5 @@ error[E04010]: cannot infer type ┌─ tests/move_check/typing/uninferred_type_unpack_decl.move:5:13 │ 5 │ let S{}; - │ ^^^ Cannot infer the type parameter T for generic struct 0x8675309::M::S. Try providing a type parameter. + │ ^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::S`. Try providing a type parameter.