dart-sdk/tests/language_2/bad_constructor_test.dart
Dmitry Stefantsov 7d6cd21706 CFE and member conflict rules
See https://github.com/dart-lang/sdk/issues/32613
and https://github.com/dart-lang/sdk/issues/33235#issue-326617285

Bug: #32613, #33235, #33237
Change-Id: I0d1432185b6811137e31135ac2c7f58c4de2de6c
Reviewed-on: https://dart-review.googlesource.com/64500
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-07-16 14:09:01 +00:00

35 lines
696 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: compile-time 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();
}