| // Copyright (c) 2021, 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. |
| |
| /// @assertion The constant-ness, identity and equality of the torn-off |
| /// constructor functions behave exactly the same as if they were tear-offs of |
| /// the corresponding static function. This means that a non-generic class |
| /// constructor always tears off to the same function value, as does an |
| /// uninstantiated tear off of a generic class constructor. |
| /// |
| /// @description Checks that a non-generic class constructor always tears off to |
| /// the same function value: test default constructor |
| /// @author iarkh@unipro.ru |
| |
| // SharedOptions=--enable-experiment=constructor-tearoffs |
| |
| import "../../Utils/expect.dart"; |
| |
| class C { |
| C() {} |
| } |
| |
| main() { |
| const v1 = C.new; |
| const v2 = C.new; |
| Expect.equals(v1, v2); |
| const CheckIdentical(v1, v2); |
| } |