a1f4874a00
This CL implements type promotion logic for both `&&` and `||`; however, the logic for `||` has no effect, since `_factsWhenFalse` always returns the current facts. This is consistent with the current Dart specification (which only specifies type promotion for `&&`). Change-Id: I79f608aa33ea0501bb4bba303949330af2da4dda Reviewed-on: https://dart-review.googlesource.com/3345 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Dan Rubel <danrubel@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com>
22 lines
571 B
Dart
22 lines
571 B
Dart
// Copyright (c) 2017, 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.
|
|
|
|
/*@testedFeatures=inference*/
|
|
library test;
|
|
|
|
class A {
|
|
final String foo;
|
|
|
|
A(this.foo);
|
|
|
|
bool operator ==(Object other) =>
|
|
other is A && /*@promotedType=A*/ other
|
|
. /*@target=A::foo*/ foo /*@target=String::==*/ ==
|
|
this. /*@target=A::foo*/ foo;
|
|
}
|
|
|
|
main() {
|
|
print(new A("hello") /*@target=A::==*/ == new A("hello"));
|
|
}
|