···214214 rename all its occurrences.
215215 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
216216217217+- The compiler now reports an error for literal floats that are outside the
218218+ floating point representable range on both targets. Previously it would only
219219+ do that when compiling on the Erlang target.
220220+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
221221+217222- Fixed a typo in the error message emitted when trying to run a module that
218223 does not have a main function.
219224 ([Louis Pilfold](https://github.com/lpil))
···15581558 } => error
15591559 .iter()
15601560 .map(|error| match error {
15611561- TypeError::ErlangFloatUnsafe { location, .. } => Diagnostic {
15621562- title: "Float is outside Erlang's floating point range".into(),
15611561+ TypeError::LiteralFloatOutOfRange { location, .. } => Diagnostic {
15621562+ title: "Float outside of valid range".into(),
15631563 text: wrap(
15641564 "This float value is too large to be represented by \
15651565-Erlang's floating point type. To avoid this error float values must be in the range \
15661566--1.7976931348623157e308 - 1.7976931348623157e308.",
15651565+a floating point type: float values must be in the range -1.7976931348623157e308 \
15661566+- 1.7976931348623157e308.",
15671567 ),
15681568 hint: None,
15691569 level: Level::Error,
···99}
101011111212------ COMPILED JAVASCRIPT
1313-export function main(x) {
1414- return -Infinity / Infinity;
1515-}
1212+----- ERROR
1313+error: Float outside of valid range
1414+ ┌─ /src/one/two.gleam:3:3
1515+ │
1616+3 │ -100.001e123_456_789 /. 100.001e123_456_789
1717+ │ ^^^^^^^^^^^^^^^^^^^^
1818+1919+This float value is too large to be represented by a floating point type:
2020+float values must be in the range -1.7976931348623157e308 -
2121+1.7976931348623157e308.
2222+2323+error: Float outside of valid range
2424+ ┌─ /src/one/two.gleam:3:27
2525+ │
2626+3 │ -100.001e123_456_789 /. 100.001e123_456_789
2727+ │ ^^^^^^^^^^^^^^^^^^^
2828+2929+This float value is too large to be represented by a floating point type:
3030+float values must be in the range -1.7976931348623157e308 -
3131+1.7976931348623157e308.
···1212}
131314141515------ COMPILED JAVASCRIPT
1616-export function main(x) {
1717- if (x === Infinity) {
1818- return "bar";
1919- } else {
2020- return "foo";
2121- }
2222-}
1515+----- ERROR
1616+error: Float outside of valid range
1717+ ┌─ /src/one/two.gleam:4:3
1818+ │
1919+4 │ 100.001e123_456_789 -> "bar"
2020+ │ ^^^^^^^^^^^^^^^^^^^
2121+2222+This float value is too large to be represented by a floating point type:
2323+float values must be in the range -1.7976931348623157e308 -
2424+1.7976931348623157e308.
···66-1.8e308
7788----- ERROR
99-error: Float is outside Erlang's floating point range
99+error: Float outside of valid range
1010 ┌─ /src/one/two.gleam:1:1
1111 │
12121 │ -1.8e308
1313 │ ^^^^^^^^
14141515-This float value is too large to be represented by Erlang's floating point
1616-type. To avoid this error float values must be in the range
1717--1.7976931348623157e308 - 1.7976931348623157e308.
1515+This float value is too large to be represented by a floating point type:
1616+float values must be in the range -1.7976931348623157e308 -
1717+1.7976931348623157e308.
···66const x = -1.8e308
7788----- ERROR
99-error: Float is outside Erlang's floating point range
99+error: Float outside of valid range
1010 ┌─ /src/one/two.gleam:1:11
1111 │
12121 │ const x = -1.8e308
1313 │ ^^^^^^^^
14141515-This float value is too large to be represented by Erlang's floating point
1616-type. To avoid this error float values must be in the range
1717--1.7976931348623157e308 - 1.7976931348623157e308.
1515+This float value is too large to be represented by a floating point type:
1616+float values must be in the range -1.7976931348623157e308 -
1717+1.7976931348623157e308.
···22222323The name `y` is not in scope here.
24242525-error: Float is outside Erlang's floating point range
2525+error: Float outside of valid range
2626 ┌─ /src/one/two.gleam:1:13
2727 │
28281 │ let assert [-1.8e308, b] = [x, y]
2929 │ ^^^^^^^^
30303131-This float value is too large to be represented by Erlang's floating point
3232-type. To avoid this error float values must be in the range
3333--1.7976931348623157e308 - 1.7976931348623157e308.
3131+This float value is too large to be represented by a floating point type:
3232+float values must be in the range -1.7976931348623157e308 -
3333+1.7976931348623157e308.
···661.8e308
7788----- ERROR
99-error: Float is outside Erlang's floating point range
99+error: Float outside of valid range
1010 ┌─ /src/one/two.gleam:1:1
1111 │
12121 │ 1.8e308
1313 │ ^^^^^^^
14141515-This float value is too large to be represented by Erlang's floating point
1616-type. To avoid this error float values must be in the range
1717--1.7976931348623157e308 - 1.7976931348623157e308.
1515+This float value is too large to be represented by a floating point type:
1616+float values must be in the range -1.7976931348623157e308 -
1717+1.7976931348623157e308.
···66const x = 1.8e308
7788----- ERROR
99-error: Float is outside Erlang's floating point range
99+error: Float outside of valid range
1010 ┌─ /src/one/two.gleam:1:11
1111 │
12121 │ const x = 1.8e308
1313 │ ^^^^^^^
14141515-This float value is too large to be represented by Erlang's floating point
1616-type. To avoid this error float values must be in the range
1717--1.7976931348623157e308 - 1.7976931348623157e308.
1515+This float value is too large to be represented by a floating point type:
1616+float values must be in the range -1.7976931348623157e308 -
1717+1.7976931348623157e308.
···22222323The name `y` is not in scope here.
24242525-error: Float is outside Erlang's floating point range
2525+error: Float outside of valid range
2626 ┌─ /src/one/two.gleam:1:13
2727 │
28281 │ let assert [1.8e308, b] = [x, y]
2929 │ ^^^^^^^
30303131-This float value is too large to be represented by Erlang's floating point
3232-type. To avoid this error float values must be in the range
3333--1.7976931348623157e308 - 1.7976931348623157e308.
3131+This float value is too large to be represented by a floating point type:
3232+float values must be in the range -1.7976931348623157e308 -
3333+1.7976931348623157e308.