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
{{ message }}
Repository navigation
@inline integer constant outside the int32 range crashes the compiler #9299
An @inline integer constant outside the 32-bit range crashes the compiler instead of reporting an error.
@inlineletbig=10000000000letuse= () =>big
Fatal error: exception Failure("Int32.of_string")
The same happens in an interface:
@inline(10000000000)
letbig: int
Without @inline, let plain = 10000000000 compiles with warning 107 ("Integer literal exceeds the range of representable integers of type int").
The built-in PPX converts the literal with Int32.of_string and doesn't catch the failure: compiler/frontend/bs_builtin_ppx.ml lines 495 and 620 on master (9523348). PR #8728 moves this code to Ast_external_mk.inline_const_of_expression without changing it.
Probably the simplest fix: report an error at the literal, or warning 107 and fall back to an ordinary binding.
Activity