Files
sdk/pkg/_fe_analyzer_shared/test/constants/data/basic.dart
T
Sam Rawlins 5e8ee77772 Support digit separators
Work towards https://github.com/dart-lang/language/issues/2

The feature is well-specified at the issue, but I will also follow
up with a specification to check into the language repo.

This change implements the feature more-or-less from front to back
(because the back is very close to the front in this case :P; no
"backend" work in the VM, etc). Digit separators are made available
via a new experiment, `digit-separators`.

Care is taken to report a single error when an underscore appears in
an unexpected position (see new `separators_error_test.dart`).

Three test files are added:

* `separators_test.dart` is run with the experiment enabled, and has
  no compile-time errors.
* `separators_error_test.dart` is run with the experiment enabled, and
  has many compile-time errors.
* `separators_error_no_experiment_test.dart` is run with the
  experiment _disabled_.

Change-Id: I7f1b1305d28b708b5ddf83f26188cd6e9ce3dd58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365181
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-07-09 14:50:59 +00:00

32 lines
1.0 KiB
Dart

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
const null0 = /*cfe.Null()*/ null;
const bool0 = /*cfe.Bool(true)*/ true;
const bool1 = /*cfe.Bool(false)*/ false;
const string0 = /*cfe.String(foo)*/ 'foo';
const int0 = /*cfe.Int(0)*/ 0;
const int1 = /*cfe.Int(1000000)*/ 1_000_000;
const double0 = /*cfe.Double(0.5)*/ 0.5;
const symbol0 = /*cfe.Symbol(foo)*/ #foo;
const symbol1 = const /*cfe.Symbol(foo)*/ Symbol('foo');
main() {
print(/*Null()*/ null0);
print(/*Bool(true)*/ bool0);
print(/*Bool(false)*/ bool1);
print(/*String(foo)*/ string0);
print(/*Int(0)*/ int0);
print(/*Int(1000000)*/ int1);
print(/*Double(0.5)*/ double0);
print(
/*cfe|analyzer.Symbol(foo)*/
/*dart2js.Instance(Symbol,{_name:String(foo))*/
symbol0);
print(
/*cfe|analyzer.Symbol(foo)*/
/*dart2js.Instance(Symbol,{_name:String(foo))*/
symbol1);
}