Files
sdk/tests/language_2/constructor_reference_test.dart
T
Aske Simon Christensen 35eacd1afc Type arguments to a constructor is an error.
Fixes https://github.com/dart-lang/sdk/issues/34159

Change-Id: Ib4cca43f4181f2557560fa45ca41dd059c8b5b06
Reviewed-on: https://dart-review.googlesource.com/71521
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>
2018-09-04 12:06:14 +00:00

42 lines
1.4 KiB
Dart

// Copyright (c) 2018, 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 Foo<X> {
const Foo();
const Foo.bar();
const Foo.baz();
}
main() {
new Foo(); //# 01: ok
new Foo.bar(); //# 02: ok
new Foo.bar.baz(); //# 03: compile-time error
new Foo<int>(); //# 04: ok
new Foo<int>.bar(); //# 05: ok
new Foo<int>.bar.baz(); //# 06: compile-time error
new Foo.bar<int>(); //# 07: compile-time error
new Foo.bar<int>.baz(); //# 08: compile-time error
new Foo.bar.baz<int>(); //# 09: compile-time error
const Foo(); //# 11: ok
const Foo.bar(); //# 12: ok
const Foo.bar.baz(); //# 13: compile-time error
const Foo<int>(); //# 14: ok
const Foo<int>.bar(); //# 15: ok
const Foo<int>.bar.baz(); //# 16: compile-time error
const Foo.bar<int>(); //# 17: compile-time error
const Foo.bar<int>.baz(); //# 18: compile-time error
const Foo.bar.baz<int>(); //# 19: compile-time error
Foo(); //# 21: ok
Foo.bar(); //# 22: ok
Foo.bar.baz(); //# 23: compile-time error
Foo<int>(); //# 24: ok
Foo<int>.bar(); //# 25: ok
Foo<int>.bar.baz(); //# 26: compile-time error
Foo.bar<int>(); //# 27: compile-time error
Foo.bar<int>.baz(); //# 28: compile-time error
Foo.bar.baz<int>(); //# 29: compile-time error
}