mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 13:11:15 +00:00
2dcd56ef43
There are far too many files here to review everyone carefully. Spot checking most of the diffs look good as test code is generally written with less care than application code so lots of ugly formatting get through. If people notice files where the automated formatting bothers them feel free to comment indicating file names and I'll move spaces within comments to make the formatting cleaner and use comments to force block formatting as I have done for other case where formatting looked bad. BUG= R=efortuna@google.com Review-Url: https://codereview.chromium.org/2771453003 .
39 lines
889 B
Dart
39 lines
889 B
Dart
// Copyright (c) 2011, 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.
|
|
// Check that initializers of static const fields are compile time constants.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
class Point {
|
|
final x_;
|
|
final y_;
|
|
const Point(x, y)
|
|
: x_ = x,
|
|
y_ = y;
|
|
}
|
|
|
|
class ConstInitTest {
|
|
static const N = 1;
|
|
static const O = 1 + 3;
|
|
static const P = 2 * (O - N);
|
|
static const Q = const Point(0, 0);
|
|
|
|
static const Q2 = const Point(0, 0);
|
|
static const P2 = 2 * (O - N);
|
|
static const O2 = 1 + 3;
|
|
static const N2 = 1;
|
|
|
|
static testMain() {
|
|
Expect.equals(1, N);
|
|
Expect.equals(4, O);
|
|
Expect.equals(6, P);
|
|
Expect.equals(0, Q.x_);
|
|
Expect.equals(0, Q.y_);
|
|
}
|
|
}
|
|
|
|
main() {
|
|
ConstInitTest.testMain();
|
|
}
|