You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compiler/src/utils/warnings.re
+36-4Lines changed: 36 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,11 @@ type t =
23
23
|UnreachableCase
24
24
|ShadowConstructor(string)
25
25
|NoCmiFile(string,option(string))
26
-
|FuncWasmUnsafe(string);
26
+
|FuncWasmUnsafe(string)
27
+
|FromNumberLiteralI32(string)
28
+
|FromNumberLiteralI64(string)
29
+
|FromNumberLiteralF32(string)
30
+
|FromNumberLiteralF64(string);
27
31
28
32
letnumber=
29
33
fun
@@ -43,9 +47,13 @@ let number =
43
47
|NoCmiFile(_) =>14
44
48
|NonClosedRecordPattern(_) =>15
45
49
|UnusedExtension=>16
46
-
|FuncWasmUnsafe(_) =>17;
50
+
|FuncWasmUnsafe(_) =>17
51
+
|FromNumberLiteralI32(_) =>18
52
+
|FromNumberLiteralI64(_) =>19
53
+
|FromNumberLiteralF32(_) =>20
54
+
|FromNumberLiteralF64(_) =>21;
47
55
48
-
letlast_warning_number=17;
56
+
letlast_warning_number=21;
49
57
50
58
letmessage=
51
59
fun
@@ -108,7 +116,27 @@ let message =
108
116
|FuncWasmUnsafe(func) =>
109
117
"it looks like you are using "
110
118
++ func
111
-
++" on two unsafe Wasm values here.\nThis is generally unsafe and will cause errors. Use one of the equivalent functions in `WasmI32`, `WasmI64`, `WasmF32`, or `WasmF64` instead.";
119
+
++" on two unsafe Wasm values here.\nThis is generally unsafe and will cause errors. Use one of the equivalent functions in `WasmI32`, `WasmI64`, `WasmF32`, or `WasmF64` instead."
120
+
|FromNumberLiteralI32(n) =>
121
+
Printf.sprintf(
122
+
"it looks like you are calling Int32.fromNumber() with a constant number. Try using the literal syntax (e.g. `%sl`) instead.",
123
+
n,
124
+
)
125
+
|FromNumberLiteralI64(n) =>
126
+
Printf.sprintf(
127
+
"it looks like you are calling Int64.fromNumber() with a constant number. Try using the literal syntax (e.g. `%sL`) instead.",
128
+
n,
129
+
)
130
+
|FromNumberLiteralF32(n) =>
131
+
Printf.sprintf(
132
+
"it looks like you are calling Float32.fromNumber() with a constant number. Try using the literal syntax (e.g. `%sf`) instead.",
133
+
n,
134
+
)
135
+
|FromNumberLiteralF64(n) =>
136
+
Printf.sprintf(
137
+
"it looks like you are calling Float64.fromNumber() with a constant number. Try using the literal syntax (e.g. `%sd`) instead.",
0 commit comments