b9a42c82bc
* ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER * BODY_MIGHT_COMPLETE_NORMALLY_CATCH_ERROR * BODY_MIGHT_COMPLETE_NORMALLY_NULLABLE * DEPRECATED_EXTENDS_FUNCTION * DEPRECATED_IMPLEMENTS_FUNCTION * DEPRECATED_MIXIN_FUNCTION * DEPRECATED_NEW_IN_COMMENT_REFERENCE This requires allowing these warnings to be reported in language tests without being expected. Also, observatory now must comply with BODY_MIGHT_COMPLETE_NORMALLY_NULLABLE (or we could ignore the diagnostic). TESTED=unit tests Change-Id: I8facfa48a8645bac5bf8037163076a8f0a0ad05e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275740 Reviewed-by: Ben Konyi <bkonyi@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
115 lines
3.7 KiB
Dart
115 lines
3.7 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.
|
|
|
|
// @dart = 2.9
|
|
|
|
class Foo<X> {
|
|
const Foo();
|
|
const Foo.bar();
|
|
const Foo.baz();
|
|
}
|
|
|
|
main() {
|
|
new Foo();
|
|
new Foo.bar();
|
|
new Foo.bar.baz();
|
|
// ^^^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
|
|
// ^
|
|
// [cfe] Couldn't find constructor 'Foo.bar.baz'.
|
|
new Foo<int>();
|
|
new Foo<int>.bar();
|
|
new Foo<int>.bar.baz();
|
|
// ^^^
|
|
// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
|
|
// [cfe] Expected '(' after this.
|
|
// ^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
|
|
// [cfe] The method 'baz' isn't defined for the class 'Foo<int>'.
|
|
new Foo.bar<int>();
|
|
// ^
|
|
// [cfe] A constructor invocation can't have type arguments after the constructor name.
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
|
|
new Foo.bar<int>.baz();
|
|
// ^^^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
|
|
// ^
|
|
// [cfe] Couldn't find constructor 'Foo.bar.baz'.
|
|
new Foo.bar.baz<int>();
|
|
// ^^^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
|
|
// ^^^
|
|
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
|
|
// [cfe] A constructor invocation can't have type arguments after the constructor name.
|
|
// [cfe] Couldn't find constructor 'Foo.bar.baz'.
|
|
|
|
const Foo();
|
|
const Foo.bar();
|
|
const Foo.bar.baz();
|
|
// ^^^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
|
|
// ^
|
|
// [cfe] Couldn't find constructor 'Foo.bar.baz'.
|
|
const Foo<int>();
|
|
const Foo<int>.bar();
|
|
const Foo<int>.bar.baz();
|
|
// ^^^
|
|
// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
|
|
// [cfe] Expected '(' after this.
|
|
// ^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
|
|
// [cfe] The method 'baz' isn't defined for the class 'Foo<int>'.
|
|
const Foo.bar<int>();
|
|
// ^
|
|
// [cfe] A constructor invocation can't have type arguments after the constructor name.
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
|
|
const Foo.bar<int>.baz();
|
|
// ^^^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
|
|
// ^
|
|
// [cfe] Couldn't find constructor 'Foo.bar.baz'.
|
|
const Foo.bar.baz<int>();
|
|
// ^^^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.CREATION_WITH_NON_TYPE
|
|
// ^^^
|
|
// [analyzer] SYNTACTIC_ERROR.CONSTRUCTOR_WITH_TYPE_ARGUMENTS
|
|
// [cfe] A constructor invocation can't have type arguments after the constructor name.
|
|
// [cfe] Couldn't find constructor 'Foo.bar.baz'.
|
|
|
|
Foo();
|
|
Foo.bar();
|
|
Foo.bar.baz();
|
|
// ^
|
|
// [cfe] Member not found: 'bar'.
|
|
// ^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
|
|
Foo<int>();
|
|
Foo<int>.bar();
|
|
Foo<int>.bar.baz();
|
|
// ^^^^^
|
|
// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
|
|
// [cfe] The 'constructor-tearoffs' language feature is disabled for this library.
|
|
// ^
|
|
// [cfe] Member not found: 'bar'.
|
|
// ^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
|
|
Foo.bar<int>();
|
|
// ^
|
|
// [cfe] A constructor invocation can't have type arguments after the constructor name.
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
|
|
Foo.bar<int>.baz();
|
|
// ^
|
|
// [cfe] Couldn't find constructor 'bar'.
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
|
|
Foo.bar.baz<int>();
|
|
// ^
|
|
// [cfe] Member not found: 'bar'.
|
|
// ^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
|
|
}
|