-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
ocaml/testsuite/tests/typing-layouts/invalid_integer_literals.compilers.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
Line 6, characters 44-47: | ||
6 | let unboxed_integers_must_have_a_modifier = #42 | ||
^^^ | ||
Error: Syntax error: literal modifier expected. | ||
|
6 changes: 6 additions & 0 deletions
6
ocaml/testsuite/tests/typing-layouts/invalid_integer_literals.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(* TEST | ||
flags = "-extension layouts_alpha" | ||
* toplevel | ||
*) | ||
|
||
let unboxed_integers_must_have_a_modifier = #42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
(* TEST | ||
flags = "-extension layouts_alpha" | ||
* expect | ||
*) | ||
|
||
let e = #2.718281828459045 | ||
[%%expect{| | ||
val e : float = 2.71828182845904509 | ||
|}] | ||
|
||
let negative_one_half = -#0.5 | ||
[%%expect{| | ||
val negative_one_half : float = -0.5 | ||
|}] | ||
|
||
let positive_one_dot = +#1. | ||
[%%expect{| | ||
val positive_one_dot : float = 1. | ||
|}] | ||
|
||
let one_billion = #1e9 | ||
[%%expect{| | ||
val one_billion : float = 1000000000. | ||
|}] | ||
|
||
let zero = #0n | ||
[%%expect{| | ||
val zero : nativeint = 0n | ||
|}] | ||
|
||
let positive_one = +#1l | ||
[%%expect{| | ||
val positive_one : int32 = 1l | ||
|}] | ||
|
||
let negative_one = -#1L | ||
[%%expect{| | ||
val negative_one : int64 = -1L | ||
|}] | ||
|
||
let two_fifty_five_in_hex = #0xFFn | ||
[%%expect{| | ||
val two_fifty_five_in_hex : nativeint = 255n | ||
|}] | ||
|
||
let twenty_five_in_octal = #0o31l | ||
[%%expect{| | ||
val twenty_five_in_octal : int32 = 25l | ||
|}] | ||
|
||
let forty_two_in_binary = #0b101010L | ||
[%%expect{| | ||
val forty_two_in_binary : int64 = 42L | ||
|}] | ||
|
||
let one_twenty_seven_point_two_five_in_floating_hex = #0x7f.4 | ||
[%%expect{| | ||
val one_twenty_seven_point_two_five_in_floating_hex : float = 127.25 | ||
|}] | ||
|
||
let five_point_three_seven_five_in_floating_hexponent = #0xa.cp-1 | ||
[%%expect{| | ||
val five_point_three_seven_five_in_floating_hexponent : float = 5.375 | ||
|}] |