Files
sdk/tests/language_2/bad_constructor_test.dart
T
Erik Ernst a58052974e Adjusted Dart.g to contain the grammar updates of language repo PR 293
This CL makes several adjustments to the spec_parser grammar Dart.g,
such that the spec_parser can parse the proposed NNBD constructs,
cf. language PR #293.

Change-Id: Ieec00259d73b6037d6a87d5c97cfac40186baef0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101500
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2019-08-14 08:17:54 +00:00

35 lines
690 B
Dart

// Copyright (c) 2012, 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.
// A constructor can't be static.
class A {
static //# 00: syntax error
A();
}
// A factory constructor can't be static.
class B {
static //# 01: syntax error
factory B() { return null; }
}
// A named constructor can have the same name as a setter.
class E {
set setter(value) {} //# 05: ok
E.setter();
}
// A constructor can't be static.
class F {
static //# 07: compile-time error
F(){}
}
main() {
new A();
new B();
new E.setter();
new F();
}