Files
sdk/tests/language/operator3_test.dart
T
kasperl@google.com 55140fd125 Remove support for operator negate and replace occurrences with unary
operator -.

In the VM, I have disabled the operator negate support in the parser but I
have not removed the keyword because the token is used in quite a few other
places.

R=ahe@google.com,iposva@google.com,hausner@google.com
BUG=

Review URL: https://chromiumcodereview.appspot.com//10911206

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12233 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-12 05:29:03 +00:00

19 lines
583 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.
class A {
operator -() => this;
toString() => "5";
abs() => "correct";
}
// This triggered a bug in Dart2Js: the speculative type optimization assigned
// type "number" to 'a' and then to '-a'. In the bailout version the type for
// 'a' was removed, but the type for '-a' was kept.
foo(a) => -(-a);
main() {
Expect.equals("correct", foo(new A()).abs());
}