|
@@ -18,7 +18,7 @@ fn F() {
|
|
|
// CHECK:STDOUT: - { index: 2, kind: "Identifier", line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: "F", identifier: 0, has_leading_space: true }
|
|
// CHECK:STDOUT: - { index: 2, kind: "Identifier", line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: "F", identifier: 0, has_leading_space: true }
|
|
|
// CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 }
|
|
// CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 }
|
|
|
// CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 }
|
|
// CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 }
|
|
|
-// CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 58, has_leading_space: true }
|
|
|
|
|
|
|
+// CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 60, has_leading_space: true }
|
|
|
// 8 and 9 trigger special behavior in APInt when mishandling signed versus
|
|
// 8 and 9 trigger special behavior in APInt when mishandling signed versus
|
|
|
// unsigned, so we pay extra attention to those.
|
|
// unsigned, so we pay extra attention to those.
|
|
|
var ints: array(i32, 6) = (
|
|
var ints: array(i32, 6) = (
|
|
@@ -32,7 +32,7 @@ fn F() {
|
|
|
// CHECK:STDOUT: - { index: 13, kind: "IntLiteral", line: {{ *}}[[@LINE-8]], column: 24, indent: 3, spelling: "6", value: "6", has_leading_space: true }
|
|
// CHECK:STDOUT: - { index: 13, kind: "IntLiteral", line: {{ *}}[[@LINE-8]], column: 24, indent: 3, spelling: "6", value: "6", has_leading_space: true }
|
|
|
// CHECK:STDOUT: - { index: 14, kind: "CloseParen", line: {{ *}}[[@LINE-9]], column: 25, indent: 3, spelling: ")", opening_token: 10 }
|
|
// CHECK:STDOUT: - { index: 14, kind: "CloseParen", line: {{ *}}[[@LINE-9]], column: 25, indent: 3, spelling: ")", opening_token: 10 }
|
|
|
// CHECK:STDOUT: - { index: 15, kind: "Equal", line: {{ *}}[[@LINE-10]], column: 27, indent: 3, spelling: "=", has_leading_space: true }
|
|
// CHECK:STDOUT: - { index: 15, kind: "Equal", line: {{ *}}[[@LINE-10]], column: 27, indent: 3, spelling: "=", has_leading_space: true }
|
|
|
- // CHECK:STDOUT: - { index: 16, kind: "OpenParen", line: {{ *}}[[@LINE-11]], column: 29, indent: 3, spelling: "(", closing_token: 29, has_leading_space: true }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 16, kind: "OpenParen", line: {{ *}}[[@LINE-11]], column: 29, indent: 3, spelling: "(", closing_token: 31, has_leading_space: true }
|
|
|
8,
|
|
8,
|
|
|
// CHECK:STDOUT: - { index: 17, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "8", value: "8", has_leading_space: true }
|
|
// CHECK:STDOUT: - { index: 17, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "8", value: "8", has_leading_space: true }
|
|
|
// CHECK:STDOUT: - { index: 18, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 6, indent: 5, spelling: "," }
|
|
// CHECK:STDOUT: - { index: 18, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 6, indent: 5, spelling: "," }
|
|
@@ -45,66 +45,81 @@ fn F() {
|
|
|
0b1000,
|
|
0b1000,
|
|
|
// CHECK:STDOUT: - { index: 23, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "0b1000", value: "8", has_leading_space: true }
|
|
// CHECK:STDOUT: - { index: 23, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "0b1000", value: "8", has_leading_space: true }
|
|
|
// CHECK:STDOUT: - { index: 24, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: "," }
|
|
// CHECK:STDOUT: - { index: 24, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: "," }
|
|
|
|
|
+ 0o10,
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 25, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "0o10", value: "8", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 26, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 9, indent: 5, spelling: "," }
|
|
|
39999999999999999993,
|
|
39999999999999999993,
|
|
|
- // CHECK:STDOUT: - { index: 25, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "39999999999999999993", value: "39999999999999999993", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 26, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 25, indent: 5, spelling: "," }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 27, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "39999999999999999993", value: "39999999999999999993", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 28, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 25, indent: 5, spelling: "," }
|
|
|
12345678901234567890123456789012345678901234567890123456789,
|
|
12345678901234567890123456789012345678901234567890123456789,
|
|
|
- // CHECK:STDOUT: - { index: 27, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "12345678901234567890123456789012345678901234567890123456789", value: "12345678901234567890123456789012345678901234567890123456789", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 28, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 64, indent: 5, spelling: "," }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 29, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "12345678901234567890123456789012345678901234567890123456789", value: "12345678901234567890123456789012345678901234567890123456789", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 30, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 64, indent: 5, spelling: "," }
|
|
|
);
|
|
);
|
|
|
- // CHECK:STDOUT: - { index: 29, kind: "CloseParen", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: ")", opening_token: 16, has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 30, kind: "Semi", line: {{ *}}[[@LINE-2]], column: 4, indent: 3, spelling: ";" }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 31, kind: "CloseParen", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: ")", opening_token: 16, has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 32, kind: "Semi", line: {{ *}}[[@LINE-2]], column: 4, indent: 3, spelling: ";" }
|
|
|
var floats: array(f64, 7) = (
|
|
var floats: array(f64, 7) = (
|
|
|
- // CHECK:STDOUT: - { index: 31, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 32, kind: "Identifier", line: {{ *}}[[@LINE-2]], column: 7, indent: 3, spelling: "floats", identifier: 2, has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 33, kind: "Colon", line: {{ *}}[[@LINE-3]], column: 13, indent: 3, spelling: ":" }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 34, kind: "Array", line: {{ *}}[[@LINE-4]], column: 15, indent: 3, spelling: "array", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 35, kind: "OpenParen", line: {{ *}}[[@LINE-5]], column: 20, indent: 3, spelling: "(", closing_token: 39 }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 36, kind: "FloatTypeLiteral", line: {{ *}}[[@LINE-6]], column: 21, indent: 3, spelling: "f64" }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 37, kind: "Comma", line: {{ *}}[[@LINE-7]], column: 24, indent: 3, spelling: "," }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 38, kind: "IntLiteral", line: {{ *}}[[@LINE-8]], column: 26, indent: 3, spelling: "7", value: "7", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 39, kind: "CloseParen", line: {{ *}}[[@LINE-9]], column: 27, indent: 3, spelling: ")", opening_token: 35 }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 40, kind: "Equal", line: {{ *}}[[@LINE-10]], column: 29, indent: 3, spelling: "=", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 41, kind: "OpenParen", line: {{ *}}[[@LINE-11]], column: 31, indent: 3, spelling: "(", closing_token: 56, has_leading_space: true }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 33, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 34, kind: "Identifier", line: {{ *}}[[@LINE-2]], column: 7, indent: 3, spelling: "floats", identifier: 2, has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 35, kind: "Colon", line: {{ *}}[[@LINE-3]], column: 13, indent: 3, spelling: ":" }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 36, kind: "Array", line: {{ *}}[[@LINE-4]], column: 15, indent: 3, spelling: "array", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 37, kind: "OpenParen", line: {{ *}}[[@LINE-5]], column: 20, indent: 3, spelling: "(", closing_token: 41 }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 38, kind: "FloatTypeLiteral", line: {{ *}}[[@LINE-6]], column: 21, indent: 3, spelling: "f64" }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 39, kind: "Comma", line: {{ *}}[[@LINE-7]], column: 24, indent: 3, spelling: "," }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 40, kind: "IntLiteral", line: {{ *}}[[@LINE-8]], column: 26, indent: 3, spelling: "7", value: "7", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 41, kind: "CloseParen", line: {{ *}}[[@LINE-9]], column: 27, indent: 3, spelling: ")", opening_token: 37 }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 42, kind: "Equal", line: {{ *}}[[@LINE-10]], column: 29, indent: 3, spelling: "=", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 43, kind: "OpenParen", line: {{ *}}[[@LINE-11]], column: 31, indent: 3, spelling: "(", closing_token: 58, has_leading_space: true }
|
|
|
0.9,
|
|
0.9,
|
|
|
- // CHECK:STDOUT: - { index: 42, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "0.9", value: "9*10^-1", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 43, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: "," }
|
|
|
|
|
- 8.0,
|
|
|
|
|
- // CHECK:STDOUT: - { index: 44, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "8.0", value: "80*10^-1", has_leading_space: true }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 44, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "0.9", value: "9*10^-1", has_leading_space: true }
|
|
|
// CHECK:STDOUT: - { index: 45, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: "," }
|
|
// CHECK:STDOUT: - { index: 45, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: "," }
|
|
|
|
|
+ 8.0,
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 46, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "8.0", value: "80*10^-1", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 47, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 8, indent: 5, spelling: "," }
|
|
|
80.0,
|
|
80.0,
|
|
|
- // CHECK:STDOUT: - { index: 46, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "80.0", value: "800*10^-1", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 47, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 9, indent: 5, spelling: "," }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 48, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "80.0", value: "800*10^-1", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 49, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 9, indent: 5, spelling: "," }
|
|
|
1.0e7,
|
|
1.0e7,
|
|
|
- // CHECK:STDOUT: - { index: 48, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "1.0e7", value: "10*10^6", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 49, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 10, indent: 5, spelling: "," }
|
|
|
|
|
- 1.0e8,
|
|
|
|
|
- // CHECK:STDOUT: - { index: 50, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "1.0e8", value: "10*10^7", has_leading_space: true }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 50, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "1.0e7", value: "10*10^6", has_leading_space: true }
|
|
|
// CHECK:STDOUT: - { index: 51, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 10, indent: 5, spelling: "," }
|
|
// CHECK:STDOUT: - { index: 51, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 10, indent: 5, spelling: "," }
|
|
|
|
|
+ 1.0e8,
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 52, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "1.0e8", value: "10*10^7", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 53, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 10, indent: 5, spelling: "," }
|
|
|
1.0e-8,
|
|
1.0e-8,
|
|
|
- // CHECK:STDOUT: - { index: 52, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "1.0e-8", value: "10*10^-9", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 53, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: "," }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 54, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "1.0e-8", value: "10*10^-9", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 55, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: "," }
|
|
|
39999999999999999993.0e39999999999999999993,
|
|
39999999999999999993.0e39999999999999999993,
|
|
|
- // CHECK:STDOUT: - { index: 54, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "39999999999999999993.0e39999999999999999993", value: "399999999999999999930*10^39999999999999999992", has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 55, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 48, indent: 5, spelling: "," }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 56, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "39999999999999999993.0e39999999999999999993", value: "399999999999999999930*10^39999999999999999992", has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 57, kind: "Comma", line: {{ *}}[[@LINE-2]], column: 48, indent: 5, spelling: "," }
|
|
|
);
|
|
);
|
|
|
- // CHECK:STDOUT: - { index: 56, kind: "CloseParen", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: ")", opening_token: 41, has_leading_space: true }
|
|
|
|
|
- // CHECK:STDOUT: - { index: 57, kind: "Semi", line: {{ *}}[[@LINE-2]], column: 4, indent: 3, spelling: ";" }
|
|
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 58, kind: "CloseParen", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: ")", opening_token: 43, has_leading_space: true }
|
|
|
|
|
+ // CHECK:STDOUT: - { index: 59, kind: "Semi", line: {{ *}}[[@LINE-2]], column: 4, indent: 3, spelling: ";" }
|
|
|
}
|
|
}
|
|
|
-// CHECK:STDOUT: - { index: 58, kind: "CloseCurlyBrace", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "}", opening_token: 5, has_leading_space: true }
|
|
|
|
|
|
|
+// CHECK:STDOUT: - { index: 60, kind: "CloseCurlyBrace", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "}", opening_token: 5, has_leading_space: true }
|
|
|
|
|
|
|
|
|
|
|
|
|
// --- fail_binary_real.carbon
|
|
// --- fail_binary_real.carbon
|
|
|
// CHECK:STDOUT: - filename: fail_binary_real.carbon
|
|
// CHECK:STDOUT: - filename: fail_binary_real.carbon
|
|
|
// CHECK:STDOUT: tokens:
|
|
// CHECK:STDOUT: tokens:
|
|
|
|
|
|
|
|
-// CHECK:STDERR: fail_binary_real.carbon:[[@LINE+4]]:4: error: binary real number literals are not supported [BinaryRealLiteral]
|
|
|
|
|
|
|
+// CHECK:STDERR: fail_binary_real.carbon:[[@LINE+4]]:4: error: binary real number literals are not supported [InvalidRealLiteralRadix]
|
|
|
// CHECK:STDERR: 0b1.0
|
|
// CHECK:STDERR: 0b1.0
|
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR: ^
|
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR:
|
|
|
0b1.0
|
|
0b1.0
|
|
|
// CHECK:STDOUT: - { index: 1, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "0b1.0", value: "2*2^-1", has_leading_space: true }
|
|
// CHECK:STDOUT: - { index: 1, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "0b1.0", value: "2*2^-1", has_leading_space: true }
|
|
|
|
|
|
|
|
|
|
+// --- fail_octal_real.carbon
|
|
|
|
|
+// CHECK:STDOUT: - filename: fail_octal_real.carbon
|
|
|
|
|
+// CHECK:STDOUT: tokens:
|
|
|
|
|
+
|
|
|
|
|
+// CHECK:STDERR: fail_octal_real.carbon:[[@LINE+4]]:4: error: octal real number literals are not supported [InvalidRealLiteralRadix]
|
|
|
|
|
+// CHECK:STDERR: 0o1.0
|
|
|
|
|
+// CHECK:STDERR: ^
|
|
|
|
|
+// CHECK:STDERR:
|
|
|
|
|
+0o1.0
|
|
|
|
|
+// CHECK:STDOUT: - { index: 1, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "0o1.0", value: "8*2^-3", has_leading_space: true }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// --- fail_wrong_real_exponent.carbon
|
|
// --- fail_wrong_real_exponent.carbon
|
|
|
// CHECK:STDOUT: - filename: fail_wrong_real_exponent.carbon
|
|
// CHECK:STDOUT: - filename: fail_wrong_real_exponent.carbon
|
|
|
// CHECK:STDOUT: tokens:
|
|
// CHECK:STDOUT: tokens:
|