dart-sdk/tests/language_2/const_evaluation_test.dart
Jenny Messerly 3002e47e36 cleanup language_2 and corelib_2 tests that import dart:mirrors
Preserves tests that didn't really need mirrors, and moves tests for
mirror functionality into lib_2/mirrors tests.

Change-Id: Ie16dee1a4b508e3f14da53499f57c5dae2d1e513
Reviewed-on: https://dart-review.googlesource.com/49624
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-07 23:50:56 +00:00

45 lines
1.4 KiB
Dart

// Copyright (c) 2014, 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 compile-time evaluation of constants is consistent with runtime
// evaluation.
import 'package:expect/expect.dart';
const top_const = identical(-0.0, 0);
final top_final = identical(-0.0, 0);
var top_var = identical(-0.0, 0);
@top_const
class C {
static const static_const = identical(-0.0, 0);
static final static_final = identical(-0.0, 0);
static var static_var = identical(-0.0, 0);
final instance_final = identical(-0.0, 0);
var instance_var = identical(-0.0, 0);
void test() {
const local_const = identical(-0.0, 0);
final local_final = identical(-0.0, 0);
var local_var = identical(-0.0, 0);
Expect.equals(identical(-0.0, 0), top_const);
Expect.equals(top_const, top_final);
Expect.equals(top_final, top_var);
Expect.equals(top_var, static_const);
Expect.equals(static_const, static_final);
Expect.equals(static_final, static_var);
Expect.equals(static_var, instance_final);
Expect.equals(instance_final, instance_var);
Expect.equals(instance_var, local_const);
Expect.equals(local_const, local_final);
Expect.equals(local_final, local_var);
}
}
void main() {
new C().test();
}