Skip to content

Commit

Permalink
add backquote around code in warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Zekun Wang committed Nov 15, 2023
1 parent 8b24948 commit 5258de5
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 40 deletions.
10 changes: 5 additions & 5 deletions third_party/move/move-compiler/src/typing/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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) {
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
);
Expand Down Expand Up @@ -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(_) => (),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 5258de5

Please sign in to comment.