40e18905f2
Closes https://github.com/dart-lang/sdk/pull/49478 TEST=Manual GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902 Reviewed-by: Michael Thomsen <mit@google.com> Commit-Queue: Alexander Thomas <athom@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com> Reviewed-by: Alexander Thomas <athom@google.com>
76 lines
2.5 KiB
Dart
76 lines
2.5 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.
|
|
|
|
// @dart = 2.9
|
|
|
|
// Tests that a dynamic type does not affect whether an expression is
|
|
// potentially constant, the actual type of the value of an expression
|
|
// only matters if the expression is evaluated as a constant.
|
|
|
|
main() {
|
|
Object c = C();
|
|
T.test01(c);
|
|
T.test02(c, c);
|
|
T.test03(c, c);
|
|
T.test04(c, c);
|
|
T.test05(c, c);
|
|
T.test06(c, c);
|
|
T.test07(c, c);
|
|
T.test08(c, c);
|
|
T.test09(c, c);
|
|
T.test11(c, c);
|
|
T.test12(c, c);
|
|
T.test13(c, c);
|
|
T.test14(c);
|
|
T.test15(c, c);
|
|
T.test16(c, c);
|
|
T.test17(c, c);
|
|
T.test18(c, c);
|
|
T.test19(c);
|
|
}
|
|
|
|
class T {
|
|
const T(Object o);
|
|
const T.test01(dynamic x) : this(-x);
|
|
const T.test02(dynamic x, dynamic y) : this(x + y);
|
|
const T.test03(dynamic x, dynamic y) : this(x - y);
|
|
const T.test04(dynamic x, dynamic y) : this(x * y);
|
|
const T.test05(dynamic x, dynamic y) : this(x / y);
|
|
const T.test06(dynamic x, dynamic y) : this(x ~/ y);
|
|
const T.test07(dynamic x, dynamic y) : this(x % y);
|
|
const T.test08(dynamic x, dynamic y) : this(x << y);
|
|
const T.test09(dynamic x, dynamic y) : this(x >> y);
|
|
const T.test11(dynamic x, dynamic y) : this(x & y);
|
|
const T.test12(dynamic x, dynamic y) : this(x | y);
|
|
const T.test13(dynamic x, dynamic y) : this(x ^ y);
|
|
const T.test14(dynamic x) : this(~x);
|
|
const T.test15(dynamic x, dynamic y) : this(x < y);
|
|
const T.test16(dynamic x, dynamic y) : this(x > y);
|
|
const T.test17(dynamic x, dynamic y) : this(x <= y);
|
|
const T.test18(dynamic x, dynamic y) : this(x >= y);
|
|
const T.test19(dynamic x) : this(x.length);
|
|
}
|
|
|
|
class C {
|
|
const C();
|
|
dynamic operator -() => this;
|
|
dynamic operator +(dynamic other) => this;
|
|
dynamic operator -(dynamic other) => this;
|
|
dynamic operator *(dynamic other) => this;
|
|
dynamic operator /(dynamic other) => this;
|
|
dynamic operator ~/(dynamic other) => this;
|
|
dynamic operator %(dynamic other) => this;
|
|
dynamic operator <<(dynamic other) => this;
|
|
dynamic operator >>(dynamic other) => this;
|
|
dynamic operator &(dynamic other) => this;
|
|
dynamic operator |(dynamic other) => this;
|
|
dynamic operator ^(dynamic other) => this;
|
|
dynamic operator ~() => this;
|
|
dynamic operator <(dynamic other) => this;
|
|
dynamic operator >(dynamic other) => this;
|
|
dynamic operator <=(dynamic other) => this;
|
|
dynamic operator >=(dynamic other) => this;
|
|
dynamic get length => this;
|
|
}
|