Version 2.16.0-86.0.dev
Merge commit '7359264b1351a1567360dca4506945be0dae6453' into 'dev'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 79ffbe8..1b9b280 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,18 @@
error with an existing stack trace, instead of creating
a new stack trace.
+#### `dart:io`
+
+- **Breaking Change** [#47769](https://github.com/dart-lang/sdk/issues/47769):
+The `Platform.packageRoot` API has been removed. It had been marked deprecated
+in 2018, as it doesn't work with any Dart 2.x release.
+
+#### `dart:isolate`
+
+- **Breaking Change** [#47769](https://github.com/dart-lang/sdk/issues/47769):
+The `Isolate.packageRoot` API has been removed. It had been marked deprecated
+in 2018, as it doesn't work with any Dart 2.x release.
+
### Tools
#### Dart command line
diff --git a/DEPS b/DEPS
index cec2977..4925dd5 100644
--- a/DEPS
+++ b/DEPS
@@ -44,7 +44,7 @@
# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
# hashes. It requires access to the dart-build-access group, which EngProd
# has.
- "co19_rev": "4ef349830b971c22d8ddb2970c4ba9002806fd85",
+ "co19_rev": "a4144628905e0d3326b2549c9a1425bfca06c681",
# This line prevents conflicts when both packages are rolled simultaneously.
"co19_2_rev": "995745937abffe9fc3a6441f9f0db27b2d706e4c",
@@ -135,7 +135,7 @@
"package_config_rev": "fb736aa12316dd2d882b202a438a6946a4b4bea0",
"path_rev": "c20d73c3516d3a0061c90f14b761ff532b9bf707",
"pedantic_rev": "66f2f6c27581c7936482e83be80b27be2719901c",
- "platform_rev": "c20e6fa315e9f8820e51c0ae721f63aff33b8e17",
+ "platform_rev": "1ffad63428bbd1b3ecaa15926bacfb724023648c",
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
"pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae",
"process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b",
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart
index 07d1752..099319f 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart
@@ -451,7 +451,6 @@
bool looksLikeName(Token token) {
return token.kind == IDENTIFIER_TOKEN ||
optional('this', token) ||
- optional('super', token) ||
(token.isIdentifier &&
// Although `typedef` is a legal identifier,
// type `typedef` identifier is not legal and in this situation
@@ -795,9 +794,7 @@
if (optional('?', next)) {
next = next.next!;
}
- if (!(next.isIdentifier ||
- optional('this', next) ||
- optional('super', next))) {
+ if (!(next.isIdentifier || optional('this', next))) {
break; // `Function` used as the name in a function declaration.
}
}
diff --git a/pkg/analyzer/lib/src/lint/analysis.dart b/pkg/analyzer/lib/src/lint/analysis.dart
index 2e6974e..7eb9520 100644
--- a/pkg/analyzer/lib/src/lint/analysis.dart
+++ b/pkg/analyzer/lib/src/lint/analysis.dart
@@ -67,10 +67,6 @@
/// The path to a `.packages` configuration file
String? packageConfigPath;
- /// The path to the package root.
- @Deprecated('https://github.com/dart-lang/sdk/issues/41197')
- String? packageRootPath;
-
/// Whether to use Dart's Strong Mode analyzer.
bool strongMode = true;
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
index 7693ddd..e307a4f 100644
--- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -1192,7 +1192,6 @@
bool errorsAreFatal = true,
bool? checked,
Map<String, String>? environment,
- @deprecated Uri? packageRoot,
Uri? packageConfig,
bool automaticPackageResolution = false,
String? debugName,
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index 348bd17..a95e1f4 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -2152,6 +2152,7 @@
node, Getter_NodeReplacerTest_test_superConstructorInvocation_2());
}
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/47741')
void test_superFormalParameter() {
var findNode = _parseStringToFindNode(r'''
class A {
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index bdfa95c..6463ec1 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -119,764 +119,6 @@
''');
}
- test_class_alias() async {
- var library = await checkLibrary('''
-class C = D with E, F, G;
-class D {}
-class E {}
-class F {}
-class G {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class alias C @6
- supertype: D
- mixins
- E
- F
- G
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @32
- constructors
- synthetic @-1
- class E @43
- constructors
- synthetic @-1
- class F @54
- constructors
- synthetic @-1
- class G @65
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_abstract() async {
- var library = await checkLibrary('''
-abstract class C = D with E;
-class D {}
-class E {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- abstract class alias C @15
- supertype: D
- mixins
- E
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @35
- constructors
- synthetic @-1
- class E @46
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_documented() async {
- var library = await checkLibrary('''
-/**
- * Docs
- */
-class C = D with E;
-
-class D {}
-class E {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class alias C @22
- documentationComment: /**\n * Docs\n */
- supertype: D
- mixins
- E
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @43
- constructors
- synthetic @-1
- class E @54
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_documented_tripleSlash() async {
- var library = await checkLibrary('''
-/// aaa
-/// b
-/// cc
-class C = D with E;
-
-class D {}
-class E {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class alias C @27
- documentationComment: /// aaa\n/// b\n/// cc
- supertype: D
- mixins
- E
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @48
- constructors
- synthetic @-1
- class E @59
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_documented_withLeadingNonDocumentation() async {
- var library = await checkLibrary('''
-// Extra comment so doc comment offset != 0
-/**
- * Docs
- */
-class C = D with E;
-
-class D {}
-class E {}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class alias C @66
- documentationComment: /**\n * Docs\n */
- supertype: D
- mixins
- E
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @87
- constructors
- synthetic @-1
- class E @98
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_generic() async {
- var library = await checkLibrary('''
-class Z = A with B<int>, C<double>;
-class A {}
-class B<B1> {}
-class C<C1> {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class alias Z @6
- supertype: A
- mixins
- B<int>
- C<double>
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::A::@constructor::•
- superKeyword: super @0
- class A @42
- constructors
- synthetic @-1
- class B @53
- typeParameters
- covariant B1 @55
- defaultType: dynamic
- constructors
- synthetic @-1
- class C @68
- typeParameters
- covariant C1 @70
- defaultType: dynamic
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_notSimplyBounded_self() async {
- var library = await checkLibrary('''
-class C<T extends C> = D with E;
-class D {}
-class E {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- notSimplyBounded class alias C @6
- typeParameters
- covariant T @8
- bound: C<dynamic>
- defaultType: dynamic
- supertype: D
- mixins
- E
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @39
- constructors
- synthetic @-1
- class E @50
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_notSimplyBounded_simple_no_type_parameter_bound() async {
- // If no bounds are specified, then the class is simply bounded by syntax
- // alone, so there is no reason to assign it a slot.
- var library = await checkLibrary('''
-class C<T> = D with E;
-class D {}
-class E {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class alias C @6
- typeParameters
- covariant T @8
- defaultType: dynamic
- supertype: D
- mixins
- E
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @29
- constructors
- synthetic @-1
- class E @40
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_notSimplyBounded_simple_non_generic() async {
- // If no type parameters are specified, then the class is simply bounded, so
- // there is no reason to assign it a slot.
- var library = await checkLibrary('''
-class C = D with E;
-class D {}
-class E {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class alias C @6
- supertype: D
- mixins
- E
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @26
- constructors
- synthetic @-1
- class E @37
- constructors
- synthetic @-1
-''');
- }
-
- test_class_alias_with_const_constructors() async {
- testFile = convertPath('/home/test/lib/test.dart');
- addLibrarySource('/home/test/lib/a.dart', r'''
-class Base {
- const Base._priv();
- const Base();
- const Base.named();
-}
-''');
- var library = await checkLibrary('''
-import "a.dart";
-class M {}
-class MixinApp = Base with M;
-''');
- checkElementText(library, r'''
-library
- imports
- package:test/a.dart
- definingUnit
- classes
- class M @23
- constructors
- synthetic @-1
- class alias MixinApp @34
- supertype: Base
- mixins
- M
- constructors
- synthetic const @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: package:test/a.dart::@class::Base::@constructor::•
- superKeyword: super @0
- synthetic const named @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: package:test/a.dart::@class::Base::@constructor::named
- staticType: null
- token: named @-1
- period: . @0
- staticElement: package:test/a.dart::@class::Base::@constructor::named
- superKeyword: super @0
-''');
- }
-
- test_class_alias_with_forwarding_constructors() async {
- testFile = convertPath('/home/test/lib/test.dart');
- addLibrarySource('/home/test/lib/a.dart', r'''
-class Base {
- bool x = true;
- Base._priv();
- Base();
- Base.noArgs();
- Base.requiredArg(x);
- Base.positionalArg([bool x = true]);
- Base.positionalArg2([this.x = true]);
- Base.namedArg({int x = 42});
- Base.namedArg2({this.x = true});
- factory Base.fact() => Base();
- factory Base.fact2() = Base.noArgs;
-}
-''');
- var library = await checkLibrary('''
-import "a.dart";
-class M {}
-class MixinApp = Base with M;
-''');
- checkElementText(library, r'''
-library
- imports
- package:test/a.dart
- definingUnit
- classes
- class M @23
- constructors
- synthetic @-1
- class alias MixinApp @34
- supertype: Base
- mixins
- M
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: package:test/a.dart::@class::Base::@constructor::•
- superKeyword: super @0
- synthetic noArgs @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: package:test/a.dart::@class::Base::@constructor::noArgs
- staticType: null
- token: noArgs @-1
- period: . @0
- staticElement: package:test/a.dart::@class::Base::@constructor::noArgs
- superKeyword: super @0
- synthetic requiredArg @-1
- parameters
- requiredPositional x @-1
- type: dynamic
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- SimpleIdentifier
- staticElement: x@-1
- staticType: dynamic
- token: x @-1
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: package:test/a.dart::@class::Base::@constructor::requiredArg
- staticType: null
- token: requiredArg @-1
- period: . @0
- staticElement: package:test/a.dart::@class::Base::@constructor::requiredArg
- superKeyword: super @0
- synthetic positionalArg @-1
- parameters
- optionalPositional x @-1
- type: bool
- constantInitializer
- BooleanLiteral
- literal: true @127
- staticType: bool
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- SimpleIdentifier
- staticElement: x@-1
- staticType: bool
- token: x @-1
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: package:test/a.dart::@class::Base::@constructor::positionalArg
- staticType: null
- token: positionalArg @-1
- period: . @0
- staticElement: package:test/a.dart::@class::Base::@constructor::positionalArg
- superKeyword: super @0
- synthetic positionalArg2 @-1
- parameters
- optionalPositional final x @-1
- type: bool
- constantInitializer
- BooleanLiteral
- literal: true @167
- staticType: bool
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- SimpleIdentifier
- staticElement: x@-1
- staticType: bool
- token: x @-1
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: package:test/a.dart::@class::Base::@constructor::positionalArg2
- staticType: null
- token: positionalArg2 @-1
- period: . @0
- staticElement: package:test/a.dart::@class::Base::@constructor::positionalArg2
- superKeyword: super @0
- synthetic namedArg @-1
- parameters
- optionalNamed x @-1
- type: int
- constantInitializer
- IntegerLiteral
- literal: 42 @200
- staticType: int
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- SimpleIdentifier
- staticElement: x@-1
- staticType: int
- token: x @-1
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: package:test/a.dart::@class::Base::@constructor::namedArg
- staticType: null
- token: namedArg @-1
- period: . @0
- staticElement: package:test/a.dart::@class::Base::@constructor::namedArg
- superKeyword: super @0
- synthetic namedArg2 @-1
- parameters
- optionalNamed final x @-1
- type: bool
- constantInitializer
- BooleanLiteral
- literal: true @233
- staticType: bool
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- SimpleIdentifier
- staticElement: x@-1
- staticType: bool
- token: x @-1
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: package:test/a.dart::@class::Base::@constructor::namedArg2
- staticType: null
- token: namedArg2 @-1
- period: . @0
- staticElement: package:test/a.dart::@class::Base::@constructor::namedArg2
- superKeyword: super @0
-''');
- }
-
- test_class_alias_with_forwarding_constructors_type_substitution() async {
- var library = await checkLibrary('''
-class Base<T> {
- Base.ctor(T t, List<T> l);
-}
-class M {}
-class MixinApp = Base with M;
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class Base @6
- typeParameters
- covariant T @11
- defaultType: dynamic
- constructors
- ctor @23
- periodOffset: 22
- nameEnd: 27
- parameters
- requiredPositional t @30
- type: T
- requiredPositional l @41
- type: List<T>
- class M @53
- constructors
- synthetic @-1
- class alias MixinApp @64
- supertype: Base<dynamic>
- mixins
- M
- constructors
- synthetic ctor @-1
- parameters
- requiredPositional t @-1
- type: dynamic
- requiredPositional l @-1
- type: List<dynamic>
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- SimpleIdentifier
- staticElement: t@-1
- staticType: dynamic
- token: t @-1
- SimpleIdentifier
- staticElement: l@-1
- staticType: List<dynamic>
- token: l @-1
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: self::@class::Base::@constructor::ctor
- staticType: null
- token: ctor @-1
- period: . @0
- staticElement: self::@class::Base::@constructor::ctor
- superKeyword: super @0
-''');
- }
-
- test_class_alias_with_forwarding_constructors_type_substitution_complex() async {
- var library = await checkLibrary('''
-class Base<T> {
- Base.ctor(T t, List<T> l);
-}
-class M {}
-class MixinApp<U> = Base<List<U>> with M;
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class Base @6
- typeParameters
- covariant T @11
- defaultType: dynamic
- constructors
- ctor @23
- periodOffset: 22
- nameEnd: 27
- parameters
- requiredPositional t @30
- type: T
- requiredPositional l @41
- type: List<T>
- class M @53
- constructors
- synthetic @-1
- class alias MixinApp @64
- typeParameters
- covariant U @73
- defaultType: dynamic
- supertype: Base<List<U>>
- mixins
- M
- constructors
- synthetic ctor @-1
- parameters
- requiredPositional t @-1
- type: List<U>
- requiredPositional l @-1
- type: List<List<U>>
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- SimpleIdentifier
- staticElement: t@-1
- staticType: List<U>
- token: t @-1
- SimpleIdentifier
- staticElement: l@-1
- staticType: List<List<U>>
- token: l @-1
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- constructorName: SimpleIdentifier
- staticElement: self::@class::Base::@constructor::ctor
- staticType: null
- token: ctor @-1
- period: . @0
- staticElement: self::@class::Base::@constructor::ctor
- superKeyword: super @0
-''');
- }
-
- test_class_alias_with_mixin_members() async {
- var library = await checkLibrary('''
-class C = D with E;
-class D {}
-class E {
- int get a => null;
- void set b(int i) {}
- void f() {}
- int x;
-}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class alias C @6
- supertype: D
- mixins
- E
- constructors
- synthetic @-1
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @0
- rightParenthesis: ) @0
- staticElement: self::@class::D::@constructor::•
- superKeyword: super @0
- class D @26
- constructors
- synthetic @-1
- class E @37
- fields
- x @105
- type: int
- synthetic a @-1
- type: int
- synthetic b @-1
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get x @-1
- returnType: int
- synthetic set x @-1
- parameters
- requiredPositional _x @-1
- type: int
- returnType: void
- get a @51
- returnType: int
- set b @73
- parameters
- requiredPositional i @79
- type: int
- returnType: void
- methods
- f @92
- returnType: void
-''');
- }
-
test_class_constructor_const() async {
var library = await checkLibrary('class C { const C(); }');
checkElementText(library, r'''
@@ -901,6 +143,25 @@
''');
}
+ test_class_constructor_documented() async {
+ var library = await checkLibrary('''
+class C {
+ /**
+ * Docs
+ */
+ C();
+}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ @34
+ documentationComment: /**\n * Docs\n */
+''');
+ }
+
test_class_constructor_explicit_named() async {
var library = await checkLibrary('class C { C.foo(); }');
checkElementText(library, r'''
@@ -1492,6 +753,700 @@
''');
}
+ test_class_constructor_initializers_assertInvocation() async {
+ var library = await checkLibrary('''
+class C {
+ const C(int x) : assert(x >= 42);
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ const @18
+ parameters
+ requiredPositional x @24
+ type: int
+ constantInitializers
+ AssertInitializer
+ assertKeyword: assert @29
+ condition: BinaryExpression
+ leftOperand: SimpleIdentifier
+ staticElement: x@24
+ staticType: int
+ token: x @36
+ operator: >= @38
+ rightOperand: IntegerLiteral
+ literal: 42 @41
+ staticType: int
+ staticElement: dart:core::@class::num::@method::>=
+ staticInvokeType: bool Function(num)
+ staticType: bool
+ leftParenthesis: ( @35
+ rightParenthesis: ) @43
+''');
+ }
+
+ test_class_constructor_initializers_assertInvocation_message() async {
+ var library = await checkLibrary('''
+class C {
+ const C(int x) : assert(x >= 42, 'foo');
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ const @18
+ parameters
+ requiredPositional x @24
+ type: int
+ constantInitializers
+ AssertInitializer
+ assertKeyword: assert @29
+ condition: BinaryExpression
+ leftOperand: SimpleIdentifier
+ staticElement: x@24
+ staticType: int
+ token: x @36
+ operator: >= @38
+ rightOperand: IntegerLiteral
+ literal: 42 @41
+ staticType: int
+ staticElement: dart:core::@class::num::@method::>=
+ staticInvokeType: bool Function(num)
+ staticType: bool
+ leftParenthesis: ( @35
+ message: SimpleStringLiteral
+ literal: 'foo' @45
+ rightParenthesis: ) @50
+''');
+ }
+
+ test_class_constructor_initializers_field() async {
+ var library = await checkLibrary('''
+class C {
+ final x;
+ const C() : x = 42;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ final x @18
+ type: dynamic
+ constructors
+ const @29
+ constantInitializers
+ ConstructorFieldInitializer
+ equals: = @37
+ expression: IntegerLiteral
+ literal: 42 @39
+ staticType: int
+ fieldName: SimpleIdentifier
+ staticElement: self::@class::C::@field::x
+ staticType: null
+ token: x @35
+ accessors
+ synthetic get x @-1
+ returnType: dynamic
+''');
+ }
+
+ test_class_constructor_initializers_field_notConst() async {
+ var library = await checkLibrary('''
+class C {
+ final x;
+ const C() : x = foo();
+}
+int foo() => 42;
+''', allowErrors: true);
+ // It is OK to keep non-constant initializers.
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ final x @18
+ type: dynamic
+ constructors
+ const @29
+ constantInitializers
+ ConstructorFieldInitializer
+ equals: = @37
+ expression: MethodInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @42
+ rightParenthesis: ) @43
+ methodName: SimpleIdentifier
+ staticElement: self::@function::foo
+ staticType: int Function()
+ token: foo @39
+ staticInvokeType: int Function()
+ staticType: int
+ fieldName: SimpleIdentifier
+ staticElement: self::@class::C::@field::x
+ staticType: null
+ token: x @35
+ accessors
+ synthetic get x @-1
+ returnType: dynamic
+ functions
+ foo @52
+ returnType: int
+''');
+ }
+
+ test_class_constructor_initializers_field_optionalPositionalParameter() async {
+ var library = await checkLibrary('''
+class A {
+ final int _f;
+ const A([int f = 0]) : _f = f;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ fields
+ final _f @22
+ type: int
+ constructors
+ const @34
+ parameters
+ optionalPositional f @41
+ type: int
+ constantInitializer
+ IntegerLiteral
+ literal: 0 @45
+ staticType: int
+ constantInitializers
+ ConstructorFieldInitializer
+ equals: = @54
+ expression: SimpleIdentifier
+ staticElement: self::@class::A::@constructor::•::@parameter::f
+ staticType: int
+ token: f @56
+ fieldName: SimpleIdentifier
+ staticElement: self::@class::A::@field::_f
+ staticType: null
+ token: _f @51
+ accessors
+ synthetic get _f @-1
+ returnType: int
+''');
+ }
+
+ test_class_constructor_initializers_field_withParameter() async {
+ var library = await checkLibrary('''
+class C {
+ final x;
+ const C(int p) : x = 1 + p;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ final x @18
+ type: dynamic
+ constructors
+ const @29
+ parameters
+ requiredPositional p @35
+ type: int
+ constantInitializers
+ ConstructorFieldInitializer
+ equals: = @42
+ expression: BinaryExpression
+ leftOperand: IntegerLiteral
+ literal: 1 @44
+ staticType: int
+ operator: + @46
+ rightOperand: SimpleIdentifier
+ staticElement: p@35
+ staticType: int
+ token: p @48
+ staticElement: dart:core::@class::num::@method::+
+ staticInvokeType: num Function(num)
+ staticType: int
+ fieldName: SimpleIdentifier
+ staticElement: self::@class::C::@field::x
+ staticType: null
+ token: x @40
+ accessors
+ synthetic get x @-1
+ returnType: dynamic
+''');
+ }
+
+ test_class_constructor_initializers_genericFunctionType() async {
+ var library = await checkLibrary('''
+class A<T> {
+ const A();
+}
+class B {
+ const B(dynamic x);
+ const B.f()
+ : this(A<Function()>());
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ typeParameters
+ covariant T @8
+ defaultType: dynamic
+ constructors
+ const @21
+ class B @34
+ constructors
+ const @46
+ parameters
+ requiredPositional x @56
+ type: dynamic
+ const f @70
+ periodOffset: 69
+ nameEnd: 71
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ InstanceCreationExpression
+ argumentList: ArgumentList
+ leftParenthesis: ( @97
+ rightParenthesis: ) @98
+ constructorName: ConstructorName
+ staticElement: ConstructorMember
+ base: self::@class::A::@constructor::•
+ substitution: {T: dynamic Function()}
+ type: NamedType
+ name: SimpleIdentifier
+ staticElement: self::@class::A
+ staticType: null
+ token: A @84
+ type: A<dynamic Function()>
+ typeArguments: TypeArgumentList
+ arguments
+ GenericFunctionType
+ declaredElement: GenericFunctionTypeElement
+ parameters
+ returnType: dynamic
+ type: dynamic Function()
+ functionKeyword: Function @86
+ parameters: FormalParameterList
+ leftParenthesis: ( @94
+ rightParenthesis: ) @95
+ type: dynamic Function()
+ leftBracket: < @85
+ rightBracket: > @96
+ staticType: A<dynamic Function()>
+ leftParenthesis: ( @83
+ rightParenthesis: ) @99
+ staticElement: self::@class::B::@constructor::•
+ thisKeyword: this @79
+ redirectedConstructor: self::@class::B::@constructor::•
+''');
+ }
+
+ test_class_constructor_initializers_superInvocation_argumentContextType() async {
+ var library = await checkLibrary('''
+class A {
+ const A(List<String> values);
+}
+class B extends A {
+ const B() : super(const []);
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ constructors
+ const @18
+ parameters
+ requiredPositional values @33
+ type: List<String>
+ class B @50
+ supertype: A
+ constructors
+ const @72
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ ListLiteral
+ constKeyword: const @84
+ leftBracket: [ @90
+ rightBracket: ] @91
+ staticType: List<String>
+ leftParenthesis: ( @83
+ rightParenthesis: ) @92
+ staticElement: self::@class::A::@constructor::•
+ superKeyword: super @78
+''');
+ }
+
+ test_class_constructor_initializers_superInvocation_named() async {
+ var library = await checkLibrary('''
+class A {
+ const A.aaa(int p);
+}
+class C extends A {
+ const C() : super.aaa(42);
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ constructors
+ const aaa @20
+ periodOffset: 19
+ nameEnd: 23
+ parameters
+ requiredPositional p @28
+ type: int
+ class C @40
+ supertype: A
+ constructors
+ const @62
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ IntegerLiteral
+ literal: 42 @78
+ staticType: int
+ leftParenthesis: ( @77
+ rightParenthesis: ) @80
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::A::@constructor::aaa
+ staticType: null
+ token: aaa @74
+ period: . @73
+ staticElement: self::@class::A::@constructor::aaa
+ superKeyword: super @68
+''');
+ }
+
+ test_class_constructor_initializers_superInvocation_named_underscore() async {
+ var library = await checkLibrary('''
+class A {
+ const A._();
+}
+class B extends A {
+ const B() : super._();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ constructors
+ const _ @20
+ periodOffset: 19
+ nameEnd: 21
+ class B @33
+ supertype: A
+ constructors
+ const @55
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @68
+ rightParenthesis: ) @69
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::A::@constructor::_
+ staticType: null
+ token: _ @67
+ period: . @66
+ staticElement: self::@class::A::@constructor::_
+ superKeyword: super @61
+''');
+ }
+
+ test_class_constructor_initializers_superInvocation_namedExpression() async {
+ var library = await checkLibrary('''
+class A {
+ const A.aaa(a, {int b});
+}
+class C extends A {
+ const C() : super.aaa(1, b: 2);
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ constructors
+ const aaa @20
+ periodOffset: 19
+ nameEnd: 23
+ parameters
+ requiredPositional a @24
+ type: dynamic
+ optionalNamed b @32
+ type: int
+ class C @45
+ supertype: A
+ constructors
+ const @67
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ IntegerLiteral
+ literal: 1 @83
+ staticType: int
+ NamedExpression
+ name: Label
+ label: SimpleIdentifier
+ staticElement: self::@class::A::@constructor::aaa::@parameter::b
+ staticType: null
+ token: b @86
+ expression: IntegerLiteral
+ literal: 2 @89
+ staticType: int
+ leftParenthesis: ( @82
+ rightParenthesis: ) @90
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::A::@constructor::aaa
+ staticType: null
+ token: aaa @79
+ period: . @78
+ staticElement: self::@class::A::@constructor::aaa
+ superKeyword: super @73
+''');
+ }
+
+ test_class_constructor_initializers_superInvocation_unnamed() async {
+ var library = await checkLibrary('''
+class A {
+ const A(int p);
+}
+class C extends A {
+ const C.ccc() : super(42);
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ constructors
+ const @18
+ parameters
+ requiredPositional p @24
+ type: int
+ class C @36
+ supertype: A
+ constructors
+ const ccc @60
+ periodOffset: 59
+ nameEnd: 63
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ IntegerLiteral
+ literal: 42 @74
+ staticType: int
+ leftParenthesis: ( @73
+ rightParenthesis: ) @76
+ staticElement: self::@class::A::@constructor::•
+ superKeyword: super @68
+''');
+ }
+
+ test_class_constructor_initializers_thisInvocation_argumentContextType() async {
+ var library = await checkLibrary('''
+class A {
+ const A(List<String> values);
+ const A.empty() : this(const []);
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ constructors
+ const @18
+ parameters
+ requiredPositional values @33
+ type: List<String>
+ const empty @52
+ periodOffset: 51
+ nameEnd: 57
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ ListLiteral
+ constKeyword: const @67
+ leftBracket: [ @73
+ rightBracket: ] @74
+ staticType: List<String>
+ leftParenthesis: ( @66
+ rightParenthesis: ) @75
+ staticElement: self::@class::A::@constructor::•
+ thisKeyword: this @62
+ redirectedConstructor: self::@class::A::@constructor::•
+''');
+ }
+
+ test_class_constructor_initializers_thisInvocation_named() async {
+ var library = await checkLibrary('''
+class C {
+ const C() : this.named(1, 'bbb');
+ const C.named(int a, String b);
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ const @18
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ IntegerLiteral
+ literal: 1 @35
+ staticType: int
+ SimpleStringLiteral
+ literal: 'bbb' @38
+ leftParenthesis: ( @34
+ rightParenthesis: ) @43
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::C::@constructor::named
+ staticType: null
+ token: named @29
+ period: . @28
+ staticElement: self::@class::C::@constructor::named
+ thisKeyword: this @24
+ redirectedConstructor: self::@class::C::@constructor::named
+ const named @56
+ periodOffset: 55
+ nameEnd: 61
+ parameters
+ requiredPositional a @66
+ type: int
+ requiredPositional b @76
+ type: String
+''');
+ }
+
+ test_class_constructor_initializers_thisInvocation_namedExpression() async {
+ var library = await checkLibrary('''
+class C {
+ const C() : this.named(1, b: 2);
+ const C.named(a, {int b});
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ const @18
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ IntegerLiteral
+ literal: 1 @35
+ staticType: int
+ NamedExpression
+ name: Label
+ label: SimpleIdentifier
+ staticElement: self::@class::C::@constructor::named::@parameter::b
+ staticType: null
+ token: b @38
+ expression: IntegerLiteral
+ literal: 2 @41
+ staticType: int
+ leftParenthesis: ( @34
+ rightParenthesis: ) @42
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::C::@constructor::named
+ staticType: null
+ token: named @29
+ period: . @28
+ staticElement: self::@class::C::@constructor::named
+ thisKeyword: this @24
+ redirectedConstructor: self::@class::C::@constructor::named
+ const named @55
+ periodOffset: 54
+ nameEnd: 60
+ parameters
+ requiredPositional a @61
+ type: dynamic
+ optionalNamed b @69
+ type: int
+''');
+ }
+
+ test_class_constructor_initializers_thisInvocation_unnamed() async {
+ var library = await checkLibrary('''
+class C {
+ const C.named() : this(1, 'bbb');
+ const C(int a, String b);
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ const named @20
+ periodOffset: 19
+ nameEnd: 25
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ IntegerLiteral
+ literal: 1 @35
+ staticType: int
+ SimpleStringLiteral
+ literal: 'bbb' @38
+ leftParenthesis: ( @34
+ rightParenthesis: ) @43
+ staticElement: self::@class::C::@constructor::•
+ thisKeyword: this @30
+ redirectedConstructor: self::@class::C::@constructor::•
+ const @54
+ parameters
+ requiredPositional a @60
+ type: int
+ requiredPositional b @70
+ type: String
+''');
+ }
+
test_class_constructor_params() async {
var library = await checkLibrary('class C { C(x, int y); }');
checkElementText(library, r'''
@@ -1509,6 +1464,843 @@
''');
}
+ test_class_constructor_redirected_factory_named() async {
+ var library = await checkLibrary('''
+class C {
+ factory C() = D.named;
+ C._();
+}
+class D extends C {
+ D.named() : super._();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ factory @20
+ redirectedConstructor: self::@class::D::@constructor::named
+ _ @39
+ periodOffset: 38
+ nameEnd: 40
+ class D @52
+ supertype: C
+ constructors
+ named @70
+ periodOffset: 69
+ nameEnd: 75
+''');
+ }
+
+ test_class_constructor_redirected_factory_named_generic() async {
+ var library = await checkLibrary('''
+class C<T, U> {
+ factory C() = D<U, T>.named;
+ C._();
+}
+class D<T, U> extends C<U, T> {
+ D.named() : super._();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ typeParameters
+ covariant T @8
+ defaultType: dynamic
+ covariant U @11
+ defaultType: dynamic
+ constructors
+ factory @26
+ redirectedConstructor: ConstructorMember
+ base: self::@class::D::@constructor::named
+ substitution: {T: U, U: T}
+ _ @51
+ periodOffset: 50
+ nameEnd: 52
+ class D @64
+ typeParameters
+ covariant T @66
+ defaultType: dynamic
+ covariant U @69
+ defaultType: dynamic
+ supertype: C<U, T>
+ constructors
+ named @94
+ periodOffset: 93
+ nameEnd: 99
+''');
+ }
+
+ test_class_constructor_redirected_factory_named_generic_viaTypeAlias() async {
+ var library = await checkLibrary('''
+typedef A<T, U> = C<T, U>;
+class B<T, U> {
+ factory B() = A<U, T>.named;
+ B._();
+}
+class C<T, U> extends A<U, T> {
+ C.named() : super._();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class B @33
+ typeParameters
+ covariant T @35
+ defaultType: dynamic
+ covariant U @38
+ defaultType: dynamic
+ constructors
+ factory @53
+ redirectedConstructor: ConstructorMember
+ base: self::@class::C::@constructor::named
+ substitution: {T: U, U: T}
+ _ @78
+ periodOffset: 77
+ nameEnd: 79
+ class C @91
+ typeParameters
+ covariant T @93
+ defaultType: dynamic
+ covariant U @96
+ defaultType: dynamic
+ supertype: C<U, T>
+ aliasElement: self::@typeAlias::A
+ aliasArguments
+ U
+ T
+ constructors
+ named @121
+ periodOffset: 120
+ nameEnd: 126
+ typeAliases
+ A @8
+ typeParameters
+ covariant T @10
+ defaultType: dynamic
+ covariant U @13
+ defaultType: dynamic
+ aliasedType: C<T, U>
+''');
+ }
+
+ test_class_constructor_redirected_factory_named_imported() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+class D extends C {
+ D.named() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart';
+class C {
+ factory C() = D.named;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart
+ definingUnit
+ classes
+ class C @25
+ constructors
+ factory @39
+ redirectedConstructor: foo.dart::@class::D::@constructor::named
+ _ @58
+ periodOffset: 57
+ nameEnd: 59
+''');
+ }
+
+ test_class_constructor_redirected_factory_named_imported_generic() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+class D<T, U> extends C<U, T> {
+ D.named() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart';
+class C<T, U> {
+ factory C() = D<U, T>.named;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart
+ definingUnit
+ classes
+ class C @25
+ typeParameters
+ covariant T @27
+ defaultType: dynamic
+ covariant U @30
+ defaultType: dynamic
+ constructors
+ factory @45
+ redirectedConstructor: ConstructorMember
+ base: foo.dart::@class::D::@constructor::named
+ substitution: {T: U, U: T}
+ _ @70
+ periodOffset: 69
+ nameEnd: 71
+''');
+ }
+
+ test_class_constructor_redirected_factory_named_prefixed() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+class D extends C {
+ D.named() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart' as foo;
+class C {
+ factory C() = foo.D.named;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart as foo @21
+ definingUnit
+ classes
+ class C @32
+ constructors
+ factory @46
+ redirectedConstructor: foo.dart::@class::D::@constructor::named
+ _ @69
+ periodOffset: 68
+ nameEnd: 70
+''');
+ }
+
+ test_class_constructor_redirected_factory_named_prefixed_generic() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+class D<T, U> extends C<U, T> {
+ D.named() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart' as foo;
+class C<T, U> {
+ factory C() = foo.D<U, T>.named;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart as foo @21
+ definingUnit
+ classes
+ class C @32
+ typeParameters
+ covariant T @34
+ defaultType: dynamic
+ covariant U @37
+ defaultType: dynamic
+ constructors
+ factory @52
+ redirectedConstructor: ConstructorMember
+ base: foo.dart::@class::D::@constructor::named
+ substitution: {T: U, U: T}
+ _ @81
+ periodOffset: 80
+ nameEnd: 82
+''');
+ }
+
+ test_class_constructor_redirected_factory_named_unresolved_class() async {
+ var library = await checkLibrary('''
+class C<E> {
+ factory C() = D.named<E>;
+}
+''', allowErrors: true);
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ typeParameters
+ covariant E @8
+ defaultType: dynamic
+ constructors
+ factory @23
+''');
+ }
+
+ test_class_constructor_redirected_factory_named_unresolved_constructor() async {
+ var library = await checkLibrary('''
+class D {}
+class C<E> {
+ factory C() = D.named<E>;
+}
+''', allowErrors: true);
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class D @6
+ constructors
+ synthetic @-1
+ class C @17
+ typeParameters
+ covariant E @19
+ defaultType: dynamic
+ constructors
+ factory @34
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed() async {
+ var library = await checkLibrary('''
+class C {
+ factory C() = D;
+ C._();
+}
+class D extends C {
+ D() : super._();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ factory @20
+ redirectedConstructor: self::@class::D::@constructor::•
+ _ @33
+ periodOffset: 32
+ nameEnd: 34
+ class D @46
+ supertype: C
+ constructors
+ @62
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_generic() async {
+ var library = await checkLibrary('''
+class C<T, U> {
+ factory C() = D<U, T>;
+ C._();
+}
+class D<T, U> extends C<U, T> {
+ D() : super._();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ typeParameters
+ covariant T @8
+ defaultType: dynamic
+ covariant U @11
+ defaultType: dynamic
+ constructors
+ factory @26
+ redirectedConstructor: ConstructorMember
+ base: self::@class::D::@constructor::•
+ substitution: {T: U, U: T}
+ _ @45
+ periodOffset: 44
+ nameEnd: 46
+ class D @58
+ typeParameters
+ covariant T @60
+ defaultType: dynamic
+ covariant U @63
+ defaultType: dynamic
+ supertype: C<U, T>
+ constructors
+ @86
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_generic_viaTypeAlias() async {
+ var library = await checkLibrary('''
+typedef A<T, U> = C<T, U>;
+class B<T, U> {
+ factory B() = A<U, T>;
+ B_();
+}
+class C<T, U> extends B<U, T> {
+ C() : super._();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class B @33
+ typeParameters
+ covariant T @35
+ defaultType: dynamic
+ covariant U @38
+ defaultType: dynamic
+ constructors
+ factory @53
+ redirectedConstructor: ConstructorMember
+ base: self::@class::C::@constructor::•
+ substitution: {T: U, U: T}
+ methods
+ abstract B_ @70
+ returnType: dynamic
+ class C @84
+ typeParameters
+ covariant T @86
+ defaultType: dynamic
+ covariant U @89
+ defaultType: dynamic
+ supertype: B<U, T>
+ constructors
+ @112
+ typeAliases
+ A @8
+ typeParameters
+ covariant T @10
+ defaultType: dynamic
+ covariant U @13
+ defaultType: dynamic
+ aliasedType: C<T, U>
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_imported() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+class D extends C {
+ D() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart';
+class C {
+ factory C() = D;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart
+ definingUnit
+ classes
+ class C @25
+ constructors
+ factory @39
+ redirectedConstructor: foo.dart::@class::D::@constructor::•
+ _ @52
+ periodOffset: 51
+ nameEnd: 53
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_imported_generic() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+class D<T, U> extends C<U, T> {
+ D() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart';
+class C<T, U> {
+ factory C() = D<U, T>;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart
+ definingUnit
+ classes
+ class C @25
+ typeParameters
+ covariant T @27
+ defaultType: dynamic
+ covariant U @30
+ defaultType: dynamic
+ constructors
+ factory @45
+ redirectedConstructor: ConstructorMember
+ base: foo.dart::@class::D::@constructor::•
+ substitution: {T: U, U: T}
+ _ @64
+ periodOffset: 63
+ nameEnd: 65
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_imported_viaTypeAlias() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+typedef A = B;
+class B extends C {
+ B() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart';
+class C {
+ factory C() = A;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart
+ definingUnit
+ classes
+ class C @25
+ constructors
+ factory @39
+ redirectedConstructor: foo.dart::@class::B::@constructor::•
+ _ @52
+ periodOffset: 51
+ nameEnd: 53
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_prefixed() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+class D extends C {
+ D() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart' as foo;
+class C {
+ factory C() = foo.D;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart as foo @21
+ definingUnit
+ classes
+ class C @32
+ constructors
+ factory @46
+ redirectedConstructor: foo.dart::@class::D::@constructor::•
+ _ @63
+ periodOffset: 62
+ nameEnd: 64
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_prefixed_generic() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+class D<T, U> extends C<U, T> {
+ D() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart' as foo;
+class C<T, U> {
+ factory C() = foo.D<U, T>;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart as foo @21
+ definingUnit
+ classes
+ class C @32
+ typeParameters
+ covariant T @34
+ defaultType: dynamic
+ covariant U @37
+ defaultType: dynamic
+ constructors
+ factory @52
+ redirectedConstructor: ConstructorMember
+ base: foo.dart::@class::D::@constructor::•
+ substitution: {T: U, U: T}
+ _ @75
+ periodOffset: 74
+ nameEnd: 76
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_prefixed_viaTypeAlias() async {
+ addLibrarySource('/foo.dart', '''
+import 'test.dart';
+typedef A = B;
+class B extends C {
+ B() : super._();
+}
+''');
+ var library = await checkLibrary('''
+import 'foo.dart' as foo;
+class C {
+ factory C() = foo.A;
+ C._();
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ foo.dart as foo @21
+ definingUnit
+ classes
+ class C @32
+ constructors
+ factory @46
+ redirectedConstructor: foo.dart::@class::B::@constructor::•
+ _ @63
+ periodOffset: 62
+ nameEnd: 64
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_unresolved() async {
+ var library = await checkLibrary('''
+class C<E> {
+ factory C() = D<E>;
+}
+''', allowErrors: true);
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ typeParameters
+ covariant E @8
+ defaultType: dynamic
+ constructors
+ factory @23
+''');
+ }
+
+ test_class_constructor_redirected_factory_unnamed_viaTypeAlias() async {
+ var library = await checkLibrary('''
+typedef A = C;
+class B {
+ factory B() = A;
+ B._();
+}
+class C extends B {
+ C() : super._();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class B @21
+ constructors
+ factory @35
+ redirectedConstructor: self::@class::C::@constructor::•
+ _ @48
+ periodOffset: 47
+ nameEnd: 49
+ class C @61
+ supertype: B
+ constructors
+ @77
+ typeAliases
+ A @8
+ aliasedType: C
+''');
+ }
+
+ test_class_constructor_redirected_thisInvocation_named() async {
+ var library = await checkLibrary('''
+class C {
+ const C.named();
+ const C() : this.named();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ const named @20
+ periodOffset: 19
+ nameEnd: 25
+ const @37
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @53
+ rightParenthesis: ) @54
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::C::@constructor::named
+ staticType: null
+ token: named @48
+ period: . @47
+ staticElement: self::@class::C::@constructor::named
+ thisKeyword: this @43
+ redirectedConstructor: self::@class::C::@constructor::named
+''');
+ }
+
+ test_class_constructor_redirected_thisInvocation_named_generic() async {
+ var library = await checkLibrary('''
+class C<T> {
+ const C.named();
+ const C() : this.named();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ typeParameters
+ covariant T @8
+ defaultType: dynamic
+ constructors
+ const named @23
+ periodOffset: 22
+ nameEnd: 28
+ const @40
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @56
+ rightParenthesis: ) @57
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::C::@constructor::named
+ staticType: null
+ token: named @51
+ period: . @50
+ staticElement: self::@class::C::@constructor::named
+ thisKeyword: this @46
+ redirectedConstructor: self::@class::C::@constructor::named
+''');
+ }
+
+ test_class_constructor_redirected_thisInvocation_named_notConst() async {
+ var library = await checkLibrary('''
+class C {
+ C.named();
+ C() : this.named();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ named @14
+ periodOffset: 13
+ nameEnd: 19
+ @25
+ redirectedConstructor: self::@class::C::@constructor::named
+''');
+ }
+
+ test_class_constructor_redirected_thisInvocation_unnamed() async {
+ var library = await checkLibrary('''
+class C {
+ const C();
+ const C.named() : this();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ const @18
+ const named @33
+ periodOffset: 32
+ nameEnd: 38
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @47
+ rightParenthesis: ) @48
+ staticElement: self::@class::C::@constructor::•
+ thisKeyword: this @43
+ redirectedConstructor: self::@class::C::@constructor::•
+''');
+ }
+
+ test_class_constructor_redirected_thisInvocation_unnamed_generic() async {
+ var library = await checkLibrary('''
+class C<T> {
+ const C();
+ const C.named() : this();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ typeParameters
+ covariant T @8
+ defaultType: dynamic
+ constructors
+ const @21
+ const named @36
+ periodOffset: 35
+ nameEnd: 41
+ constantInitializers
+ RedirectingConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @50
+ rightParenthesis: ) @51
+ staticElement: self::@class::C::@constructor::•
+ thisKeyword: this @46
+ redirectedConstructor: self::@class::C::@constructor::•
+''');
+ }
+
+ test_class_constructor_redirected_thisInvocation_unnamed_notConst() async {
+ var library = await checkLibrary('''
+class C {
+ C();
+ C.named() : this();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ @12
+ named @21
+ periodOffset: 20
+ nameEnd: 26
+ redirectedConstructor: self::@class::C::@constructor::•
+''');
+ }
+
test_class_constructor_unnamed_implicit() async {
var library = await checkLibrary('class C {}');
checkElementText(
@@ -1525,6 +2317,120 @@
withDisplayName: true);
}
+ test_class_constructor_withCycles_const() async {
+ var library = await checkLibrary('''
+class C {
+ final x;
+ const C() : x = const D();
+}
+class D {
+ final x;
+ const D() : x = const C();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ final x @18
+ type: dynamic
+ constructors
+ const @29
+ constantInitializers
+ ConstructorFieldInitializer
+ equals: = @37
+ expression: InstanceCreationExpression
+ argumentList: ArgumentList
+ leftParenthesis: ( @46
+ rightParenthesis: ) @47
+ constructorName: ConstructorName
+ staticElement: self::@class::D::@constructor::•
+ type: NamedType
+ name: SimpleIdentifier
+ staticElement: self::@class::D
+ staticType: null
+ token: D @45
+ type: D
+ keyword: const @39
+ staticType: D
+ fieldName: SimpleIdentifier
+ staticElement: self::@class::C::@field::x
+ staticType: null
+ token: x @35
+ accessors
+ synthetic get x @-1
+ returnType: dynamic
+ class D @58
+ fields
+ final x @70
+ type: dynamic
+ constructors
+ const @81
+ constantInitializers
+ ConstructorFieldInitializer
+ equals: = @89
+ expression: InstanceCreationExpression
+ argumentList: ArgumentList
+ leftParenthesis: ( @98
+ rightParenthesis: ) @99
+ constructorName: ConstructorName
+ staticElement: self::@class::C::@constructor::•
+ type: NamedType
+ name: SimpleIdentifier
+ staticElement: self::@class::C
+ staticType: null
+ token: C @97
+ type: C
+ keyword: const @91
+ staticType: C
+ fieldName: SimpleIdentifier
+ staticElement: self::@class::D::@field::x
+ staticType: null
+ token: x @87
+ accessors
+ synthetic get x @-1
+ returnType: dynamic
+''');
+ }
+
+ test_class_constructor_withCycles_nonConst() async {
+ var library = await checkLibrary('''
+class C {
+ final x;
+ C() : x = new D();
+}
+class D {
+ final x;
+ D() : x = new C();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ final x @18
+ type: dynamic
+ constructors
+ @23
+ accessors
+ synthetic get x @-1
+ returnType: dynamic
+ class D @50
+ fields
+ final x @62
+ type: dynamic
+ constructors
+ @67
+ accessors
+ synthetic get x @-1
+ returnType: dynamic
+''');
+ }
+
test_class_constructors_named() async {
var library = await checkLibrary('''
class C {
@@ -1873,6 +2779,33 @@
''');
}
+ test_class_field_abstract() async {
+ var library = await checkLibrary('''
+abstract class C {
+ abstract int i;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ abstract class C @15
+ fields
+ abstract i @34
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic abstract get i @-1
+ returnType: int
+ synthetic abstract set i @-1
+ parameters
+ requiredPositional _i @-1
+ type: int
+ returnType: void
+''');
+ }
+
test_class_field_const() async {
var library = await checkLibrary('class C { static const int i = 0; }');
checkElementText(library, r'''
@@ -1918,6 +2851,224 @@
''');
}
+ test_class_field_covariant() async {
+ var library = await checkLibrary('''
+class C {
+ covariant int x;
+}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ covariant x @26
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get x @-1
+ returnType: int
+ synthetic set x @-1
+ parameters
+ requiredPositional covariant _x @-1
+ type: int
+ returnType: void
+''');
+ }
+
+ test_class_field_documented() async {
+ var library = await checkLibrary('''
+class C {
+ /**
+ * Docs
+ */
+ var x;
+}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ x @38
+ documentationComment: /**\n * Docs\n */
+ type: dynamic
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get x @-1
+ returnType: dynamic
+ synthetic set x @-1
+ parameters
+ requiredPositional _x @-1
+ type: dynamic
+ returnType: void
+''');
+ }
+
+ test_class_field_external() async {
+ var library = await checkLibrary('''
+abstract class C {
+ external int i;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ abstract class C @15
+ fields
+ external i @34
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get i @-1
+ returnType: int
+ synthetic set i @-1
+ parameters
+ requiredPositional _i @-1
+ type: int
+ returnType: void
+''');
+ }
+
+ test_class_field_final_hasInitializer_hasConstConstructor() async {
+ var library = await checkLibrary('''
+class C {
+ final x = 42;
+ const C();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ final x @18
+ type: int
+ constantInitializer
+ IntegerLiteral
+ literal: 42 @22
+ staticType: int
+ constructors
+ const @34
+ accessors
+ synthetic get x @-1
+ returnType: int
+''');
+ }
+
+ test_class_field_final_hasInitializer_hasConstConstructor_genericFunctionType() async {
+ var library = await checkLibrary('''
+class A<T> {
+ const A();
+}
+class B {
+ final f = const A<int Function(double a)>();
+ const B();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ typeParameters
+ covariant T @8
+ defaultType: dynamic
+ constructors
+ const @21
+ class B @34
+ fields
+ final f @46
+ type: A<int Function(double)>
+ constantInitializer
+ InstanceCreationExpression
+ argumentList: ArgumentList
+ leftParenthesis: ( @81
+ rightParenthesis: ) @82
+ constructorName: ConstructorName
+ staticElement: ConstructorMember
+ base: self::@class::A::@constructor::•
+ substitution: {T: int Function(double)}
+ type: NamedType
+ name: SimpleIdentifier
+ staticElement: self::@class::A
+ staticType: null
+ token: A @56
+ type: A<int Function(double)>
+ typeArguments: TypeArgumentList
+ arguments
+ GenericFunctionType
+ declaredElement: GenericFunctionTypeElement
+ parameters
+ a
+ kind: required positional
+ type: double
+ returnType: int
+ type: int Function(double)
+ functionKeyword: Function @62
+ parameters: FormalParameterList
+ leftParenthesis: ( @70
+ parameters
+ SimpleFormalParameter
+ declaredElement: a@78
+ declaredElementType: double
+ identifier: SimpleIdentifier
+ staticElement: a@78
+ staticType: null
+ token: a @78
+ type: NamedType
+ name: SimpleIdentifier
+ staticElement: dart:core::@class::double
+ staticType: null
+ token: double @71
+ type: double
+ rightParenthesis: ) @79
+ returnType: NamedType
+ name: SimpleIdentifier
+ staticElement: dart:core::@class::int
+ staticType: null
+ token: int @58
+ type: int
+ type: int Function(double)
+ leftBracket: < @57
+ rightBracket: > @80
+ keyword: const @50
+ staticType: A<int Function(double)>
+ constructors
+ const @93
+ accessors
+ synthetic get f @-1
+ returnType: A<int Function(double)>
+''');
+ }
+
+ test_class_field_final_hasInitializer_noConstConstructor() async {
+ var library = await checkLibrary('''
+class C {
+ final x = 42;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ final x @18
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get x @-1
+ returnType: int
+''');
+ }
+
test_class_field_final_withSetter() async {
var library = await checkLibrary(r'''
class A {
@@ -1950,6 +3101,43 @@
''');
}
+ test_class_field_formal_param_inferred_type_implicit() async {
+ var library = await checkLibrary('class C extends D { var v; C(this.v); }'
+ ' abstract class D { int get v; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ supertype: D
+ fields
+ v @24
+ type: int
+ constructors
+ @27
+ parameters
+ requiredPositional final this.v @34
+ type: int
+ accessors
+ synthetic get v @-1
+ returnType: int
+ synthetic set v @-1
+ parameters
+ requiredPositional _v @-1
+ type: int
+ returnType: void
+ abstract class D @55
+ fields
+ synthetic v @-1
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ abstract get v @67
+ returnType: int
+''');
+ }
+
test_class_field_implicit_type() async {
var library = await checkLibrary('class C { var x; }');
checkElementText(library, r'''
@@ -1996,6 +3184,167 @@
''');
}
+ test_class_field_inferred_type_nonStatic_explicit_initialized() async {
+ var library = await checkLibrary('class C { num v = 0; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ v @14
+ type: num
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get v @-1
+ returnType: num
+ synthetic set v @-1
+ parameters
+ requiredPositional _v @-1
+ type: num
+ returnType: void
+''');
+ }
+
+ test_class_field_inferred_type_nonStatic_implicit_initialized() async {
+ var library = await checkLibrary('class C { var v = 0; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ v @14
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get v @-1
+ returnType: int
+ synthetic set v @-1
+ parameters
+ requiredPositional _v @-1
+ type: int
+ returnType: void
+''');
+ }
+
+ test_class_field_inferred_type_nonStatic_implicit_uninitialized() async {
+ var library = await checkLibrary(
+ 'class C extends D { var v; } abstract class D { int get v; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ supertype: D
+ fields
+ v @24
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get v @-1
+ returnType: int
+ synthetic set v @-1
+ parameters
+ requiredPositional _v @-1
+ type: int
+ returnType: void
+ abstract class D @44
+ fields
+ synthetic v @-1
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ abstract get v @56
+ returnType: int
+''');
+ }
+
+ test_class_field_inferred_type_nonStatic_inherited_resolveInitializer() async {
+ var library = await checkLibrary(r'''
+const a = 0;
+abstract class A {
+ const A();
+ List<int> get f;
+}
+class B extends A {
+ const B();
+ final f = [a];
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ abstract class A @28
+ fields
+ synthetic f @-1
+ type: List<int>
+ constructors
+ const @40
+ accessors
+ abstract get f @61
+ returnType: List<int>
+ class B @72
+ supertype: A
+ fields
+ final f @107
+ type: List<int>
+ constantInitializer
+ ListLiteral
+ elements
+ SimpleIdentifier
+ staticElement: self::@getter::a
+ staticType: int
+ token: a @112
+ leftBracket: [ @111
+ rightBracket: ] @113
+ staticType: List<int>
+ constructors
+ const @94
+ accessors
+ synthetic get f @-1
+ returnType: List<int>
+ topLevelVariables
+ static const a @6
+ type: int
+ constantInitializer
+ IntegerLiteral
+ literal: 0 @10
+ staticType: int
+ accessors
+ synthetic static get a @-1
+ returnType: int
+''');
+ }
+
+ test_class_field_inferred_type_static_implicit_initialized() async {
+ var library = await checkLibrary('class C { static var v = 0; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ static v @21
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic static get v @-1
+ returnType: int
+ synthetic static set v @-1
+ parameters
+ requiredPositional _v @-1
+ type: int
+ returnType: void
+''');
+ }
+
test_class_field_inheritedContextType_double() async {
var library = await checkLibrary('''
abstract class A {
@@ -2037,6 +3386,132 @@
''');
}
+ test_class_field_propagatedType_const_noDep() async {
+ var library = await checkLibrary('''
+class C {
+ static const x = 0;
+}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ static const x @25
+ type: int
+ constantInitializer
+ IntegerLiteral
+ literal: 0 @29
+ staticType: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic static get x @-1
+ returnType: int
+''');
+ }
+
+ test_class_field_propagatedType_final_dep_inLib() async {
+ addLibrarySource('/a.dart', 'final a = 1;');
+ var library = await checkLibrary('''
+import "a.dart";
+class C {
+ final b = a / 2;
+}''');
+ checkElementText(library, r'''
+library
+ imports
+ a.dart
+ definingUnit
+ classes
+ class C @23
+ fields
+ final b @35
+ type: double
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get b @-1
+ returnType: double
+''');
+ }
+
+ test_class_field_propagatedType_final_dep_inPart() async {
+ addSource('/a.dart', 'part of lib; final a = 1;');
+ var library = await checkLibrary('''
+library lib;
+part "a.dart";
+class C {
+ final b = a / 2;
+}''');
+ checkElementText(library, r'''
+library
+ name: lib
+ nameOffset: 8
+ definingUnit
+ classes
+ class C @34
+ fields
+ final b @46
+ type: double
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get b @-1
+ returnType: double
+ parts
+ a.dart
+ topLevelVariables
+ static final a @19
+ type: int
+ accessors
+ synthetic static get a @-1
+ returnType: int
+''');
+ }
+
+ test_class_field_propagatedType_final_noDep_instance() async {
+ var library = await checkLibrary('''
+class C {
+ final x = 0;
+}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ final x @18
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get x @-1
+ returnType: int
+''');
+ }
+
+ test_class_field_propagatedType_final_noDep_static() async {
+ var library = await checkLibrary('''
+class C {
+ static final x = 0;
+}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ static final x @25
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic static get x @-1
+ returnType: int
+''');
+ }
+
test_class_field_static() async {
var library = await checkLibrary('class C { static int i; }');
checkElementText(library, r'''
@@ -2083,6 +3558,24 @@
''');
}
+ test_class_field_static_final_untyped() async {
+ var library = await checkLibrary('class C { static final x = 0; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ static final x @23
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic static get x @-1
+ returnType: int
+''');
+ }
+
test_class_field_static_late() async {
var library = await checkLibrary('class C { static late int i; }');
checkElementText(library, r'''
@@ -2106,6 +3599,116 @@
''');
}
+ test_class_field_type_inferred_Never() async {
+ var library = await checkLibrary(r'''
+class C {
+ var a = throw 42;
+}
+''');
+
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ a @16
+ type: Never
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get a @-1
+ returnType: Never
+ synthetic set a @-1
+ parameters
+ requiredPositional _a @-1
+ type: Never
+ returnType: void
+''');
+ }
+
+ test_class_field_type_inferred_nonNullify() async {
+ addSource('/a.dart', '''
+// @dart = 2.7
+var a = 0;
+''');
+
+ var library = await checkLibrary(r'''
+import 'a.dart';
+class C {
+ var b = a;
+}
+''');
+
+ checkElementText(library, r'''
+library
+ imports
+ a.dart
+ definingUnit
+ classes
+ class C @23
+ fields
+ b @33
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get b @-1
+ returnType: int
+ synthetic set b @-1
+ parameters
+ requiredPositional _b @-1
+ type: int
+ returnType: void
+''');
+ }
+
+ test_class_field_typed() async {
+ var library = await checkLibrary('class C { int x = 0; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ x @14
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get x @-1
+ returnType: int
+ synthetic set x @-1
+ parameters
+ requiredPositional _x @-1
+ type: int
+ returnType: void
+''');
+ }
+
+ test_class_field_untyped() async {
+ var library = await checkLibrary('class C { var x = 0; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ x @14
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get x @-1
+ returnType: int
+ synthetic set x @-1
+ parameters
+ requiredPositional _x @-1
+ type: int
+ returnType: void
+''');
+ }
+
test_class_fields() async {
var library = await checkLibrary('class C { int i; int j; }');
checkElementText(library, r'''
@@ -2554,6 +4157,72 @@
''');
}
+ test_class_method_async() async {
+ var library = await checkLibrary(r'''
+import 'dart:async';
+class C {
+ Future f() async {}
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ dart:async
+ definingUnit
+ classes
+ class C @27
+ constructors
+ synthetic @-1
+ methods
+ f @40 async
+ returnType: Future<dynamic>
+''');
+ }
+
+ test_class_method_asyncStar() async {
+ var library = await checkLibrary(r'''
+import 'dart:async';
+class C {
+ Stream f() async* {}
+}
+''');
+ checkElementText(library, r'''
+library
+ imports
+ dart:async
+ definingUnit
+ classes
+ class C @27
+ constructors
+ synthetic @-1
+ methods
+ f @40 async*
+ returnType: Stream<dynamic>
+''');
+ }
+
+ test_class_method_documented() async {
+ var library = await checkLibrary('''
+class C {
+ /**
+ * Docs
+ */
+ f() {}
+}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ f @34
+ documentationComment: /**\n * Docs\n */
+ returnType: dynamic
+''');
+ }
+
test_class_method_external() async {
var library = await checkLibrary('class C { external f(); }');
checkElementText(library, r'''
@@ -2569,6 +4238,86 @@
''');
}
+ test_class_method_hasImplicitReturnType_false() async {
+ var library = await checkLibrary('''
+class C {
+ int m() => 0;
+}
+''');
+ var c = library.definingCompilationUnit.classes.single;
+ var m = c.methods.single;
+ expect(m.hasImplicitReturnType, isFalse);
+ }
+
+ test_class_method_hasImplicitReturnType_true() async {
+ var library = await checkLibrary('''
+class C {
+ m() => 0;
+}
+''');
+ var c = library.definingCompilationUnit.classes.single;
+ var m = c.methods.single;
+ expect(m.hasImplicitReturnType, isTrue);
+ }
+
+ test_class_method_inferred_type_nonStatic_implicit_param() async {
+ var library = await checkLibrary('class C extends D { void f(value) {} }'
+ ' abstract class D { void f(int value); }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ supertype: D
+ constructors
+ synthetic @-1
+ methods
+ f @25
+ parameters
+ requiredPositional value @27
+ type: int
+ returnType: void
+ abstract class D @54
+ constructors
+ synthetic @-1
+ methods
+ abstract f @63
+ parameters
+ requiredPositional value @69
+ type: int
+ returnType: void
+''');
+ }
+
+ test_class_method_inferred_type_nonStatic_implicit_return() async {
+ var library = await checkLibrary('''
+class C extends D {
+ f() => null;
+}
+abstract class D {
+ int f();
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ supertype: D
+ constructors
+ synthetic @-1
+ methods
+ f @22
+ returnType: int
+ abstract class D @52
+ constructors
+ synthetic @-1
+ methods
+ abstract f @62
+ returnType: int
+''');
+ }
+
test_class_method_namedAsSupertype() async {
var library = await checkLibrary(r'''
class A {}
@@ -2647,6 +4396,106 @@
''');
}
+ test_class_method_syncStar() async {
+ var library = await checkLibrary(r'''
+class C {
+ Iterable<int> f() sync* {
+ yield 42;
+ }
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ f @26 sync*
+ returnType: Iterable<int>
+''');
+ }
+
+ test_class_method_type_parameter() async {
+ var library = await checkLibrary('class C { T f<T, U>(U u) => null; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ f @12
+ typeParameters
+ covariant T @14
+ covariant U @17
+ parameters
+ requiredPositional u @22
+ type: U
+ returnType: T
+''');
+ }
+
+ test_class_method_type_parameter_in_generic_class() async {
+ var library = await checkLibrary('''
+class C<T, U> {
+ V f<V, W>(T t, U u, W w) => null;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ typeParameters
+ covariant T @8
+ defaultType: dynamic
+ covariant U @11
+ defaultType: dynamic
+ constructors
+ synthetic @-1
+ methods
+ f @20
+ typeParameters
+ covariant V @22
+ covariant W @25
+ parameters
+ requiredPositional t @30
+ type: T
+ requiredPositional u @35
+ type: U
+ requiredPositional w @40
+ type: W
+ returnType: V
+''');
+ }
+
+ test_class_method_type_parameter_with_function_typed_parameter() async {
+ var library = await checkLibrary('class C { void f<T, U>(T x(U u)) {} }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ f @15
+ typeParameters
+ covariant T @17
+ covariant U @20
+ parameters
+ requiredPositional x @25
+ type: T Function(U)
+ parameters
+ requiredPositional u @29
+ type: U
+ returnType: void
+''');
+ }
+
test_class_methods() async {
var library = await checkLibrary('class C { f() {} g() {} }');
checkElementText(library, r'''
@@ -3154,6 +5003,153 @@
''');
}
+ test_class_operator() async {
+ var library =
+ await checkLibrary('class C { C operator+(C other) => null; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ + @20
+ parameters
+ requiredPositional other @24
+ type: C
+ returnType: C
+''');
+ }
+
+ test_class_operator_equal() async {
+ var library = await checkLibrary('''
+class C {
+ bool operator==(Object other) => false;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ == @25
+ parameters
+ requiredPositional other @35
+ type: Object
+ returnType: bool
+''');
+ }
+
+ test_class_operator_external() async {
+ var library =
+ await checkLibrary('class C { external C operator+(C other); }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ external + @29
+ parameters
+ requiredPositional other @33
+ type: C
+ returnType: C
+''');
+ }
+
+ test_class_operator_greater_equal() async {
+ var library = await checkLibrary('''
+class C {
+ bool operator>=(C other) => false;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ >= @25
+ parameters
+ requiredPositional other @30
+ type: C
+ returnType: bool
+''');
+ }
+
+ test_class_operator_index() async {
+ var library =
+ await checkLibrary('class C { bool operator[](int i) => null; }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ [] @23
+ parameters
+ requiredPositional i @30
+ type: int
+ returnType: bool
+''');
+ }
+
+ test_class_operator_index_set() async {
+ var library = await checkLibrary('''
+class C {
+ void operator[]=(int i, bool v) {}
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ []= @25
+ parameters
+ requiredPositional i @33
+ type: int
+ requiredPositional v @41
+ type: bool
+ returnType: void
+''');
+ }
+
+ test_class_operator_less_equal() async {
+ var library = await checkLibrary('''
+class C {
+ bool operator<=(C other) => false;
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ constructors
+ synthetic @-1
+ methods
+ <= @25
+ parameters
+ requiredPositional other @30
+ type: C
+ returnType: bool
+''');
+ }
+
test_class_ref_nullability_none() async {
var library = await checkLibrary('''
class C {}
@@ -3255,6 +5251,28 @@
''');
}
+ test_class_setter_covariant() async {
+ var library =
+ await checkLibrary('class C { void set x(covariant int value); }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ synthetic x @-1
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ abstract set x @19
+ parameters
+ requiredPositional covariant value @35
+ type: int
+ returnType: void
+''');
+ }
+
test_class_setter_external() async {
var library =
await checkLibrary('class C { external void set x(int value); }');
@@ -3319,6 +5337,136 @@
''');
}
+ test_class_setter_inferred_type_conflictingInheritance() async {
+ var library = await checkLibrary('''
+class A {
+ int t;
+}
+class B extends A {
+ double t;
+}
+class C extends A implements B {
+}
+class D extends C {
+ void set t(p) {}
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class A @6
+ fields
+ t @16
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get t @-1
+ returnType: int
+ synthetic set t @-1
+ parameters
+ requiredPositional _t @-1
+ type: int
+ returnType: void
+ class B @27
+ supertype: A
+ fields
+ t @50
+ type: double
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get t @-1
+ returnType: double
+ synthetic set t @-1
+ parameters
+ requiredPositional _t @-1
+ type: double
+ returnType: void
+ class C @61
+ supertype: A
+ interfaces
+ B
+ constructors
+ synthetic @-1
+ class D @96
+ supertype: C
+ fields
+ synthetic t @-1
+ type: dynamic
+ constructors
+ synthetic @-1
+ accessors
+ set t @121
+ parameters
+ requiredPositional p @123
+ type: dynamic
+ returnType: void
+''');
+ }
+
+ test_class_setter_inferred_type_nonStatic_implicit_param() async {
+ var library =
+ await checkLibrary('class C extends D { void set f(value) {} }'
+ ' abstract class D { void set f(int value); }');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ supertype: D
+ fields
+ synthetic f @-1
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ set f @29
+ parameters
+ requiredPositional value @31
+ type: int
+ returnType: void
+ abstract class D @58
+ fields
+ synthetic f @-1
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ abstract set f @71
+ parameters
+ requiredPositional value @77
+ type: int
+ returnType: void
+''');
+ }
+
+ test_class_setter_inferred_type_static_implicit_return() async {
+ var library = await checkLibrary('''
+class C {
+ static set f(int value) {}
+}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class C @6
+ fields
+ synthetic static f @-1
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ static set f @23
+ parameters
+ requiredPositional value @29
+ type: int
+ returnType: void
+''');
+ }
+
test_class_setter_invalid_named_parameter() async {
var library = await checkLibrary('class C { void set x({a}) {} }');
checkElementText(library, r'''
@@ -3559,7 +5707,7 @@
''');
}
- test_class_type_parameters() async {
+ test_class_typeParameters() async {
var library = await checkLibrary('class C<T, U> {}');
checkElementText(library, r'''
library
@@ -3576,7 +5724,7 @@
''');
}
- test_class_type_parameters_bound() async {
+ test_class_typeParameters_bound() async {
var library = await checkLibrary('''
class C<T extends Object, U extends D> {}
class D {}
@@ -3601,7 +5749,7 @@
''');
}
- test_class_type_parameters_cycle_1of1() async {
+ test_class_typeParameters_cycle_1of1() async {
var library = await checkLibrary('class C<T extends T> {}');
checkElementText(library, r'''
library
@@ -3617,7 +5765,7 @@
''');
}
- test_class_type_parameters_cycle_2of3() async {
+ test_class_typeParameters_cycle_2of3() async {
var library = await checkLibrary(r'''
class C<T extends V, U, V extends T> {}
''');
@@ -3640,42 +5788,6 @@
''');
}
- test_class_type_parameters_f_bound_complex() async {
- var library = await checkLibrary('class C<T extends List<U>, U> {}');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- notSimplyBounded class C @6
- typeParameters
- covariant T @8
- bound: List<U>
- defaultType: List<dynamic>
- covariant U @27
- defaultType: dynamic
- constructors
- synthetic @-1
-''');
- }
-
- test_class_type_parameters_f_bound_simple() async {
- var library = await checkLibrary('class C<T extends U, U> {}');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- notSimplyBounded class C @6
- typeParameters
- covariant T @8
- bound: U
- defaultType: dynamic
- covariant U @21
- defaultType: dynamic
- constructors
- synthetic @-1
-''');
- }
-
test_class_typeParameters_defaultType_cycle_genericFunctionType() async {
var library = await checkLibrary(r'''
class A<T extends void Function(A)> {}
@@ -4069,6 +6181,42 @@
''');
}
+ test_class_typeParameters_f_bound_complex() async {
+ var library = await checkLibrary('class C<T extends List<U>, U> {}');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ notSimplyBounded class C @6
+ typeParameters
+ covariant T @8
+ bound: List<U>
+ defaultType: List<dynamic>
+ covariant U @27
+ defaultType: dynamic
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_class_typeParameters_f_bound_simple() async {
+ var library = await checkLibrary('class C<T extends U, U> {}');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ notSimplyBounded class C @6
+ typeParameters
+ covariant T @8
+ bound: U
+ defaultType: dynamic
+ covariant U @21
+ defaultType: dynamic
+ constructors
+ synthetic @-1
+''');
+ }
+
test_class_typeParameters_variance_contravariant() async {
var library = await checkLibrary('class C<in T> {}');
checkElementText(library, r'''
@@ -4133,6 +6281,764 @@
''');
}
+ test_classAlias() async {
+ var library = await checkLibrary('''
+class C = D with E, F, G;
+class D {}
+class E {}
+class F {}
+class G {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class alias C @6
+ supertype: D
+ mixins
+ E
+ F
+ G
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @32
+ constructors
+ synthetic @-1
+ class E @43
+ constructors
+ synthetic @-1
+ class F @54
+ constructors
+ synthetic @-1
+ class G @65
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_abstract() async {
+ var library = await checkLibrary('''
+abstract class C = D with E;
+class D {}
+class E {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ abstract class alias C @15
+ supertype: D
+ mixins
+ E
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @35
+ constructors
+ synthetic @-1
+ class E @46
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_documented() async {
+ var library = await checkLibrary('''
+/**
+ * Docs
+ */
+class C = D with E;
+
+class D {}
+class E {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class alias C @22
+ documentationComment: /**\n * Docs\n */
+ supertype: D
+ mixins
+ E
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @43
+ constructors
+ synthetic @-1
+ class E @54
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_documented_tripleSlash() async {
+ var library = await checkLibrary('''
+/// aaa
+/// b
+/// cc
+class C = D with E;
+
+class D {}
+class E {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class alias C @27
+ documentationComment: /// aaa\n/// b\n/// cc
+ supertype: D
+ mixins
+ E
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @48
+ constructors
+ synthetic @-1
+ class E @59
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_documented_withLeadingNonDocumentation() async {
+ var library = await checkLibrary('''
+// Extra comment so doc comment offset != 0
+/**
+ * Docs
+ */
+class C = D with E;
+
+class D {}
+class E {}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class alias C @66
+ documentationComment: /**\n * Docs\n */
+ supertype: D
+ mixins
+ E
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @87
+ constructors
+ synthetic @-1
+ class E @98
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_generic() async {
+ var library = await checkLibrary('''
+class Z = A with B<int>, C<double>;
+class A {}
+class B<B1> {}
+class C<C1> {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class alias Z @6
+ supertype: A
+ mixins
+ B<int>
+ C<double>
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::A::@constructor::•
+ superKeyword: super @0
+ class A @42
+ constructors
+ synthetic @-1
+ class B @53
+ typeParameters
+ covariant B1 @55
+ defaultType: dynamic
+ constructors
+ synthetic @-1
+ class C @68
+ typeParameters
+ covariant C1 @70
+ defaultType: dynamic
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_notSimplyBounded_self() async {
+ var library = await checkLibrary('''
+class C<T extends C> = D with E;
+class D {}
+class E {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ notSimplyBounded class alias C @6
+ typeParameters
+ covariant T @8
+ bound: C<dynamic>
+ defaultType: dynamic
+ supertype: D
+ mixins
+ E
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @39
+ constructors
+ synthetic @-1
+ class E @50
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_notSimplyBounded_simple_no_type_parameter_bound() async {
+ // If no bounds are specified, then the class is simply bounded by syntax
+ // alone, so there is no reason to assign it a slot.
+ var library = await checkLibrary('''
+class C<T> = D with E;
+class D {}
+class E {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class alias C @6
+ typeParameters
+ covariant T @8
+ defaultType: dynamic
+ supertype: D
+ mixins
+ E
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @29
+ constructors
+ synthetic @-1
+ class E @40
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_notSimplyBounded_simple_non_generic() async {
+ // If no type parameters are specified, then the class is simply bounded, so
+ // there is no reason to assign it a slot.
+ var library = await checkLibrary('''
+class C = D with E;
+class D {}
+class E {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class alias C @6
+ supertype: D
+ mixins
+ E
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @26
+ constructors
+ synthetic @-1
+ class E @37
+ constructors
+ synthetic @-1
+''');
+ }
+
+ test_classAlias_with_const_constructors() async {
+ testFile = convertPath('/home/test/lib/test.dart');
+ addLibrarySource('/home/test/lib/a.dart', r'''
+class Base {
+ const Base._priv();
+ const Base();
+ const Base.named();
+}
+''');
+ var library = await checkLibrary('''
+import "a.dart";
+class M {}
+class MixinApp = Base with M;
+''');
+ checkElementText(library, r'''
+library
+ imports
+ package:test/a.dart
+ definingUnit
+ classes
+ class M @23
+ constructors
+ synthetic @-1
+ class alias MixinApp @34
+ supertype: Base
+ mixins
+ M
+ constructors
+ synthetic const @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::•
+ superKeyword: super @0
+ synthetic const named @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: package:test/a.dart::@class::Base::@constructor::named
+ staticType: null
+ token: named @-1
+ period: . @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::named
+ superKeyword: super @0
+''');
+ }
+
+ test_classAlias_with_forwarding_constructors() async {
+ testFile = convertPath('/home/test/lib/test.dart');
+ addLibrarySource('/home/test/lib/a.dart', r'''
+class Base {
+ bool x = true;
+ Base._priv();
+ Base();
+ Base.noArgs();
+ Base.requiredArg(x);
+ Base.positionalArg([bool x = true]);
+ Base.positionalArg2([this.x = true]);
+ Base.namedArg({int x = 42});
+ Base.namedArg2({this.x = true});
+ factory Base.fact() => Base();
+ factory Base.fact2() = Base.noArgs;
+}
+''');
+ var library = await checkLibrary('''
+import "a.dart";
+class M {}
+class MixinApp = Base with M;
+''');
+ checkElementText(library, r'''
+library
+ imports
+ package:test/a.dart
+ definingUnit
+ classes
+ class M @23
+ constructors
+ synthetic @-1
+ class alias MixinApp @34
+ supertype: Base
+ mixins
+ M
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::•
+ superKeyword: super @0
+ synthetic noArgs @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: package:test/a.dart::@class::Base::@constructor::noArgs
+ staticType: null
+ token: noArgs @-1
+ period: . @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::noArgs
+ superKeyword: super @0
+ synthetic requiredArg @-1
+ parameters
+ requiredPositional x @-1
+ type: dynamic
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ SimpleIdentifier
+ staticElement: x@-1
+ staticType: dynamic
+ token: x @-1
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: package:test/a.dart::@class::Base::@constructor::requiredArg
+ staticType: null
+ token: requiredArg @-1
+ period: . @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::requiredArg
+ superKeyword: super @0
+ synthetic positionalArg @-1
+ parameters
+ optionalPositional x @-1
+ type: bool
+ constantInitializer
+ BooleanLiteral
+ literal: true @127
+ staticType: bool
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ SimpleIdentifier
+ staticElement: x@-1
+ staticType: bool
+ token: x @-1
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: package:test/a.dart::@class::Base::@constructor::positionalArg
+ staticType: null
+ token: positionalArg @-1
+ period: . @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::positionalArg
+ superKeyword: super @0
+ synthetic positionalArg2 @-1
+ parameters
+ optionalPositional final x @-1
+ type: bool
+ constantInitializer
+ BooleanLiteral
+ literal: true @167
+ staticType: bool
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ SimpleIdentifier
+ staticElement: x@-1
+ staticType: bool
+ token: x @-1
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: package:test/a.dart::@class::Base::@constructor::positionalArg2
+ staticType: null
+ token: positionalArg2 @-1
+ period: . @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::positionalArg2
+ superKeyword: super @0
+ synthetic namedArg @-1
+ parameters
+ optionalNamed x @-1
+ type: int
+ constantInitializer
+ IntegerLiteral
+ literal: 42 @200
+ staticType: int
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ SimpleIdentifier
+ staticElement: x@-1
+ staticType: int
+ token: x @-1
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: package:test/a.dart::@class::Base::@constructor::namedArg
+ staticType: null
+ token: namedArg @-1
+ period: . @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::namedArg
+ superKeyword: super @0
+ synthetic namedArg2 @-1
+ parameters
+ optionalNamed final x @-1
+ type: bool
+ constantInitializer
+ BooleanLiteral
+ literal: true @233
+ staticType: bool
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ SimpleIdentifier
+ staticElement: x@-1
+ staticType: bool
+ token: x @-1
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: package:test/a.dart::@class::Base::@constructor::namedArg2
+ staticType: null
+ token: namedArg2 @-1
+ period: . @0
+ staticElement: package:test/a.dart::@class::Base::@constructor::namedArg2
+ superKeyword: super @0
+''');
+ }
+
+ test_classAlias_with_forwarding_constructors_type_substitution() async {
+ var library = await checkLibrary('''
+class Base<T> {
+ Base.ctor(T t, List<T> l);
+}
+class M {}
+class MixinApp = Base with M;
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class Base @6
+ typeParameters
+ covariant T @11
+ defaultType: dynamic
+ constructors
+ ctor @23
+ periodOffset: 22
+ nameEnd: 27
+ parameters
+ requiredPositional t @30
+ type: T
+ requiredPositional l @41
+ type: List<T>
+ class M @53
+ constructors
+ synthetic @-1
+ class alias MixinApp @64
+ supertype: Base<dynamic>
+ mixins
+ M
+ constructors
+ synthetic ctor @-1
+ parameters
+ requiredPositional t @-1
+ type: dynamic
+ requiredPositional l @-1
+ type: List<dynamic>
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ SimpleIdentifier
+ staticElement: t@-1
+ staticType: dynamic
+ token: t @-1
+ SimpleIdentifier
+ staticElement: l@-1
+ staticType: List<dynamic>
+ token: l @-1
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::Base::@constructor::ctor
+ staticType: null
+ token: ctor @-1
+ period: . @0
+ staticElement: self::@class::Base::@constructor::ctor
+ superKeyword: super @0
+''');
+ }
+
+ test_classAlias_with_forwarding_constructors_type_substitution_complex() async {
+ var library = await checkLibrary('''
+class Base<T> {
+ Base.ctor(T t, List<T> l);
+}
+class M {}
+class MixinApp<U> = Base<List<U>> with M;
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class Base @6
+ typeParameters
+ covariant T @11
+ defaultType: dynamic
+ constructors
+ ctor @23
+ periodOffset: 22
+ nameEnd: 27
+ parameters
+ requiredPositional t @30
+ type: T
+ requiredPositional l @41
+ type: List<T>
+ class M @53
+ constructors
+ synthetic @-1
+ class alias MixinApp @64
+ typeParameters
+ covariant U @73
+ defaultType: dynamic
+ supertype: Base<List<U>>
+ mixins
+ M
+ constructors
+ synthetic ctor @-1
+ parameters
+ requiredPositional t @-1
+ type: List<U>
+ requiredPositional l @-1
+ type: List<List<U>>
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ arguments
+ SimpleIdentifier
+ staticElement: t@-1
+ staticType: List<U>
+ token: t @-1
+ SimpleIdentifier
+ staticElement: l@-1
+ staticType: List<List<U>>
+ token: l @-1
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ constructorName: SimpleIdentifier
+ staticElement: self::@class::Base::@constructor::ctor
+ staticType: null
+ token: ctor @-1
+ period: . @0
+ staticElement: self::@class::Base::@constructor::ctor
+ superKeyword: super @0
+''');
+ }
+
+ test_classAlias_with_mixin_members() async {
+ var library = await checkLibrary('''
+class C = D with E;
+class D {}
+class E {
+ int get a => null;
+ void set b(int i) {}
+ void f() {}
+ int x;
+}''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class alias C @6
+ supertype: D
+ mixins
+ E
+ constructors
+ synthetic @-1
+ constantInitializers
+ SuperConstructorInvocation
+ argumentList: ArgumentList
+ leftParenthesis: ( @0
+ rightParenthesis: ) @0
+ staticElement: self::@class::D::@constructor::•
+ superKeyword: super @0
+ class D @26
+ constructors
+ synthetic @-1
+ class E @37
+ fields
+ x @105
+ type: int
+ synthetic a @-1
+ type: int
+ synthetic b @-1
+ type: int
+ constructors
+ synthetic @-1
+ accessors
+ synthetic get x @-1
+ returnType: int
+ synthetic set x @-1
+ parameters
+ requiredPositional _x @-1
+ type: int
+ returnType: void
+ get a @51
+ returnType: int
+ set b @73
+ parameters
+ requiredPositional i @79
+ type: int
+ returnType: void
+ methods
+ f @92
+ returnType: void
+''');
+ }
+
test_classes() async {
var library = await checkLibrary('class C {} class D {}');
checkElementText(library, r'''
@@ -12308,1670 +15214,6 @@
''');
}
- test_constructor_documented() async {
- var library = await checkLibrary('''
-class C {
- /**
- * Docs
- */
- C();
-}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- @34
- documentationComment: /**\n * Docs\n */
-''');
- }
-
- test_constructor_initializers_assertInvocation() async {
- var library = await checkLibrary('''
-class C {
- const C(int x) : assert(x >= 42);
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- const @18
- parameters
- requiredPositional x @24
- type: int
- constantInitializers
- AssertInitializer
- assertKeyword: assert @29
- condition: BinaryExpression
- leftOperand: SimpleIdentifier
- staticElement: x@24
- staticType: int
- token: x @36
- operator: >= @38
- rightOperand: IntegerLiteral
- literal: 42 @41
- staticType: int
- staticElement: dart:core::@class::num::@method::>=
- staticInvokeType: bool Function(num)
- staticType: bool
- leftParenthesis: ( @35
- rightParenthesis: ) @43
-''');
- }
-
- test_constructor_initializers_assertInvocation_message() async {
- var library = await checkLibrary('''
-class C {
- const C(int x) : assert(x >= 42, 'foo');
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- const @18
- parameters
- requiredPositional x @24
- type: int
- constantInitializers
- AssertInitializer
- assertKeyword: assert @29
- condition: BinaryExpression
- leftOperand: SimpleIdentifier
- staticElement: x@24
- staticType: int
- token: x @36
- operator: >= @38
- rightOperand: IntegerLiteral
- literal: 42 @41
- staticType: int
- staticElement: dart:core::@class::num::@method::>=
- staticInvokeType: bool Function(num)
- staticType: bool
- leftParenthesis: ( @35
- message: SimpleStringLiteral
- literal: 'foo' @45
- rightParenthesis: ) @50
-''');
- }
-
- test_constructor_initializers_field() async {
- var library = await checkLibrary('''
-class C {
- final x;
- const C() : x = 42;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- final x @18
- type: dynamic
- constructors
- const @29
- constantInitializers
- ConstructorFieldInitializer
- equals: = @37
- expression: IntegerLiteral
- literal: 42 @39
- staticType: int
- fieldName: SimpleIdentifier
- staticElement: self::@class::C::@field::x
- staticType: null
- token: x @35
- accessors
- synthetic get x @-1
- returnType: dynamic
-''');
- }
-
- test_constructor_initializers_field_notConst() async {
- var library = await checkLibrary('''
-class C {
- final x;
- const C() : x = foo();
-}
-int foo() => 42;
-''', allowErrors: true);
- // It is OK to keep non-constant initializers.
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- final x @18
- type: dynamic
- constructors
- const @29
- constantInitializers
- ConstructorFieldInitializer
- equals: = @37
- expression: MethodInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @42
- rightParenthesis: ) @43
- methodName: SimpleIdentifier
- staticElement: self::@function::foo
- staticType: int Function()
- token: foo @39
- staticInvokeType: int Function()
- staticType: int
- fieldName: SimpleIdentifier
- staticElement: self::@class::C::@field::x
- staticType: null
- token: x @35
- accessors
- synthetic get x @-1
- returnType: dynamic
- functions
- foo @52
- returnType: int
-''');
- }
-
- test_constructor_initializers_field_optionalPositionalParameter() async {
- var library = await checkLibrary('''
-class A {
- final int _f;
- const A([int f = 0]) : _f = f;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- fields
- final _f @22
- type: int
- constructors
- const @34
- parameters
- optionalPositional f @41
- type: int
- constantInitializer
- IntegerLiteral
- literal: 0 @45
- staticType: int
- constantInitializers
- ConstructorFieldInitializer
- equals: = @54
- expression: SimpleIdentifier
- staticElement: self::@class::A::@constructor::•::@parameter::f
- staticType: int
- token: f @56
- fieldName: SimpleIdentifier
- staticElement: self::@class::A::@field::_f
- staticType: null
- token: _f @51
- accessors
- synthetic get _f @-1
- returnType: int
-''');
- }
-
- test_constructor_initializers_field_withParameter() async {
- var library = await checkLibrary('''
-class C {
- final x;
- const C(int p) : x = 1 + p;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- final x @18
- type: dynamic
- constructors
- const @29
- parameters
- requiredPositional p @35
- type: int
- constantInitializers
- ConstructorFieldInitializer
- equals: = @42
- expression: BinaryExpression
- leftOperand: IntegerLiteral
- literal: 1 @44
- staticType: int
- operator: + @46
- rightOperand: SimpleIdentifier
- staticElement: p@35
- staticType: int
- token: p @48
- staticElement: dart:core::@class::num::@method::+
- staticInvokeType: num Function(num)
- staticType: int
- fieldName: SimpleIdentifier
- staticElement: self::@class::C::@field::x
- staticType: null
- token: x @40
- accessors
- synthetic get x @-1
- returnType: dynamic
-''');
- }
-
- test_constructor_initializers_genericFunctionType() async {
- var library = await checkLibrary('''
-class A<T> {
- const A();
-}
-class B {
- const B(dynamic x);
- const B.f()
- : this(A<Function()>());
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- typeParameters
- covariant T @8
- defaultType: dynamic
- constructors
- const @21
- class B @34
- constructors
- const @46
- parameters
- requiredPositional x @56
- type: dynamic
- const f @70
- periodOffset: 69
- nameEnd: 71
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- arguments
- InstanceCreationExpression
- argumentList: ArgumentList
- leftParenthesis: ( @97
- rightParenthesis: ) @98
- constructorName: ConstructorName
- staticElement: ConstructorMember
- base: self::@class::A::@constructor::•
- substitution: {T: dynamic Function()}
- type: NamedType
- name: SimpleIdentifier
- staticElement: self::@class::A
- staticType: null
- token: A @84
- type: A<dynamic Function()>
- typeArguments: TypeArgumentList
- arguments
- GenericFunctionType
- declaredElement: GenericFunctionTypeElement
- parameters
- returnType: dynamic
- type: dynamic Function()
- functionKeyword: Function @86
- parameters: FormalParameterList
- leftParenthesis: ( @94
- rightParenthesis: ) @95
- type: dynamic Function()
- leftBracket: < @85
- rightBracket: > @96
- staticType: A<dynamic Function()>
- leftParenthesis: ( @83
- rightParenthesis: ) @99
- staticElement: self::@class::B::@constructor::•
- thisKeyword: this @79
- redirectedConstructor: self::@class::B::@constructor::•
-''');
- }
-
- test_constructor_initializers_superInvocation_argumentContextType() async {
- var library = await checkLibrary('''
-class A {
- const A(List<String> values);
-}
-class B extends A {
- const B() : super(const []);
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- constructors
- const @18
- parameters
- requiredPositional values @33
- type: List<String>
- class B @50
- supertype: A
- constructors
- const @72
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- ListLiteral
- constKeyword: const @84
- leftBracket: [ @90
- rightBracket: ] @91
- staticType: List<String>
- leftParenthesis: ( @83
- rightParenthesis: ) @92
- staticElement: self::@class::A::@constructor::•
- superKeyword: super @78
-''');
- }
-
- test_constructor_initializers_superInvocation_named() async {
- var library = await checkLibrary('''
-class A {
- const A.aaa(int p);
-}
-class C extends A {
- const C() : super.aaa(42);
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- constructors
- const aaa @20
- periodOffset: 19
- nameEnd: 23
- parameters
- requiredPositional p @28
- type: int
- class C @40
- supertype: A
- constructors
- const @62
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- IntegerLiteral
- literal: 42 @78
- staticType: int
- leftParenthesis: ( @77
- rightParenthesis: ) @80
- constructorName: SimpleIdentifier
- staticElement: self::@class::A::@constructor::aaa
- staticType: null
- token: aaa @74
- period: . @73
- staticElement: self::@class::A::@constructor::aaa
- superKeyword: super @68
-''');
- }
-
- test_constructor_initializers_superInvocation_named_underscore() async {
- var library = await checkLibrary('''
-class A {
- const A._();
-}
-class B extends A {
- const B() : super._();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- constructors
- const _ @20
- periodOffset: 19
- nameEnd: 21
- class B @33
- supertype: A
- constructors
- const @55
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @68
- rightParenthesis: ) @69
- constructorName: SimpleIdentifier
- staticElement: self::@class::A::@constructor::_
- staticType: null
- token: _ @67
- period: . @66
- staticElement: self::@class::A::@constructor::_
- superKeyword: super @61
-''');
- }
-
- test_constructor_initializers_superInvocation_namedExpression() async {
- var library = await checkLibrary('''
-class A {
- const A.aaa(a, {int b});
-}
-class C extends A {
- const C() : super.aaa(1, b: 2);
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- constructors
- const aaa @20
- periodOffset: 19
- nameEnd: 23
- parameters
- requiredPositional a @24
- type: dynamic
- optionalNamed b @32
- type: int
- class C @45
- supertype: A
- constructors
- const @67
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- IntegerLiteral
- literal: 1 @83
- staticType: int
- NamedExpression
- name: Label
- label: SimpleIdentifier
- staticElement: self::@class::A::@constructor::aaa::@parameter::b
- staticType: null
- token: b @86
- expression: IntegerLiteral
- literal: 2 @89
- staticType: int
- leftParenthesis: ( @82
- rightParenthesis: ) @90
- constructorName: SimpleIdentifier
- staticElement: self::@class::A::@constructor::aaa
- staticType: null
- token: aaa @79
- period: . @78
- staticElement: self::@class::A::@constructor::aaa
- superKeyword: super @73
-''');
- }
-
- test_constructor_initializers_superInvocation_unnamed() async {
- var library = await checkLibrary('''
-class A {
- const A(int p);
-}
-class C extends A {
- const C.ccc() : super(42);
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- constructors
- const @18
- parameters
- requiredPositional p @24
- type: int
- class C @36
- supertype: A
- constructors
- const ccc @60
- periodOffset: 59
- nameEnd: 63
- constantInitializers
- SuperConstructorInvocation
- argumentList: ArgumentList
- arguments
- IntegerLiteral
- literal: 42 @74
- staticType: int
- leftParenthesis: ( @73
- rightParenthesis: ) @76
- staticElement: self::@class::A::@constructor::•
- superKeyword: super @68
-''');
- }
-
- test_constructor_initializers_thisInvocation_argumentContextType() async {
- var library = await checkLibrary('''
-class A {
- const A(List<String> values);
- const A.empty() : this(const []);
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- constructors
- const @18
- parameters
- requiredPositional values @33
- type: List<String>
- const empty @52
- periodOffset: 51
- nameEnd: 57
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- arguments
- ListLiteral
- constKeyword: const @67
- leftBracket: [ @73
- rightBracket: ] @74
- staticType: List<String>
- leftParenthesis: ( @66
- rightParenthesis: ) @75
- staticElement: self::@class::A::@constructor::•
- thisKeyword: this @62
- redirectedConstructor: self::@class::A::@constructor::•
-''');
- }
-
- test_constructor_initializers_thisInvocation_named() async {
- var library = await checkLibrary('''
-class C {
- const C() : this.named(1, 'bbb');
- const C.named(int a, String b);
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- const @18
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- arguments
- IntegerLiteral
- literal: 1 @35
- staticType: int
- SimpleStringLiteral
- literal: 'bbb' @38
- leftParenthesis: ( @34
- rightParenthesis: ) @43
- constructorName: SimpleIdentifier
- staticElement: self::@class::C::@constructor::named
- staticType: null
- token: named @29
- period: . @28
- staticElement: self::@class::C::@constructor::named
- thisKeyword: this @24
- redirectedConstructor: self::@class::C::@constructor::named
- const named @56
- periodOffset: 55
- nameEnd: 61
- parameters
- requiredPositional a @66
- type: int
- requiredPositional b @76
- type: String
-''');
- }
-
- test_constructor_initializers_thisInvocation_namedExpression() async {
- var library = await checkLibrary('''
-class C {
- const C() : this.named(1, b: 2);
- const C.named(a, {int b});
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- const @18
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- arguments
- IntegerLiteral
- literal: 1 @35
- staticType: int
- NamedExpression
- name: Label
- label: SimpleIdentifier
- staticElement: self::@class::C::@constructor::named::@parameter::b
- staticType: null
- token: b @38
- expression: IntegerLiteral
- literal: 2 @41
- staticType: int
- leftParenthesis: ( @34
- rightParenthesis: ) @42
- constructorName: SimpleIdentifier
- staticElement: self::@class::C::@constructor::named
- staticType: null
- token: named @29
- period: . @28
- staticElement: self::@class::C::@constructor::named
- thisKeyword: this @24
- redirectedConstructor: self::@class::C::@constructor::named
- const named @55
- periodOffset: 54
- nameEnd: 60
- parameters
- requiredPositional a @61
- type: dynamic
- optionalNamed b @69
- type: int
-''');
- }
-
- test_constructor_initializers_thisInvocation_unnamed() async {
- var library = await checkLibrary('''
-class C {
- const C.named() : this(1, 'bbb');
- const C(int a, String b);
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- const named @20
- periodOffset: 19
- nameEnd: 25
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- arguments
- IntegerLiteral
- literal: 1 @35
- staticType: int
- SimpleStringLiteral
- literal: 'bbb' @38
- leftParenthesis: ( @34
- rightParenthesis: ) @43
- staticElement: self::@class::C::@constructor::•
- thisKeyword: this @30
- redirectedConstructor: self::@class::C::@constructor::•
- const @54
- parameters
- requiredPositional a @60
- type: int
- requiredPositional b @70
- type: String
-''');
- }
-
- test_constructor_redirected_factory_named() async {
- var library = await checkLibrary('''
-class C {
- factory C() = D.named;
- C._();
-}
-class D extends C {
- D.named() : super._();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- factory @20
- redirectedConstructor: self::@class::D::@constructor::named
- _ @39
- periodOffset: 38
- nameEnd: 40
- class D @52
- supertype: C
- constructors
- named @70
- periodOffset: 69
- nameEnd: 75
-''');
- }
-
- test_constructor_redirected_factory_named_generic() async {
- var library = await checkLibrary('''
-class C<T, U> {
- factory C() = D<U, T>.named;
- C._();
-}
-class D<T, U> extends C<U, T> {
- D.named() : super._();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- typeParameters
- covariant T @8
- defaultType: dynamic
- covariant U @11
- defaultType: dynamic
- constructors
- factory @26
- redirectedConstructor: ConstructorMember
- base: self::@class::D::@constructor::named
- substitution: {T: U, U: T}
- _ @51
- periodOffset: 50
- nameEnd: 52
- class D @64
- typeParameters
- covariant T @66
- defaultType: dynamic
- covariant U @69
- defaultType: dynamic
- supertype: C<U, T>
- constructors
- named @94
- periodOffset: 93
- nameEnd: 99
-''');
- }
-
- test_constructor_redirected_factory_named_generic_viaTypeAlias() async {
- var library = await checkLibrary('''
-typedef A<T, U> = C<T, U>;
-class B<T, U> {
- factory B() = A<U, T>.named;
- B._();
-}
-class C<T, U> extends A<U, T> {
- C.named() : super._();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class B @33
- typeParameters
- covariant T @35
- defaultType: dynamic
- covariant U @38
- defaultType: dynamic
- constructors
- factory @53
- redirectedConstructor: ConstructorMember
- base: self::@class::C::@constructor::named
- substitution: {T: U, U: T}
- _ @78
- periodOffset: 77
- nameEnd: 79
- class C @91
- typeParameters
- covariant T @93
- defaultType: dynamic
- covariant U @96
- defaultType: dynamic
- supertype: C<U, T>
- aliasElement: self::@typeAlias::A
- aliasArguments
- U
- T
- constructors
- named @121
- periodOffset: 120
- nameEnd: 126
- typeAliases
- A @8
- typeParameters
- covariant T @10
- defaultType: dynamic
- covariant U @13
- defaultType: dynamic
- aliasedType: C<T, U>
-''');
- }
-
- test_constructor_redirected_factory_named_imported() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-class D extends C {
- D.named() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart';
-class C {
- factory C() = D.named;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart
- definingUnit
- classes
- class C @25
- constructors
- factory @39
- redirectedConstructor: foo.dart::@class::D::@constructor::named
- _ @58
- periodOffset: 57
- nameEnd: 59
-''');
- }
-
- test_constructor_redirected_factory_named_imported_generic() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-class D<T, U> extends C<U, T> {
- D.named() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart';
-class C<T, U> {
- factory C() = D<U, T>.named;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart
- definingUnit
- classes
- class C @25
- typeParameters
- covariant T @27
- defaultType: dynamic
- covariant U @30
- defaultType: dynamic
- constructors
- factory @45
- redirectedConstructor: ConstructorMember
- base: foo.dart::@class::D::@constructor::named
- substitution: {T: U, U: T}
- _ @70
- periodOffset: 69
- nameEnd: 71
-''');
- }
-
- test_constructor_redirected_factory_named_prefixed() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-class D extends C {
- D.named() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart' as foo;
-class C {
- factory C() = foo.D.named;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart as foo @21
- definingUnit
- classes
- class C @32
- constructors
- factory @46
- redirectedConstructor: foo.dart::@class::D::@constructor::named
- _ @69
- periodOffset: 68
- nameEnd: 70
-''');
- }
-
- test_constructor_redirected_factory_named_prefixed_generic() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-class D<T, U> extends C<U, T> {
- D.named() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart' as foo;
-class C<T, U> {
- factory C() = foo.D<U, T>.named;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart as foo @21
- definingUnit
- classes
- class C @32
- typeParameters
- covariant T @34
- defaultType: dynamic
- covariant U @37
- defaultType: dynamic
- constructors
- factory @52
- redirectedConstructor: ConstructorMember
- base: foo.dart::@class::D::@constructor::named
- substitution: {T: U, U: T}
- _ @81
- periodOffset: 80
- nameEnd: 82
-''');
- }
-
- test_constructor_redirected_factory_named_unresolved_class() async {
- var library = await checkLibrary('''
-class C<E> {
- factory C() = D.named<E>;
-}
-''', allowErrors: true);
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- typeParameters
- covariant E @8
- defaultType: dynamic
- constructors
- factory @23
-''');
- }
-
- test_constructor_redirected_factory_named_unresolved_constructor() async {
- var library = await checkLibrary('''
-class D {}
-class C<E> {
- factory C() = D.named<E>;
-}
-''', allowErrors: true);
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class D @6
- constructors
- synthetic @-1
- class C @17
- typeParameters
- covariant E @19
- defaultType: dynamic
- constructors
- factory @34
-''');
- }
-
- test_constructor_redirected_factory_unnamed() async {
- var library = await checkLibrary('''
-class C {
- factory C() = D;
- C._();
-}
-class D extends C {
- D() : super._();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- factory @20
- redirectedConstructor: self::@class::D::@constructor::•
- _ @33
- periodOffset: 32
- nameEnd: 34
- class D @46
- supertype: C
- constructors
- @62
-''');
- }
-
- test_constructor_redirected_factory_unnamed_generic() async {
- var library = await checkLibrary('''
-class C<T, U> {
- factory C() = D<U, T>;
- C._();
-}
-class D<T, U> extends C<U, T> {
- D() : super._();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- typeParameters
- covariant T @8
- defaultType: dynamic
- covariant U @11
- defaultType: dynamic
- constructors
- factory @26
- redirectedConstructor: ConstructorMember
- base: self::@class::D::@constructor::•
- substitution: {T: U, U: T}
- _ @45
- periodOffset: 44
- nameEnd: 46
- class D @58
- typeParameters
- covariant T @60
- defaultType: dynamic
- covariant U @63
- defaultType: dynamic
- supertype: C<U, T>
- constructors
- @86
-''');
- }
-
- test_constructor_redirected_factory_unnamed_generic_viaTypeAlias() async {
- var library = await checkLibrary('''
-typedef A<T, U> = C<T, U>;
-class B<T, U> {
- factory B() = A<U, T>;
- B_();
-}
-class C<T, U> extends B<U, T> {
- C() : super._();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class B @33
- typeParameters
- covariant T @35
- defaultType: dynamic
- covariant U @38
- defaultType: dynamic
- constructors
- factory @53
- redirectedConstructor: ConstructorMember
- base: self::@class::C::@constructor::•
- substitution: {T: U, U: T}
- methods
- abstract B_ @70
- returnType: dynamic
- class C @84
- typeParameters
- covariant T @86
- defaultType: dynamic
- covariant U @89
- defaultType: dynamic
- supertype: B<U, T>
- constructors
- @112
- typeAliases
- A @8
- typeParameters
- covariant T @10
- defaultType: dynamic
- covariant U @13
- defaultType: dynamic
- aliasedType: C<T, U>
-''');
- }
-
- test_constructor_redirected_factory_unnamed_imported() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-class D extends C {
- D() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart';
-class C {
- factory C() = D;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart
- definingUnit
- classes
- class C @25
- constructors
- factory @39
- redirectedConstructor: foo.dart::@class::D::@constructor::•
- _ @52
- periodOffset: 51
- nameEnd: 53
-''');
- }
-
- test_constructor_redirected_factory_unnamed_imported_generic() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-class D<T, U> extends C<U, T> {
- D() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart';
-class C<T, U> {
- factory C() = D<U, T>;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart
- definingUnit
- classes
- class C @25
- typeParameters
- covariant T @27
- defaultType: dynamic
- covariant U @30
- defaultType: dynamic
- constructors
- factory @45
- redirectedConstructor: ConstructorMember
- base: foo.dart::@class::D::@constructor::•
- substitution: {T: U, U: T}
- _ @64
- periodOffset: 63
- nameEnd: 65
-''');
- }
-
- test_constructor_redirected_factory_unnamed_imported_viaTypeAlias() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-typedef A = B;
-class B extends C {
- B() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart';
-class C {
- factory C() = A;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart
- definingUnit
- classes
- class C @25
- constructors
- factory @39
- redirectedConstructor: foo.dart::@class::B::@constructor::•
- _ @52
- periodOffset: 51
- nameEnd: 53
-''');
- }
-
- test_constructor_redirected_factory_unnamed_prefixed() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-class D extends C {
- D() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart' as foo;
-class C {
- factory C() = foo.D;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart as foo @21
- definingUnit
- classes
- class C @32
- constructors
- factory @46
- redirectedConstructor: foo.dart::@class::D::@constructor::•
- _ @63
- periodOffset: 62
- nameEnd: 64
-''');
- }
-
- test_constructor_redirected_factory_unnamed_prefixed_generic() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-class D<T, U> extends C<U, T> {
- D() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart' as foo;
-class C<T, U> {
- factory C() = foo.D<U, T>;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart as foo @21
- definingUnit
- classes
- class C @32
- typeParameters
- covariant T @34
- defaultType: dynamic
- covariant U @37
- defaultType: dynamic
- constructors
- factory @52
- redirectedConstructor: ConstructorMember
- base: foo.dart::@class::D::@constructor::•
- substitution: {T: U, U: T}
- _ @75
- periodOffset: 74
- nameEnd: 76
-''');
- }
-
- test_constructor_redirected_factory_unnamed_prefixed_viaTypeAlias() async {
- addLibrarySource('/foo.dart', '''
-import 'test.dart';
-typedef A = B;
-class B extends C {
- B() : super._();
-}
-''');
- var library = await checkLibrary('''
-import 'foo.dart' as foo;
-class C {
- factory C() = foo.A;
- C._();
-}
-''');
- checkElementText(library, r'''
-library
- imports
- foo.dart as foo @21
- definingUnit
- classes
- class C @32
- constructors
- factory @46
- redirectedConstructor: foo.dart::@class::B::@constructor::•
- _ @63
- periodOffset: 62
- nameEnd: 64
-''');
- }
-
- test_constructor_redirected_factory_unnamed_unresolved() async {
- var library = await checkLibrary('''
-class C<E> {
- factory C() = D<E>;
-}
-''', allowErrors: true);
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- typeParameters
- covariant E @8
- defaultType: dynamic
- constructors
- factory @23
-''');
- }
-
- test_constructor_redirected_factory_unnamed_viaTypeAlias() async {
- var library = await checkLibrary('''
-typedef A = C;
-class B {
- factory B() = A;
- B._();
-}
-class C extends B {
- C() : super._();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class B @21
- constructors
- factory @35
- redirectedConstructor: self::@class::C::@constructor::•
- _ @48
- periodOffset: 47
- nameEnd: 49
- class C @61
- supertype: B
- constructors
- @77
- typeAliases
- A @8
- aliasedType: C
-''');
- }
-
- test_constructor_redirected_thisInvocation_named() async {
- var library = await checkLibrary('''
-class C {
- const C.named();
- const C() : this.named();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- const named @20
- periodOffset: 19
- nameEnd: 25
- const @37
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @53
- rightParenthesis: ) @54
- constructorName: SimpleIdentifier
- staticElement: self::@class::C::@constructor::named
- staticType: null
- token: named @48
- period: . @47
- staticElement: self::@class::C::@constructor::named
- thisKeyword: this @43
- redirectedConstructor: self::@class::C::@constructor::named
-''');
- }
-
- test_constructor_redirected_thisInvocation_named_generic() async {
- var library = await checkLibrary('''
-class C<T> {
- const C.named();
- const C() : this.named();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- typeParameters
- covariant T @8
- defaultType: dynamic
- constructors
- const named @23
- periodOffset: 22
- nameEnd: 28
- const @40
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @56
- rightParenthesis: ) @57
- constructorName: SimpleIdentifier
- staticElement: self::@class::C::@constructor::named
- staticType: null
- token: named @51
- period: . @50
- staticElement: self::@class::C::@constructor::named
- thisKeyword: this @46
- redirectedConstructor: self::@class::C::@constructor::named
-''');
- }
-
- test_constructor_redirected_thisInvocation_named_notConst() async {
- var library = await checkLibrary('''
-class C {
- C.named();
- C() : this.named();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- named @14
- periodOffset: 13
- nameEnd: 19
- @25
- redirectedConstructor: self::@class::C::@constructor::named
-''');
- }
-
- test_constructor_redirected_thisInvocation_unnamed() async {
- var library = await checkLibrary('''
-class C {
- const C();
- const C.named() : this();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- const @18
- const named @33
- periodOffset: 32
- nameEnd: 38
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @47
- rightParenthesis: ) @48
- staticElement: self::@class::C::@constructor::•
- thisKeyword: this @43
- redirectedConstructor: self::@class::C::@constructor::•
-''');
- }
-
- test_constructor_redirected_thisInvocation_unnamed_generic() async {
- var library = await checkLibrary('''
-class C<T> {
- const C();
- const C.named() : this();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- typeParameters
- covariant T @8
- defaultType: dynamic
- constructors
- const @21
- const named @36
- periodOffset: 35
- nameEnd: 41
- constantInitializers
- RedirectingConstructorInvocation
- argumentList: ArgumentList
- leftParenthesis: ( @50
- rightParenthesis: ) @51
- staticElement: self::@class::C::@constructor::•
- thisKeyword: this @46
- redirectedConstructor: self::@class::C::@constructor::•
-''');
- }
-
- test_constructor_redirected_thisInvocation_unnamed_notConst() async {
- var library = await checkLibrary('''
-class C {
- C();
- C.named() : this();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- @12
- named @21
- periodOffset: 20
- nameEnd: 26
- redirectedConstructor: self::@class::C::@constructor::•
-''');
- }
-
- test_constructor_withCycles_const() async {
- var library = await checkLibrary('''
-class C {
- final x;
- const C() : x = const D();
-}
-class D {
- final x;
- const D() : x = const C();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- final x @18
- type: dynamic
- constructors
- const @29
- constantInitializers
- ConstructorFieldInitializer
- equals: = @37
- expression: InstanceCreationExpression
- argumentList: ArgumentList
- leftParenthesis: ( @46
- rightParenthesis: ) @47
- constructorName: ConstructorName
- staticElement: self::@class::D::@constructor::•
- type: NamedType
- name: SimpleIdentifier
- staticElement: self::@class::D
- staticType: null
- token: D @45
- type: D
- keyword: const @39
- staticType: D
- fieldName: SimpleIdentifier
- staticElement: self::@class::C::@field::x
- staticType: null
- token: x @35
- accessors
- synthetic get x @-1
- returnType: dynamic
- class D @58
- fields
- final x @70
- type: dynamic
- constructors
- const @81
- constantInitializers
- ConstructorFieldInitializer
- equals: = @89
- expression: InstanceCreationExpression
- argumentList: ArgumentList
- leftParenthesis: ( @98
- rightParenthesis: ) @99
- constructorName: ConstructorName
- staticElement: self::@class::C::@constructor::•
- type: NamedType
- name: SimpleIdentifier
- staticElement: self::@class::C
- staticType: null
- token: C @97
- type: C
- keyword: const @91
- staticType: C
- fieldName: SimpleIdentifier
- staticElement: self::@class::D::@field::x
- staticType: null
- token: x @87
- accessors
- synthetic get x @-1
- returnType: dynamic
-''');
- }
-
- test_constructor_withCycles_nonConst() async {
- var library = await checkLibrary('''
-class C {
- final x;
- C() : x = new D();
-}
-class D {
- final x;
- D() : x = new C();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- final x @18
- type: dynamic
- constructors
- @23
- accessors
- synthetic get x @-1
- returnType: dynamic
- class D @50
- fields
- final x @62
- type: dynamic
- constructors
- @67
- accessors
- synthetic get x @-1
- returnType: dynamic
-''');
- }
-
test_defaultValue_eliminateTypeParameters() async {
var library = await checkLibrary('''
class A<T> {
@@ -15964,745 +17206,6 @@
''');
}
- test_field_abstract() async {
- var library = await checkLibrary('''
-abstract class C {
- abstract int i;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- abstract class C @15
- fields
- abstract i @34
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic abstract get i @-1
- returnType: int
- synthetic abstract set i @-1
- parameters
- requiredPositional _i @-1
- type: int
- returnType: void
-''');
- }
-
- test_field_covariant() async {
- var library = await checkLibrary('''
-class C {
- covariant int x;
-}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- covariant x @26
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get x @-1
- returnType: int
- synthetic set x @-1
- parameters
- requiredPositional covariant _x @-1
- type: int
- returnType: void
-''');
- }
-
- test_field_documented() async {
- var library = await checkLibrary('''
-class C {
- /**
- * Docs
- */
- var x;
-}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- x @38
- documentationComment: /**\n * Docs\n */
- type: dynamic
- constructors
- synthetic @-1
- accessors
- synthetic get x @-1
- returnType: dynamic
- synthetic set x @-1
- parameters
- requiredPositional _x @-1
- type: dynamic
- returnType: void
-''');
- }
-
- test_field_external() async {
- var library = await checkLibrary('''
-abstract class C {
- external int i;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- abstract class C @15
- fields
- external i @34
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get i @-1
- returnType: int
- synthetic set i @-1
- parameters
- requiredPositional _i @-1
- type: int
- returnType: void
-''');
- }
-
- test_field_final_hasInitializer_hasConstConstructor() async {
- var library = await checkLibrary('''
-class C {
- final x = 42;
- const C();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- final x @18
- type: int
- constantInitializer
- IntegerLiteral
- literal: 42 @22
- staticType: int
- constructors
- const @34
- accessors
- synthetic get x @-1
- returnType: int
-''');
- }
-
- test_field_final_hasInitializer_hasConstConstructor_genericFunctionType() async {
- var library = await checkLibrary('''
-class A<T> {
- const A();
-}
-class B {
- final f = const A<int Function(double a)>();
- const B();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- typeParameters
- covariant T @8
- defaultType: dynamic
- constructors
- const @21
- class B @34
- fields
- final f @46
- type: A<int Function(double)>
- constantInitializer
- InstanceCreationExpression
- argumentList: ArgumentList
- leftParenthesis: ( @81
- rightParenthesis: ) @82
- constructorName: ConstructorName
- staticElement: ConstructorMember
- base: self::@class::A::@constructor::•
- substitution: {T: int Function(double)}
- type: NamedType
- name: SimpleIdentifier
- staticElement: self::@class::A
- staticType: null
- token: A @56
- type: A<int Function(double)>
- typeArguments: TypeArgumentList
- arguments
- GenericFunctionType
- declaredElement: GenericFunctionTypeElement
- parameters
- a
- kind: required positional
- type: double
- returnType: int
- type: int Function(double)
- functionKeyword: Function @62
- parameters: FormalParameterList
- leftParenthesis: ( @70
- parameters
- SimpleFormalParameter
- declaredElement: a@78
- declaredElementType: double
- identifier: SimpleIdentifier
- staticElement: a@78
- staticType: null
- token: a @78
- type: NamedType
- name: SimpleIdentifier
- staticElement: dart:core::@class::double
- staticType: null
- token: double @71
- type: double
- rightParenthesis: ) @79
- returnType: NamedType
- name: SimpleIdentifier
- staticElement: dart:core::@class::int
- staticType: null
- token: int @58
- type: int
- type: int Function(double)
- leftBracket: < @57
- rightBracket: > @80
- keyword: const @50
- staticType: A<int Function(double)>
- constructors
- const @93
- accessors
- synthetic get f @-1
- returnType: A<int Function(double)>
-''');
- }
-
- test_field_final_hasInitializer_noConstConstructor() async {
- var library = await checkLibrary('''
-class C {
- final x = 42;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- final x @18
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get x @-1
- returnType: int
-''');
- }
-
- test_field_formal_param_inferred_type_implicit() async {
- var library = await checkLibrary('class C extends D { var v; C(this.v); }'
- ' abstract class D { int get v; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- supertype: D
- fields
- v @24
- type: int
- constructors
- @27
- parameters
- requiredPositional final this.v @34
- type: int
- accessors
- synthetic get v @-1
- returnType: int
- synthetic set v @-1
- parameters
- requiredPositional _v @-1
- type: int
- returnType: void
- abstract class D @55
- fields
- synthetic v @-1
- type: int
- constructors
- synthetic @-1
- accessors
- abstract get v @67
- returnType: int
-''');
- }
-
- test_field_inferred_type_nonStatic_explicit_initialized() async {
- var library = await checkLibrary('class C { num v = 0; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- v @14
- type: num
- constructors
- synthetic @-1
- accessors
- synthetic get v @-1
- returnType: num
- synthetic set v @-1
- parameters
- requiredPositional _v @-1
- type: num
- returnType: void
-''');
- }
-
- test_field_inferred_type_nonStatic_implicit_initialized() async {
- var library = await checkLibrary('class C { var v = 0; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- v @14
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get v @-1
- returnType: int
- synthetic set v @-1
- parameters
- requiredPositional _v @-1
- type: int
- returnType: void
-''');
- }
-
- test_field_inferred_type_nonStatic_implicit_uninitialized() async {
- var library = await checkLibrary(
- 'class C extends D { var v; } abstract class D { int get v; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- supertype: D
- fields
- v @24
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get v @-1
- returnType: int
- synthetic set v @-1
- parameters
- requiredPositional _v @-1
- type: int
- returnType: void
- abstract class D @44
- fields
- synthetic v @-1
- type: int
- constructors
- synthetic @-1
- accessors
- abstract get v @56
- returnType: int
-''');
- }
-
- test_field_inferred_type_nonStatic_inherited_resolveInitializer() async {
- var library = await checkLibrary(r'''
-const a = 0;
-abstract class A {
- const A();
- List<int> get f;
-}
-class B extends A {
- const B();
- final f = [a];
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- abstract class A @28
- fields
- synthetic f @-1
- type: List<int>
- constructors
- const @40
- accessors
- abstract get f @61
- returnType: List<int>
- class B @72
- supertype: A
- fields
- final f @107
- type: List<int>
- constantInitializer
- ListLiteral
- elements
- SimpleIdentifier
- staticElement: self::@getter::a
- staticType: int
- token: a @112
- leftBracket: [ @111
- rightBracket: ] @113
- staticType: List<int>
- constructors
- const @94
- accessors
- synthetic get f @-1
- returnType: List<int>
- topLevelVariables
- static const a @6
- type: int
- constantInitializer
- IntegerLiteral
- literal: 0 @10
- staticType: int
- accessors
- synthetic static get a @-1
- returnType: int
-''');
- }
-
- test_field_inferred_type_static_implicit_initialized() async {
- var library = await checkLibrary('class C { static var v = 0; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- static v @21
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic static get v @-1
- returnType: int
- synthetic static set v @-1
- parameters
- requiredPositional _v @-1
- type: int
- returnType: void
-''');
- }
-
- test_field_propagatedType_const_noDep() async {
- var library = await checkLibrary('''
-class C {
- static const x = 0;
-}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- static const x @25
- type: int
- constantInitializer
- IntegerLiteral
- literal: 0 @29
- staticType: int
- constructors
- synthetic @-1
- accessors
- synthetic static get x @-1
- returnType: int
-''');
- }
-
- test_field_propagatedType_final_dep_inLib() async {
- addLibrarySource('/a.dart', 'final a = 1;');
- var library = await checkLibrary('''
-import "a.dart";
-class C {
- final b = a / 2;
-}''');
- checkElementText(library, r'''
-library
- imports
- a.dart
- definingUnit
- classes
- class C @23
- fields
- final b @35
- type: double
- constructors
- synthetic @-1
- accessors
- synthetic get b @-1
- returnType: double
-''');
- }
-
- test_field_propagatedType_final_dep_inPart() async {
- addSource('/a.dart', 'part of lib; final a = 1;');
- var library = await checkLibrary('''
-library lib;
-part "a.dart";
-class C {
- final b = a / 2;
-}''');
- checkElementText(library, r'''
-library
- name: lib
- nameOffset: 8
- definingUnit
- classes
- class C @34
- fields
- final b @46
- type: double
- constructors
- synthetic @-1
- accessors
- synthetic get b @-1
- returnType: double
- parts
- a.dart
- topLevelVariables
- static final a @19
- type: int
- accessors
- synthetic static get a @-1
- returnType: int
-''');
- }
-
- test_field_propagatedType_final_noDep_instance() async {
- var library = await checkLibrary('''
-class C {
- final x = 0;
-}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- final x @18
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get x @-1
- returnType: int
-''');
- }
-
- test_field_propagatedType_final_noDep_static() async {
- var library = await checkLibrary('''
-class C {
- static final x = 0;
-}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- static final x @25
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic static get x @-1
- returnType: int
-''');
- }
-
- test_field_static_final_untyped() async {
- var library = await checkLibrary('class C { static final x = 0; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- static final x @23
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic static get x @-1
- returnType: int
-''');
- }
-
- test_field_type_inferred_Never() async {
- var library = await checkLibrary(r'''
-class C {
- var a = throw 42;
-}
-''');
-
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- a @16
- type: Never
- constructors
- synthetic @-1
- accessors
- synthetic get a @-1
- returnType: Never
- synthetic set a @-1
- parameters
- requiredPositional _a @-1
- type: Never
- returnType: void
-''');
- }
-
- test_field_type_inferred_nonNullify() async {
- addSource('/a.dart', '''
-// @dart = 2.7
-var a = 0;
-''');
-
- var library = await checkLibrary(r'''
-import 'a.dart';
-class C {
- var b = a;
-}
-''');
-
- checkElementText(library, r'''
-library
- imports
- a.dart
- definingUnit
- classes
- class C @23
- fields
- b @33
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get b @-1
- returnType: int
- synthetic set b @-1
- parameters
- requiredPositional _b @-1
- type: int
- returnType: void
-''');
- }
-
- test_field_typed() async {
- var library = await checkLibrary('class C { int x = 0; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- x @14
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get x @-1
- returnType: int
- synthetic set x @-1
- parameters
- requiredPositional _x @-1
- type: int
- returnType: void
-''');
- }
-
- test_field_untyped() async {
- var library = await checkLibrary('class C { var x = 0; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- x @14
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get x @-1
- returnType: int
- synthetic set x @-1
- parameters
- requiredPositional _x @-1
- type: int
- returnType: void
-''');
- }
-
- test_finalField_hasConstConstructor() async {
- var library = await checkLibrary(r'''
-class C1 {
- final List<int> f1 = const [];
- const C1();
-}
-class C2 {
- final List<int> f2 = const [];
- C2();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C1 @6
- fields
- final f1 @30
- type: List<int>
- constantInitializer
- ListLiteral
- constKeyword: const @35
- leftBracket: [ @41
- rightBracket: ] @42
- staticType: List<int>
- constructors
- const @53
- accessors
- synthetic get f1 @-1
- returnType: List<int>
- class C2 @67
- fields
- final f2 @91
- type: List<int>
- constructors
- @108
- accessors
- synthetic get f2 @-1
- returnType: List<int>
-''');
- }
-
test_function_async() async {
var library = await checkLibrary(r'''
import 'dart:async';
@@ -21779,71 +22282,6 @@
''');
}
- test_member_function_async() async {
- var library = await checkLibrary(r'''
-import 'dart:async';
-class C {
- Future f() async {}
-}
-''');
- checkElementText(library, r'''
-library
- imports
- dart:async
- definingUnit
- classes
- class C @27
- constructors
- synthetic @-1
- methods
- f @40 async
- returnType: Future<dynamic>
-''');
- }
-
- test_member_function_asyncStar() async {
- var library = await checkLibrary(r'''
-import 'dart:async';
-class C {
- Stream f() async* {}
-}
-''');
- checkElementText(library, r'''
-library
- imports
- dart:async
- definingUnit
- classes
- class C @27
- constructors
- synthetic @-1
- methods
- f @40 async*
- returnType: Stream<dynamic>
-''');
- }
-
- test_member_function_syncStar() async {
- var library = await checkLibrary(r'''
-class C {
- Iterable<int> f() sync* {
- yield 42;
- }
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- f @26 sync*
- returnType: Iterable<int>
-''');
- }
-
test_metadata_class_field_first() async {
var library = await checkLibrary(r'''
const a = 0;
@@ -25931,187 +26369,6 @@
''');
}
- test_method_documented() async {
- var library = await checkLibrary('''
-class C {
- /**
- * Docs
- */
- f() {}
-}''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- f @34
- documentationComment: /**\n * Docs\n */
- returnType: dynamic
-''');
- }
-
- test_method_hasImplicitReturnType_false() async {
- var library = await checkLibrary('''
-class C {
- int m() => 0;
-}
-''');
- var c = library.definingCompilationUnit.classes.single;
- var m = c.methods.single;
- expect(m.hasImplicitReturnType, isFalse);
- }
-
- test_method_hasImplicitReturnType_true() async {
- var library = await checkLibrary('''
-class C {
- m() => 0;
-}
-''');
- var c = library.definingCompilationUnit.classes.single;
- var m = c.methods.single;
- expect(m.hasImplicitReturnType, isTrue);
- }
-
- test_method_inferred_type_nonStatic_implicit_param() async {
- var library = await checkLibrary('class C extends D { void f(value) {} }'
- ' abstract class D { void f(int value); }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- supertype: D
- constructors
- synthetic @-1
- methods
- f @25
- parameters
- requiredPositional value @27
- type: int
- returnType: void
- abstract class D @54
- constructors
- synthetic @-1
- methods
- abstract f @63
- parameters
- requiredPositional value @69
- type: int
- returnType: void
-''');
- }
-
- test_method_inferred_type_nonStatic_implicit_return() async {
- var library = await checkLibrary('''
-class C extends D {
- f() => null;
-}
-abstract class D {
- int f();
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- supertype: D
- constructors
- synthetic @-1
- methods
- f @22
- returnType: int
- abstract class D @52
- constructors
- synthetic @-1
- methods
- abstract f @62
- returnType: int
-''');
- }
-
- test_method_type_parameter() async {
- var library = await checkLibrary('class C { T f<T, U>(U u) => null; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- f @12
- typeParameters
- covariant T @14
- covariant U @17
- parameters
- requiredPositional u @22
- type: U
- returnType: T
-''');
- }
-
- test_method_type_parameter_in_generic_class() async {
- var library = await checkLibrary('''
-class C<T, U> {
- V f<V, W>(T t, U u, W w) => null;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- typeParameters
- covariant T @8
- defaultType: dynamic
- covariant U @11
- defaultType: dynamic
- constructors
- synthetic @-1
- methods
- f @20
- typeParameters
- covariant V @22
- covariant W @25
- parameters
- requiredPositional t @30
- type: T
- requiredPositional u @35
- type: U
- requiredPositional w @40
- type: W
- returnType: V
-''');
- }
-
- test_method_type_parameter_with_function_typed_parameter() async {
- var library = await checkLibrary('class C { void f<T, U>(T x(U u)) {} }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- f @15
- typeParameters
- covariant T @17
- covariant U @20
- parameters
- requiredPositional x @25
- type: T Function(U)
- parameters
- requiredPositional u @29
- type: U
- returnType: void
-''');
- }
-
test_methodInvocation_implicitCall() async {
var library = await checkLibrary(r'''
class A {
@@ -27586,203 +27843,6 @@
withNonSynthetic: true);
}
- test_old_typedef_notSimplyBounded_self() async {
- var library = await checkLibrary('''
-typedef void F<T extends F>();
-''');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased notSimplyBounded F @13
- typeParameters
- unrelated T @15
- bound: dynamic
- defaultType: dynamic
- aliasedType: void Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: void
-''');
- }
-
- test_old_typedef_notSimplyBounded_simple_because_non_generic() async {
- var library = await checkLibrary('''
-typedef void F();
-''');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @13
- aliasedType: void Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: void
-''');
- }
-
- test_old_typedef_notSimplyBounded_simple_no_bounds() async {
- var library = await checkLibrary('typedef void F<T>();');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @13
- typeParameters
- unrelated T @15
- defaultType: dynamic
- aliasedType: void Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: void
-''');
- }
-
- test_operator() async {
- var library =
- await checkLibrary('class C { C operator+(C other) => null; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- + @20
- parameters
- requiredPositional other @24
- type: C
- returnType: C
-''');
- }
-
- test_operator_equal() async {
- var library = await checkLibrary('''
-class C {
- bool operator==(Object other) => false;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- == @25
- parameters
- requiredPositional other @35
- type: Object
- returnType: bool
-''');
- }
-
- test_operator_external() async {
- var library =
- await checkLibrary('class C { external C operator+(C other); }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- external + @29
- parameters
- requiredPositional other @33
- type: C
- returnType: C
-''');
- }
-
- test_operator_greater_equal() async {
- var library = await checkLibrary('''
-class C {
- bool operator>=(C other) => false;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- >= @25
- parameters
- requiredPositional other @30
- type: C
- returnType: bool
-''');
- }
-
- test_operator_index() async {
- var library =
- await checkLibrary('class C { bool operator[](int i) => null; }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- [] @23
- parameters
- requiredPositional i @30
- type: int
- returnType: bool
-''');
- }
-
- test_operator_index_set() async {
- var library = await checkLibrary('''
-class C {
- void operator[]=(int i, bool v) {}
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- []= @25
- parameters
- requiredPositional i @33
- type: int
- requiredPositional v @41
- type: bool
- returnType: void
-''');
- }
-
- test_operator_less_equal() async {
- var library = await checkLibrary('''
-class C {
- bool operator<=(C other) => false;
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- constructors
- synthetic @-1
- methods
- <= @25
- parameters
- requiredPositional other @30
- type: C
- returnType: bool
-''');
- }
-
test_parameter() async {
var library = await checkLibrary('void main(int p) {}');
checkElementText(library, r'''
@@ -28292,28 +28352,6 @@
''');
}
- test_setter_covariant() async {
- var library =
- await checkLibrary('class C { void set x(covariant int value); }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- synthetic x @-1
- type: int
- constructors
- synthetic @-1
- accessors
- abstract set x @19
- parameters
- requiredPositional covariant value @35
- type: int
- returnType: void
-''');
- }
-
test_setter_documented() async {
var library = await checkLibrary('''
// Extra comment so doc comment offset != 0
@@ -28354,136 +28392,6 @@
''');
}
- test_setter_inferred_type_conflictingInheritance() async {
- var library = await checkLibrary('''
-class A {
- int t;
-}
-class B extends A {
- double t;
-}
-class C extends A implements B {
-}
-class D extends C {
- void set t(p) {}
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class A @6
- fields
- t @16
- type: int
- constructors
- synthetic @-1
- accessors
- synthetic get t @-1
- returnType: int
- synthetic set t @-1
- parameters
- requiredPositional _t @-1
- type: int
- returnType: void
- class B @27
- supertype: A
- fields
- t @50
- type: double
- constructors
- synthetic @-1
- accessors
- synthetic get t @-1
- returnType: double
- synthetic set t @-1
- parameters
- requiredPositional _t @-1
- type: double
- returnType: void
- class C @61
- supertype: A
- interfaces
- B
- constructors
- synthetic @-1
- class D @96
- supertype: C
- fields
- synthetic t @-1
- type: dynamic
- constructors
- synthetic @-1
- accessors
- set t @121
- parameters
- requiredPositional p @123
- type: dynamic
- returnType: void
-''');
- }
-
- test_setter_inferred_type_nonStatic_implicit_param() async {
- var library =
- await checkLibrary('class C extends D { void set f(value) {} }'
- ' abstract class D { void set f(int value); }');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- supertype: D
- fields
- synthetic f @-1
- type: int
- constructors
- synthetic @-1
- accessors
- set f @29
- parameters
- requiredPositional value @31
- type: int
- returnType: void
- abstract class D @58
- fields
- synthetic f @-1
- type: int
- constructors
- synthetic @-1
- accessors
- abstract set f @71
- parameters
- requiredPositional value @77
- type: int
- returnType: void
-''');
- }
-
- test_setter_inferred_type_static_implicit_return() async {
- var library = await checkLibrary('''
-class C {
- static set f(int value) {}
-}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class C @6
- fields
- synthetic static f @-1
- type: int
- constructors
- synthetic @-1
- accessors
- static set f @23
- parameters
- requiredPositional value @29
- type: int
- returnType: void
-''');
- }
-
test_setter_inferred_type_top_level_implicit_return() async {
var library = await checkLibrary('set f(int value) {}');
checkElementText(library, r'''
@@ -31012,26 +30920,7 @@
''');
}
- test_typedef_documented() async {
- var library = await checkLibrary('''
-// Extra comment so doc comment offset != 0
-/**
- * Docs
- */
-typedef F();''');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @68
- documentationComment: /**\n * Docs\n */
- aliasedType: dynamic Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: dynamic
-''');
- }
-
- test_typedef_generic() async {
+ test_typedef_function_generic() async {
var library = await checkLibrary(
'typedef F<T> = int Function<S>(List<S> list, num Function<A>(A), T);');
checkElementText(library, r'''
@@ -31057,7 +30946,7 @@
''');
}
- test_typedef_generic_asFieldType() async {
+ test_typedef_function_generic_asFieldType() async {
var library = await checkLibrary(r'''
typedef Foo<S> = S Function<T>(T x);
class A {
@@ -31107,31 +30996,635 @@
''');
}
- test_typedef_generic_invalid() async {
+ test_typedef_function_notSimplyBounded_dependency_via_param_type_name_included() async {
+ // F is considered "not simply bounded" because it expands to a type that
+ // refers to C, which is not simply bounded.
var library = await checkLibrary('''
-typedef F = int;
-F f;
+typedef F = void Function(C c);
+class C<T extends C<T>> {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ notSimplyBounded class C @38
+ typeParameters
+ covariant T @40
+ bound: C<T>
+ defaultType: C<dynamic>
+ constructors
+ synthetic @-1
+ typeAliases
+ notSimplyBounded F @8
+ aliasedType: void Function(C<C<dynamic>>)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional c @28
+ type: C<C<dynamic>>
+ returnType: void
+''');
+ }
+
+ test_typedef_function_notSimplyBounded_dependency_via_param_type_name_omitted() async {
+ // F is considered "not simply bounded" because it expands to a type that
+ // refers to C, which is not simply bounded.
+ var library = await checkLibrary('''
+typedef F = void Function(C);
+class C<T extends C<T>> {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ notSimplyBounded class C @36
+ typeParameters
+ covariant T @38
+ bound: C<T>
+ defaultType: C<dynamic>
+ constructors
+ synthetic @-1
+ typeAliases
+ notSimplyBounded F @8
+ aliasedType: void Function(C<C<dynamic>>)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional @-1
+ type: C<C<dynamic>>
+ returnType: void
+''');
+ }
+
+ test_typedef_function_notSimplyBounded_dependency_via_return_type() async {
+ // F is considered "not simply bounded" because it expands to a type that
+ // refers to C, which is not simply bounded.
+ var library = await checkLibrary('''
+typedef F = C Function();
+class C<T extends C<T>> {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ notSimplyBounded class C @32
+ typeParameters
+ covariant T @34
+ bound: C<T>
+ defaultType: C<dynamic>
+ constructors
+ synthetic @-1
+ typeAliases
+ notSimplyBounded F @8
+ aliasedType: C<C<dynamic>> Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: C<C<dynamic>>
+''');
+ }
+
+ test_typedef_function_typeParameters_f_bound_simple() async {
+ var library =
+ await checkLibrary('typedef F<T extends U, U> = U Function(T t);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ notSimplyBounded F @8
+ typeParameters
+ contravariant T @10
+ bound: U
+ defaultType: Never
+ covariant U @23
+ defaultType: dynamic
+ aliasedType: U Function(T)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @41
+ type: T
+ returnType: U
+''');
+ }
+
+ test_typedef_function_typeParameters_f_bound_simple_legacy() async {
+ featureSet = FeatureSets.language_2_9;
+ var library =
+ await checkLibrary('typedef F<T extends U, U> = U Function(T t);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ notSimplyBounded F @8
+ typeParameters
+ contravariant T @10
+ bound: U*
+ defaultType: Null*
+ covariant U @23
+ defaultType: dynamic
+ aliasedType: U* Function(T*)*
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @41
+ type: T*
+ returnType: U*
+''');
+ }
+
+ test_typedef_legacy_documented() async {
+ var library = await checkLibrary('''
+// Extra comment so doc comment offset != 0
+/**
+ * Docs
+ */
+typedef F();''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @68
+ documentationComment: /**\n * Docs\n */
+ aliasedType: dynamic Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_notSimplyBounded_dependency_via_param_type() async {
+ // F is considered "not simply bounded" because it expands to a type that
+ // refers to C, which is not simply bounded.
+ var library = await checkLibrary('''
+typedef void F(C c);
+class C<T extends C<T>> {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ notSimplyBounded class C @27
+ typeParameters
+ covariant T @29
+ bound: C<T>
+ defaultType: C<dynamic>
+ constructors
+ synthetic @-1
+ typeAliases
+ functionTypeAliasBased notSimplyBounded F @13
+ aliasedType: void Function(C<C<dynamic>>)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional c @17
+ type: C<C<dynamic>>
+ returnType: void
+''');
+ }
+
+ test_typedef_legacy_notSimplyBounded_dependency_via_return_type() async {
+ // F is considered "not simply bounded" because it expands to a type that
+ // refers to C, which is not simply bounded.
+ var library = await checkLibrary('''
+typedef C F();
+class C<T extends C<T>> {}
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ notSimplyBounded class C @21
+ typeParameters
+ covariant T @23
+ bound: C<T>
+ defaultType: C<dynamic>
+ constructors
+ synthetic @-1
+ typeAliases
+ functionTypeAliasBased notSimplyBounded F @10
+ aliasedType: C<C<dynamic>> Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: C<C<dynamic>>
+''');
+ }
+
+ test_typedef_legacy_notSimplyBounded_self() async {
+ var library = await checkLibrary('''
+typedef void F<T extends F>();
''');
checkElementText(library, r'''
library
definingUnit
typeAliases
- F @8
- aliasedType: int
- topLevelVariables
- static f @19
- type: int
- aliasElement: self::@typeAlias::F
- accessors
- synthetic static get f @-1
- returnType: int
- aliasElement: self::@typeAlias::F
- synthetic static set f @-1
- parameters
- requiredPositional _f @-1
- type: int
- aliasElement: self::@typeAlias::F
- returnType: void
+ functionTypeAliasBased notSimplyBounded F @13
+ typeParameters
+ unrelated T @15
+ bound: dynamic
+ defaultType: dynamic
+ aliasedType: void Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: void
+''');
+ }
+
+ test_typedef_legacy_notSimplyBounded_simple_because_non_generic() async {
+ var library = await checkLibrary('''
+typedef void F();
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @13
+ aliasedType: void Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: void
+''');
+ }
+
+ test_typedef_legacy_notSimplyBounded_simple_no_bounds() async {
+ var library = await checkLibrary('typedef void F<T>();');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @13
+ typeParameters
+ unrelated T @15
+ defaultType: dynamic
+ aliasedType: void Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: void
+''');
+ }
+
+ test_typedef_legacy_parameter_hasImplicitType() async {
+ var library = await checkLibrary(r'''
+typedef void F(int a, b, [int c, d]);
+''');
+ var F = library.definingCompilationUnit.typeAliases.single;
+ var function = F.aliasedElement as GenericFunctionTypeElement;
+ // TODO(scheglov) Use better textual presentation with all information.
+ expect(function.parameters[0].hasImplicitType, false);
+ expect(function.parameters[1].hasImplicitType, true);
+ expect(function.parameters[2].hasImplicitType, false);
+ expect(function.parameters[3].hasImplicitType, true);
+ }
+
+ test_typedef_legacy_parameter_parameters() async {
+ var library = await checkLibrary('typedef F(g(x, y));');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @8
+ aliasedType: dynamic Function(dynamic Function(dynamic, dynamic))
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional g @10
+ type: dynamic Function(dynamic, dynamic)
+ parameters
+ requiredPositional x @12
+ type: dynamic
+ requiredPositional y @15
+ type: dynamic
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_parameter_parameters_in_generic_class() async {
+ var library = await checkLibrary('typedef F<A, B>(A g(B x));');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @8
+ typeParameters
+ contravariant A @10
+ defaultType: dynamic
+ covariant B @13
+ defaultType: dynamic
+ aliasedType: dynamic Function(A Function(B))
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional g @18
+ type: A Function(B)
+ parameters
+ requiredPositional x @22
+ type: B
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_parameter_return_type() async {
+ var library = await checkLibrary('typedef F(int g());');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @8
+ aliasedType: dynamic Function(int Function())
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional g @14
+ type: int Function()
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_parameter_type() async {
+ var library = await checkLibrary('typedef F(int i);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @8
+ aliasedType: dynamic Function(int)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional i @14
+ type: int
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_parameter_type_generic() async {
+ var library = await checkLibrary('typedef F<T>(T t);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @8
+ typeParameters
+ contravariant T @10
+ defaultType: dynamic
+ aliasedType: dynamic Function(T)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @15
+ type: T
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_parameters() async {
+ var library = await checkLibrary('typedef F(x, y);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @8
+ aliasedType: dynamic Function(dynamic, dynamic)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional x @10
+ type: dynamic
+ requiredPositional y @13
+ type: dynamic
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_parameters_named() async {
+ var library = await checkLibrary('typedef F({y, z, x});');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @8
+ aliasedType: dynamic Function({dynamic x, dynamic y, dynamic z})
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ optionalNamed y @11
+ type: dynamic
+ optionalNamed z @14
+ type: dynamic
+ optionalNamed x @17
+ type: dynamic
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_return_type() async {
+ var library = await checkLibrary('typedef int F();');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @12
+ aliasedType: int Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: int
+''');
+ }
+
+ test_typedef_legacy_return_type_generic() async {
+ var library = await checkLibrary('typedef T F<T>();');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @10
+ typeParameters
+ covariant T @12
+ defaultType: dynamic
+ aliasedType: T Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: T
+''');
+ }
+
+ test_typedef_legacy_return_type_implicit() async {
+ var library = await checkLibrary('typedef F();');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @8
+ aliasedType: dynamic Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: dynamic
+''');
+ }
+
+ test_typedef_legacy_return_type_void() async {
+ var library = await checkLibrary('typedef void F();');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @13
+ aliasedType: void Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: void
+''');
+ }
+
+ test_typedef_legacy_typeParameters() async {
+ var library = await checkLibrary('typedef U F<T, U>(T t);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased F @10
+ typeParameters
+ contravariant T @12
+ defaultType: dynamic
+ covariant U @15
+ defaultType: dynamic
+ aliasedType: U Function(T)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @20
+ type: T
+ returnType: U
+''');
+ }
+
+ test_typedef_legacy_typeParameters_bound() async {
+ var library = await checkLibrary(
+ 'typedef U F<T extends Object, U extends D>(T t); class D {}');
+ checkElementText(library, r'''
+library
+ definingUnit
+ classes
+ class D @55
+ constructors
+ synthetic @-1
+ typeAliases
+ functionTypeAliasBased F @10
+ typeParameters
+ contravariant T @12
+ bound: Object
+ defaultType: Object
+ covariant U @30
+ bound: D
+ defaultType: D
+ aliasedType: U Function(T)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @45
+ type: T
+ returnType: U
+''');
+ }
+
+ test_typedef_legacy_typeParameters_bound_recursive() async {
+ var library = await checkLibrary('typedef void F<T extends F>();');
+ // Typedefs cannot reference themselves.
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased notSimplyBounded F @13
+ typeParameters
+ unrelated T @15
+ bound: dynamic
+ defaultType: dynamic
+ aliasedType: void Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: void
+''');
+ }
+
+ test_typedef_legacy_typeParameters_bound_recursive2() async {
+ var library = await checkLibrary('typedef void F<T extends List<F>>();');
+ // Typedefs cannot reference themselves.
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased notSimplyBounded F @13
+ typeParameters
+ unrelated T @15
+ bound: List<dynamic>
+ defaultType: dynamic
+ aliasedType: void Function()
+ aliasedElement: GenericFunctionTypeElement
+ returnType: void
+''');
+ }
+
+ test_typedef_legacy_typeParameters_f_bound_complex() async {
+ var library = await checkLibrary('typedef U F<T extends List<U>, U>(T t);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased notSimplyBounded F @10
+ typeParameters
+ contravariant T @12
+ bound: List<U>
+ defaultType: List<Never>
+ covariant U @31
+ defaultType: dynamic
+ aliasedType: U Function(T)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @36
+ type: T
+ returnType: U
+''');
+ }
+
+ test_typedef_legacy_typeParameters_f_bound_complex_legacy() async {
+ featureSet = FeatureSets.language_2_9;
+ var library = await checkLibrary('typedef U F<T extends List<U>, U>(T t);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased notSimplyBounded F @10
+ typeParameters
+ contravariant T @12
+ bound: List<U*>*
+ defaultType: List<Null*>*
+ covariant U @31
+ defaultType: dynamic
+ aliasedType: U* Function(T*)*
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @36
+ type: T*
+ returnType: U*
+''');
+ }
+
+ test_typedef_legacy_typeParameters_f_bound_simple() async {
+ var library = await checkLibrary('typedef U F<T extends U, U>(T t);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased notSimplyBounded F @10
+ typeParameters
+ contravariant T @12
+ bound: U
+ defaultType: Never
+ covariant U @25
+ defaultType: dynamic
+ aliasedType: U Function(T)
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @30
+ type: T
+ returnType: U
+''');
+ }
+
+ test_typedef_legacy_typeParameters_f_bound_simple_legacy() async {
+ featureSet = FeatureSets.language_2_9;
+ var library = await checkLibrary('typedef U F<T extends U, U>(T t);');
+ checkElementText(library, r'''
+library
+ definingUnit
+ typeAliases
+ functionTypeAliasBased notSimplyBounded F @10
+ typeParameters
+ contravariant T @12
+ bound: U*
+ defaultType: Null*
+ covariant U @25
+ defaultType: dynamic
+ aliasedType: U* Function(T*)*
+ aliasedElement: GenericFunctionTypeElement
+ parameters
+ requiredPositional t @30
+ type: T*
+ returnType: U*
''');
}
@@ -32074,569 +32567,6 @@
''');
}
- test_typedef_notSimplyBounded_dependency_via_param_type_new_style_name_included() async {
- // F is considered "not simply bounded" because it expands to a type that
- // refers to C, which is not simply bounded.
- var library = await checkLibrary('''
-typedef F = void Function(C c);
-class C<T extends C<T>> {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- notSimplyBounded class C @38
- typeParameters
- covariant T @40
- bound: C<T>
- defaultType: C<dynamic>
- constructors
- synthetic @-1
- typeAliases
- notSimplyBounded F @8
- aliasedType: void Function(C<C<dynamic>>)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional c @28
- type: C<C<dynamic>>
- returnType: void
-''');
- }
-
- test_typedef_notSimplyBounded_dependency_via_param_type_new_style_name_omitted() async {
- // F is considered "not simply bounded" because it expands to a type that
- // refers to C, which is not simply bounded.
- var library = await checkLibrary('''
-typedef F = void Function(C);
-class C<T extends C<T>> {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- notSimplyBounded class C @36
- typeParameters
- covariant T @38
- bound: C<T>
- defaultType: C<dynamic>
- constructors
- synthetic @-1
- typeAliases
- notSimplyBounded F @8
- aliasedType: void Function(C<C<dynamic>>)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional @-1
- type: C<C<dynamic>>
- returnType: void
-''');
- }
-
- test_typedef_notSimplyBounded_dependency_via_param_type_old_style() async {
- // F is considered "not simply bounded" because it expands to a type that
- // refers to C, which is not simply bounded.
- var library = await checkLibrary('''
-typedef void F(C c);
-class C<T extends C<T>> {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- notSimplyBounded class C @27
- typeParameters
- covariant T @29
- bound: C<T>
- defaultType: C<dynamic>
- constructors
- synthetic @-1
- typeAliases
- functionTypeAliasBased notSimplyBounded F @13
- aliasedType: void Function(C<C<dynamic>>)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional c @17
- type: C<C<dynamic>>
- returnType: void
-''');
- }
-
- test_typedef_notSimplyBounded_dependency_via_return_type_new_style() async {
- // F is considered "not simply bounded" because it expands to a type that
- // refers to C, which is not simply bounded.
- var library = await checkLibrary('''
-typedef F = C Function();
-class C<T extends C<T>> {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- notSimplyBounded class C @32
- typeParameters
- covariant T @34
- bound: C<T>
- defaultType: C<dynamic>
- constructors
- synthetic @-1
- typeAliases
- notSimplyBounded F @8
- aliasedType: C<C<dynamic>> Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: C<C<dynamic>>
-''');
- }
-
- test_typedef_notSimplyBounded_dependency_via_return_type_old_style() async {
- // F is considered "not simply bounded" because it expands to a type that
- // refers to C, which is not simply bounded.
- var library = await checkLibrary('''
-typedef C F();
-class C<T extends C<T>> {}
-''');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- notSimplyBounded class C @21
- typeParameters
- covariant T @23
- bound: C<T>
- defaultType: C<dynamic>
- constructors
- synthetic @-1
- typeAliases
- functionTypeAliasBased notSimplyBounded F @10
- aliasedType: C<C<dynamic>> Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: C<C<dynamic>>
-''');
- }
-
- test_typedef_parameter_hasImplicitType() async {
- var library = await checkLibrary(r'''
-typedef void F(int a, b, [int c, d]);
-''');
- var F = library.definingCompilationUnit.typeAliases.single;
- var function = F.aliasedElement as GenericFunctionTypeElement;
- // TODO(scheglov) Use better textual presentation with all information.
- expect(function.parameters[0].hasImplicitType, false);
- expect(function.parameters[1].hasImplicitType, true);
- expect(function.parameters[2].hasImplicitType, false);
- expect(function.parameters[3].hasImplicitType, true);
- }
-
- test_typedef_parameter_parameters() async {
- var library = await checkLibrary('typedef F(g(x, y));');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @8
- aliasedType: dynamic Function(dynamic Function(dynamic, dynamic))
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional g @10
- type: dynamic Function(dynamic, dynamic)
- parameters
- requiredPositional x @12
- type: dynamic
- requiredPositional y @15
- type: dynamic
- returnType: dynamic
-''');
- }
-
- test_typedef_parameter_parameters_in_generic_class() async {
- var library = await checkLibrary('typedef F<A, B>(A g(B x));');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @8
- typeParameters
- contravariant A @10
- defaultType: dynamic
- covariant B @13
- defaultType: dynamic
- aliasedType: dynamic Function(A Function(B))
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional g @18
- type: A Function(B)
- parameters
- requiredPositional x @22
- type: B
- returnType: dynamic
-''');
- }
-
- test_typedef_parameter_return_type() async {
- var library = await checkLibrary('typedef F(int g());');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @8
- aliasedType: dynamic Function(int Function())
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional g @14
- type: int Function()
- returnType: dynamic
-''');
- }
-
- test_typedef_parameter_type() async {
- var library = await checkLibrary('typedef F(int i);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @8
- aliasedType: dynamic Function(int)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional i @14
- type: int
- returnType: dynamic
-''');
- }
-
- test_typedef_parameter_type_generic() async {
- var library = await checkLibrary('typedef F<T>(T t);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @8
- typeParameters
- contravariant T @10
- defaultType: dynamic
- aliasedType: dynamic Function(T)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @15
- type: T
- returnType: dynamic
-''');
- }
-
- test_typedef_parameters() async {
- var library = await checkLibrary('typedef F(x, y);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @8
- aliasedType: dynamic Function(dynamic, dynamic)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional x @10
- type: dynamic
- requiredPositional y @13
- type: dynamic
- returnType: dynamic
-''');
- }
-
- test_typedef_parameters_named() async {
- var library = await checkLibrary('typedef F({y, z, x});');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @8
- aliasedType: dynamic Function({dynamic x, dynamic y, dynamic z})
- aliasedElement: GenericFunctionTypeElement
- parameters
- optionalNamed y @11
- type: dynamic
- optionalNamed z @14
- type: dynamic
- optionalNamed x @17
- type: dynamic
- returnType: dynamic
-''');
- }
-
- test_typedef_return_type() async {
- var library = await checkLibrary('typedef int F();');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @12
- aliasedType: int Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: int
-''');
- }
-
- test_typedef_return_type_generic() async {
- var library = await checkLibrary('typedef T F<T>();');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @10
- typeParameters
- covariant T @12
- defaultType: dynamic
- aliasedType: T Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: T
-''');
- }
-
- test_typedef_return_type_implicit() async {
- var library = await checkLibrary('typedef F();');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @8
- aliasedType: dynamic Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: dynamic
-''');
- }
-
- test_typedef_return_type_void() async {
- var library = await checkLibrary('typedef void F();');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @13
- aliasedType: void Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: void
-''');
- }
-
- test_typedef_type_parameters() async {
- var library = await checkLibrary('typedef U F<T, U>(T t);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased F @10
- typeParameters
- contravariant T @12
- defaultType: dynamic
- covariant U @15
- defaultType: dynamic
- aliasedType: U Function(T)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @20
- type: T
- returnType: U
-''');
- }
-
- test_typedef_type_parameters_bound() async {
- var library = await checkLibrary(
- 'typedef U F<T extends Object, U extends D>(T t); class D {}');
- checkElementText(library, r'''
-library
- definingUnit
- classes
- class D @55
- constructors
- synthetic @-1
- typeAliases
- functionTypeAliasBased F @10
- typeParameters
- contravariant T @12
- bound: Object
- defaultType: Object
- covariant U @30
- bound: D
- defaultType: D
- aliasedType: U Function(T)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @45
- type: T
- returnType: U
-''');
- }
-
- test_typedef_type_parameters_bound_recursive() async {
- var library = await checkLibrary('typedef void F<T extends F>();');
- // Typedefs cannot reference themselves.
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased notSimplyBounded F @13
- typeParameters
- unrelated T @15
- bound: dynamic
- defaultType: dynamic
- aliasedType: void Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: void
-''');
- }
-
- test_typedef_type_parameters_bound_recursive2() async {
- var library = await checkLibrary('typedef void F<T extends List<F>>();');
- // Typedefs cannot reference themselves.
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased notSimplyBounded F @13
- typeParameters
- unrelated T @15
- bound: List<dynamic>
- defaultType: dynamic
- aliasedType: void Function()
- aliasedElement: GenericFunctionTypeElement
- returnType: void
-''');
- }
-
- test_typedef_type_parameters_f_bound_complex() async {
- var library = await checkLibrary('typedef U F<T extends List<U>, U>(T t);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased notSimplyBounded F @10
- typeParameters
- contravariant T @12
- bound: List<U>
- defaultType: List<Never>
- covariant U @31
- defaultType: dynamic
- aliasedType: U Function(T)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @36
- type: T
- returnType: U
-''');
- }
-
- test_typedef_type_parameters_f_bound_complex_legacy() async {
- featureSet = FeatureSets.language_2_9;
- var library = await checkLibrary('typedef U F<T extends List<U>, U>(T t);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased notSimplyBounded F @10
- typeParameters
- contravariant T @12
- bound: List<U*>*
- defaultType: List<Null*>*
- covariant U @31
- defaultType: dynamic
- aliasedType: U* Function(T*)*
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @36
- type: T*
- returnType: U*
-''');
- }
-
- test_typedef_type_parameters_f_bound_simple() async {
- var library = await checkLibrary('typedef U F<T extends U, U>(T t);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased notSimplyBounded F @10
- typeParameters
- contravariant T @12
- bound: U
- defaultType: Never
- covariant U @25
- defaultType: dynamic
- aliasedType: U Function(T)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @30
- type: T
- returnType: U
-''');
- }
-
- test_typedef_type_parameters_f_bound_simple_legacy() async {
- featureSet = FeatureSets.language_2_9;
- var library = await checkLibrary('typedef U F<T extends U, U>(T t);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- functionTypeAliasBased notSimplyBounded F @10
- typeParameters
- contravariant T @12
- bound: U*
- defaultType: Null*
- covariant U @25
- defaultType: dynamic
- aliasedType: U* Function(T*)*
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @30
- type: T*
- returnType: U*
-''');
- }
-
- test_typedef_type_parameters_f_bound_simple_new_syntax() async {
- var library =
- await checkLibrary('typedef F<T extends U, U> = U Function(T t);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- notSimplyBounded F @8
- typeParameters
- contravariant T @10
- bound: U
- defaultType: Never
- covariant U @23
- defaultType: dynamic
- aliasedType: U Function(T)
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @41
- type: T
- returnType: U
-''');
- }
-
- test_typedef_type_parameters_f_bound_simple_new_syntax_legacy() async {
- featureSet = FeatureSets.language_2_9;
- var library =
- await checkLibrary('typedef F<T extends U, U> = U Function(T t);');
- checkElementText(library, r'''
-library
- definingUnit
- typeAliases
- notSimplyBounded F @8
- typeParameters
- contravariant T @10
- bound: U*
- defaultType: Null*
- covariant U @23
- defaultType: dynamic
- aliasedType: U* Function(T*)*
- aliasedElement: GenericFunctionTypeElement
- parameters
- requiredPositional t @41
- type: T*
- returnType: U*
-''');
- }
-
test_typedefs() async {
var library = await checkLibrary('f() {} g() {}');
checkElementText(library, r'''
diff --git a/pkg/analyzer_utilities/lib/tools.dart b/pkg/analyzer_utilities/lib/tools.dart
index a072d85..00724c7 100644
--- a/pkg/analyzer_utilities/lib/tools.dart
+++ b/pkg/analyzer_utilities/lib/tools.dart
@@ -283,14 +283,8 @@
if (generateNeeded) {
print('Please regenerate using:');
var executable = Platform.executable;
- var packageRoot = '';
- // ignore: deprecated_member_use
- if (Platform.packageRoot != null) {
- // ignore: deprecated_member_use
- packageRoot = ' --package-root=${Platform.packageRoot}';
- }
var generateScript = normalize(joinAll(posix.split(generatorPath)));
- print(' $executable$packageRoot $generateScript ${args.join(" ")}');
+ print(' $executable $generateScript ${args.join(" ")}');
fail('Error codes need to be generated');
} else {
print('All generated files up to date.');
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index d78db4c..088ef9c 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -168,8 +168,6 @@
}
/// Location of the package configuration file.
- ///
- /// If not null then [packageRoot] should be null.
Uri? packageConfig;
/// List of kernel files to load.
diff --git a/pkg/compiler/test/end_to_end/launch_helper.dart b/pkg/compiler/test/end_to_end/launch_helper.dart
index 7d5a2c5..f0eef27 100644
--- a/pkg/compiler/test/end_to_end/launch_helper.dart
+++ b/pkg/compiler/test/end_to_end/launch_helper.dart
@@ -6,6 +6,7 @@
import 'dart:async';
import 'dart:io';
+
import 'package:path/path.dart' as path;
List<String> dart2JsCommand(List<String> args) {
@@ -16,9 +17,7 @@
String dart2jsPath =
path.normalize(path.join(basePath, 'pkg/compiler/lib/src/dart2js.dart'));
List command = <String>[];
- if (Platform.packageRoot != null) {
- command.add('--package-root=${Platform.packageRoot}');
- } else if (Platform.packageConfig != null) {
+ if (Platform.packageConfig != null) {
command.add('--packages=${Platform.packageConfig}');
}
command.add(dart2jsPath);
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_fields.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_fields.dart.intertwined.expect
index 04790ba..769412a 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_fields.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_fields.dart.intertwined.expect
@@ -1471,27 +1471,28 @@
listener: beginMetadataStar(int)
listener: endMetadataStar(0)
listener: beginMember()
- recoverFromInvalidMember(int, ;, null, null, null, null, null, null, ;, Instance of 'SimpleType', null, DeclarationKind.Class, WrapperClass)
- parseFields(;, null, null, null, null, null, null, ;, Instance of 'SimpleType', super, DeclarationKind.Class, WrapperClass, false)
- listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, ;)
- listener: handleIdentifier(int, typeReference)
- listener: handleNoTypeArguments(super)
- listener: handleType(int, null)
- ensureIdentifierPotentiallyRecovered(int, fieldDeclaration, false)
- reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
- listener: handleIdentifier(super, fieldDeclaration)
- parseFieldInitializerOpt(super, super, null, null, null, null, DeclarationKind.Class, WrapperClass)
- listener: beginFieldInitializer(=)
- parseExpression(=)
- parsePrecedenceExpression(=, 1, true)
- parseUnaryExpression(=, true)
- parsePrimary(=, expression)
- parseLiteralInt(=)
- listener: handleLiteralInt(42)
- listener: endFieldInitializer(=, ;)
- listener: endClassFields(null, null, null, null, null, null, 1, int, ;)
- listener: endMember()
+ isReservedKeyword(super)
+ indicatesMethodOrField(=)
+ parseFields(;, null, null, null, null, null, null, ;, Instance of 'SimpleType', super, DeclarationKind.Class, WrapperClass, true)
+ listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, ;)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(int, null)
+ ensureIdentifierPotentiallyRecovered(int, fieldDeclaration, true)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, fieldDeclaration)
+ parseFieldInitializerOpt(super, super, null, null, null, null, DeclarationKind.Class, WrapperClass)
+ listener: beginFieldInitializer(=)
+ parseExpression(=)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseLiteralInt(=)
+ listener: handleLiteralInt(42)
+ listener: endFieldInitializer(=, ;)
+ listener: endClassFields(null, null, null, null, null, null, 1, int, ;)
+ listener: endMember()
notEofOrValue(}, int)
parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Class, WrapperClass)
parseMetadataStar(;)
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.expect
index eb90b675..bf58a68 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.expect
@@ -308,14 +308,6 @@
int super(int x) {
^^^^^
-parser/error_recovery/keyword_named_class_methods:282:7: Expected ';' after this.
- int super(int x) {
- ^^^^^
-
-parser/error_recovery/keyword_named_class_methods:282:12: Expected an identifier, but got '('.
- int super(int x) {
- ^
-
parser/error_recovery/keyword_named_class_methods:287:7: 'switch' can't be used as an identifier because it's a keyword.
int switch(int x) {
^^^^^^
@@ -3891,23 +3883,12 @@
beginMetadataStar(int)
endMetadataStar(0)
beginMember()
- beginFields(DeclarationKind.Class, null, null, null, null, null, null, })
+ beginMethod(DeclarationKind.Class, null, null, null, null, null, super)
handleIdentifier(int, typeReference)
handleNoTypeArguments(super)
handleType(int, null)
handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
- handleIdentifier(super, fieldDeclaration)
- handleNoFieldInitializer(()
- handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
- endClassFields(null, null, null, null, null, null, 1, int, ;)
- endMember()
- beginMetadataStar(()
- endMetadataStar(0)
- beginMember()
- beginMethod(DeclarationKind.Class, null, null, null, null, null, ()
- handleNoType(;)
- handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, ()
- handleIdentifier(, methodDeclaration)
+ handleIdentifier(super, methodDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.NonStaticMethod)
beginMetadataStar(int)
@@ -3956,7 +3937,7 @@
endBinaryExpression(+)
endReturnStatement(true, return, ;)
endBlockFunctionBody(2, {, })
- endClassMethod(null, , (, null, })
+ endClassMethod(null, int, (, null, })
endMember()
beginMetadataStar(int)
endMetadataStar(0)
@@ -4762,7 +4743,7 @@
endBlockFunctionBody(2, {, })
endClassMethod(null, int, (, null, })
endMember()
- endClassOrMixinOrExtensionBody(DeclarationKind.Class, 71, {, })
+ endClassOrMixinOrExtensionBody(DeclarationKind.Class, 70, {, })
endClassDeclaration(class, })
endTopLevelDeclaration()
endCompilationUnit(1, )
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect
index 08d5d98..22c9cba 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect
@@ -8560,164 +8560,141 @@
listener: beginMetadataStar(int)
listener: endMetadataStar(0)
listener: beginMember()
- recoverFromInvalidMember(int, }, null, null, null, null, null, null, }, Instance of 'SimpleType', null, DeclarationKind.Class, WrapperClass)
- parseFields(}, null, null, null, null, null, null, }, Instance of 'SimpleType', super, DeclarationKind.Class, WrapperClass, false)
- listener: beginFields(DeclarationKind.Class, null, null, null, null, null, null, })
- listener: handleIdentifier(int, typeReference)
- listener: handleNoTypeArguments(super)
- listener: handleType(int, null)
- ensureIdentifierPotentiallyRecovered(int, fieldDeclaration, false)
- reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
- listener: handleIdentifier(super, fieldDeclaration)
- parseFieldInitializerOpt(super, super, null, null, null, null, DeclarationKind.Class, WrapperClass)
- listener: handleNoFieldInitializer(()
- ensureSemicolon(super)
- reportRecoverableError(super, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], super, super)
- rewriter()
- listener: endClassFields(null, null, null, null, null, null, 1, int, ;)
- listener: endMember()
- notEofOrValue(}, ()
- parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Class, WrapperClass)
- parseMetadataStar(;)
- listener: beginMetadataStar(()
- listener: endMetadataStar(0)
- listener: beginMember()
- recoverFromInvalidMember(;, ;, null, null, null, null, null, null, ;, Instance of 'NoType', null, DeclarationKind.Class, WrapperClass)
- parseMethod(;, null, null, null, null, null, null, ;, Instance of 'NoType', null, (, DeclarationKind.Class, WrapperClass, false)
- listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, ()
- listener: handleNoType(;)
- ensureIdentifierPotentiallyRecovered(;, methodDeclaration, false)
- insertSyntheticIdentifier(;, methodDeclaration, message: null, messageOnToken: null)
- reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, ()
- rewriter()
- listener: handleIdentifier(, methodDeclaration)
- parseQualifiedRestOpt(, methodDeclarationContinuation)
- parseMethodTypeVar()
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(, (, false, MemberKind.NonStaticMethod)
- parseFormalParameters(, MemberKind.NonStaticMethod)
- parseFormalParametersRest((, MemberKind.NonStaticMethod)
- listener: beginFormalParameters((, MemberKind.NonStaticMethod)
- parseFormalParameter((, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
- parseMetadataStar(()
- listener: beginMetadataStar(int)
- listener: endMetadataStar(0)
- listener: beginFormalParameter(int, MemberKind.NonStaticMethod, null, null, null)
- listener: handleIdentifier(int, typeReference)
- listener: handleNoTypeArguments(x)
- listener: handleType(int, null)
- ensureIdentifier(int, formalParameterDeclaration)
- listener: handleIdentifier(x, formalParameterDeclaration)
- listener: handleFormalParameterWithoutValue())
- listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
- listener: endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
- parseInitializersOpt())
- listener: handleNoInitializers()
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
+ isReservedKeyword(super)
+ indicatesMethodOrField(()
+ parseMethod(}, null, null, null, null, null, null, }, Instance of 'SimpleType', null, super, DeclarationKind.Class, WrapperClass, true)
+ listener: beginMethod(DeclarationKind.Class, null, null, null, null, null, super)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(super)
+ listener: handleType(int, null)
+ ensureIdentifierPotentiallyRecovered(int, methodDeclaration, true)
+ reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
+ listener: handleIdentifier(super, methodDeclaration)
+ parseQualifiedRestOpt(super, methodDeclarationContinuation)
+ parseMethodTypeVar(super)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(super, super, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(super, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ parseFormalParameter((, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
+ parseMetadataStar(()
+ listener: beginMetadataStar(int)
+ listener: endMetadataStar(0)
+ listener: beginFormalParameter(int, MemberKind.NonStaticMethod, null, null, null)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(x)
+ listener: handleType(int, null)
+ ensureIdentifier(int, formalParameterDeclaration)
+ listener: handleIdentifier(x, formalParameterDeclaration)
+ listener: handleFormalParameterWithoutValue())
+ listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
inPlainSync()
- parseFunctionBody(), false, true)
- listener: beginBlockFunctionBody({)
- notEofOrValue(}, if)
- parseStatement({)
- parseStatementX({)
- parseIfStatement({)
- listener: beginIfStatement(if)
- ensureParenthesizedCondition(if)
- parseExpressionInParenthesisRest(()
- parseExpression(()
- parsePrecedenceExpression((, 1, true)
- parseUnaryExpression((, true)
- parsePrimary((, expression)
- parseSendOrFunctionLiteral((, expression)
- parseSend((, expression)
- isNextIdentifier(()
- ensureIdentifier((, expression)
- listener: handleIdentifier(x, expression)
- listener: handleNoTypeArguments(==)
- parseArgumentsOpt(x)
- listener: handleNoArguments(==)
- listener: handleSend(x, ==)
- listener: beginBinaryExpression(==)
- parsePrecedenceExpression(==, 8, true)
- parseUnaryExpression(==, true)
- parsePrimary(==, expression)
- parseLiteralInt(==)
- listener: handleLiteralInt(0)
- listener: endBinaryExpression(==)
- ensureCloseParen(0, ()
- listener: handleParenthesizedCondition(()
- listener: beginThenStatement(return)
- parseStatement())
- parseStatementX())
- parseReturnStatement())
- listener: beginReturnStatement(return)
- parseExpression(return)
- parsePrecedenceExpression(return, 1, true)
- parseUnaryExpression(return, true)
- parsePrimary(return, expression)
- parseLiteralInt(return)
- listener: handleLiteralInt(42)
- ensureSemicolon(42)
- listener: endReturnStatement(true, return, ;)
- inGenerator()
- listener: endThenStatement(;)
- listener: endIfStatement(if, null)
- notEofOrValue(}, return)
- parseStatement(;)
- parseStatementX(;)
- parseReturnStatement(;)
- listener: beginReturnStatement(return)
- parseExpression(return)
- parsePrecedenceExpression(return, 1, true)
- parseUnaryExpression(return, true)
- parsePrimary(return, expression)
- parseSuperExpression(return, expression)
- listener: handleSuperExpression(super, expression)
- listener: handleNoTypeArguments(()
- parseArguments(super)
- parseArgumentsRest(()
- listener: beginArguments(()
- parseExpression(()
- parsePrecedenceExpression((, 1, true)
- parseUnaryExpression((, true)
- parsePrimary((, expression)
- parseSendOrFunctionLiteral((, expression)
- parseSend((, expression)
- isNextIdentifier(()
- ensureIdentifier((, expression)
- listener: handleIdentifier(x, expression)
- listener: handleNoTypeArguments(-)
- parseArgumentsOpt(x)
- listener: handleNoArguments(-)
- listener: handleSend(x, -)
- listener: beginBinaryExpression(-)
- parsePrecedenceExpression(-, 14, true)
- parseUnaryExpression(-, true)
- parsePrimary(-, expression)
- parseLiteralInt(-)
- listener: handleLiteralInt(1)
- listener: endBinaryExpression(-)
- listener: endArguments(1, (, ))
- listener: handleSend(super, +)
- listener: beginBinaryExpression(+)
- parsePrecedenceExpression(+, 14, true)
- parseUnaryExpression(+, true)
- parsePrimary(+, expression)
- parseLiteralInt(+)
- listener: handleLiteralInt(1)
- listener: endBinaryExpression(+)
- ensureSemicolon(1)
- listener: endReturnStatement(true, return, ;)
- inGenerator()
- notEofOrValue(}, })
- listener: endBlockFunctionBody(2, {, })
- listener: endClassMethod(null, , (, null, })
- listener: endMember()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, if)
+ parseStatement({)
+ parseStatementX({)
+ parseIfStatement({)
+ listener: beginIfStatement(if)
+ ensureParenthesizedCondition(if)
+ parseExpressionInParenthesisRest(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ isNextIdentifier(()
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(x, expression)
+ listener: handleNoTypeArguments(==)
+ parseArgumentsOpt(x)
+ listener: handleNoArguments(==)
+ listener: handleSend(x, ==)
+ listener: beginBinaryExpression(==)
+ parsePrecedenceExpression(==, 8, true)
+ parseUnaryExpression(==, true)
+ parsePrimary(==, expression)
+ parseLiteralInt(==)
+ listener: handleLiteralInt(0)
+ listener: endBinaryExpression(==)
+ ensureCloseParen(0, ()
+ listener: handleParenthesizedCondition(()
+ listener: beginThenStatement(return)
+ parseStatement())
+ parseStatementX())
+ parseReturnStatement())
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrimary(return, expression)
+ parseLiteralInt(return)
+ listener: handleLiteralInt(42)
+ ensureSemicolon(42)
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ listener: endThenStatement(;)
+ listener: endIfStatement(if, null)
+ notEofOrValue(}, return)
+ parseStatement(;)
+ parseStatementX(;)
+ parseReturnStatement(;)
+ listener: beginReturnStatement(return)
+ parseExpression(return)
+ parsePrecedenceExpression(return, 1, true)
+ parseUnaryExpression(return, true)
+ parsePrimary(return, expression)
+ parseSuperExpression(return, expression)
+ listener: handleSuperExpression(super, expression)
+ listener: handleNoTypeArguments(()
+ parseArguments(super)
+ parseArgumentsRest(()
+ listener: beginArguments(()
+ parseExpression(()
+ parsePrecedenceExpression((, 1, true)
+ parseUnaryExpression((, true)
+ parsePrimary((, expression)
+ parseSendOrFunctionLiteral((, expression)
+ parseSend((, expression)
+ isNextIdentifier(()
+ ensureIdentifier((, expression)
+ listener: handleIdentifier(x, expression)
+ listener: handleNoTypeArguments(-)
+ parseArgumentsOpt(x)
+ listener: handleNoArguments(-)
+ listener: handleSend(x, -)
+ listener: beginBinaryExpression(-)
+ parsePrecedenceExpression(-, 14, true)
+ parseUnaryExpression(-, true)
+ parsePrimary(-, expression)
+ parseLiteralInt(-)
+ listener: handleLiteralInt(1)
+ listener: endBinaryExpression(-)
+ listener: endArguments(1, (, ))
+ listener: handleSend(super, +)
+ listener: beginBinaryExpression(+)
+ parsePrecedenceExpression(+, 14, true)
+ parseUnaryExpression(+, true)
+ parsePrimary(+, expression)
+ parseLiteralInt(+)
+ listener: handleLiteralInt(1)
+ listener: endBinaryExpression(+)
+ ensureSemicolon(1)
+ listener: endReturnStatement(true, return, ;)
+ inGenerator()
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(2, {, })
+ listener: endClassMethod(null, int, (, null, })
+ listener: endMember()
notEofOrValue(}, int)
parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Class, WrapperClass)
parseMetadataStar(})
@@ -10789,7 +10766,7 @@
listener: endClassMethod(null, int, (, null, })
listener: endMember()
notEofOrValue(}, })
- listener: endClassOrMixinOrExtensionBody(DeclarationKind.Class, 71, {, })
+ listener: endClassOrMixinOrExtensionBody(DeclarationKind.Class, 70, {, })
listener: endClassDeclaration(class, })
listener: endTopLevelDeclaration()
reportAllErrorTokens(class)
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.parser.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.parser.expect
index 5eaa7cd..70d958e 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.parser.expect
@@ -281,7 +281,7 @@
return static(x-1) + 1;
}
-int super;*synthetic*(int x) {
+int super(int x) {
if (x == 0) return 42;
return super(x-1) + 1;
}
@@ -629,7 +629,7 @@
return[KeywordToken] static[KeywordToken]([BeginToken]x[StringToken]-[SimpleToken]1[StringToken])[SimpleToken] +[SimpleToken] 1[StringToken];[SimpleToken]
}[SimpleToken]
-int[StringToken] super[KeywordToken];[SyntheticToken][SyntheticStringToken]([BeginToken]int[StringToken] x[StringToken])[SimpleToken] {[BeginToken]
+int[StringToken] super[KeywordToken]([BeginToken]int[StringToken] x[StringToken])[SimpleToken] {[BeginToken]
if[KeywordToken] ([BeginToken]x[StringToken] ==[SimpleToken] 0[StringToken])[SimpleToken] return[KeywordToken] 42[StringToken];[SimpleToken]
return[KeywordToken] super[KeywordToken]([BeginToken]x[StringToken]-[SimpleToken]1[StringToken])[SimpleToken] +[SimpleToken] 1[StringToken];[SimpleToken]
}[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_fields.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_fields.dart.intertwined.expect
index a0b0eaa..b2228b8 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_fields.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_fields.dart.intertwined.expect
@@ -1444,12 +1444,14 @@
listener: endMetadataStar(0)
parseTopLevelMemberImpl(;)
listener: beginTopLevelMember(int)
- parseFields(;, null, null, null, null, null, null, ;, Instance of 'SimpleType', super, DeclarationKind.TopLevel, null, false)
+ isReservedKeyword(super)
+ indicatesMethodOrField(=)
+ parseFields(;, null, null, null, null, null, null, ;, Instance of 'SimpleType', super, DeclarationKind.TopLevel, null, true)
listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, ;)
listener: handleIdentifier(int, typeReference)
listener: handleNoTypeArguments(super)
listener: handleType(int, null)
- ensureIdentifierPotentiallyRecovered(int, topLevelVariableDeclaration, false)
+ ensureIdentifierPotentiallyRecovered(int, topLevelVariableDeclaration, true)
reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
listener: handleIdentifier(super, topLevelVariableDeclaration)
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_methods.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_methods.dart.intertwined.expect
index 09deafa..bad4dea 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_methods.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_top_level_methods.dart.intertwined.expect
@@ -8308,12 +8308,14 @@
listener: endMetadataStar(0)
parseTopLevelMemberImpl(})
listener: beginTopLevelMember(int)
- parseTopLevelMethod(}, null, }, Instance of 'SimpleType', null, super, false)
+ isReservedKeyword(super)
+ indicatesMethodOrField(()
+ parseTopLevelMethod(}, null, }, Instance of 'SimpleType', null, super, true)
listener: beginTopLevelMethod(}, null)
listener: handleIdentifier(int, typeReference)
listener: handleNoTypeArguments(super)
listener: handleType(int, null)
- ensureIdentifierPotentiallyRecovered(int, topLevelFunctionDeclaration, false)
+ ensureIdentifierPotentiallyRecovered(int, topLevelFunctionDeclaration, true)
reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'super' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: super}], super, super)
listener: handleIdentifier(super, topLevelFunctionDeclaration)
diff --git a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart b/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart
deleted file mode 100644
index a0f94cc..0000000
--- a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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.
-
-class A1 {
- final int foo;
- A1(int this.foo);
-}
-
-class B1 extends A1 {
- B1(int super.foo);
-}
-
-class A2 {
- final int Function(int) foo;
- A2(int Function(int) this.foo);
-}
-
-class B2 extends A2 {
- B2(int Function(int) super.foo);
-}
-
-class A3 {
- final int Function(int) foo;
- A3(int this.foo(int));
-}
-
-class B3 extends A3 {
- B3(int super.foo(int));
-}
-
-class A4 {
- final void Function() Function(void Function()) foo;
- A4(void Function() this.foo(void Function()));
-}
-
-class B4 extends A4 {
- B4(void Function() super.foo(void Function()));
-}
-
-
-class A5 {
- final void Function() Function(void Function()) foo;
- A5(void Function() Function(void Function()) this.foo);
-}
-
-class B5 extends A5 {
- B5(void Function() Function(void Function()) super.foo);
-}
-
-main() {}
diff --git a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.strong.expect b/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.strong.expect
deleted file mode 100644
index aecf2d6..0000000
--- a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.strong.expect
+++ /dev/null
@@ -1,93 +0,0 @@
-library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:11:3: Error: The superclass, 'A1', has no unnamed constructor that takes no arguments.
-// B1(int super.foo);
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:20:3: Error: The superclass, 'A2', has no unnamed constructor that takes no arguments.
-// B2(int Function(int) super.foo);
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:29:3: Error: The superclass, 'A3', has no unnamed constructor that takes no arguments.
-// B3(int super.foo(int));
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:38:3: Error: The superclass, 'A4', has no unnamed constructor that takes no arguments.
-// B4(void Function() super.foo(void Function()));
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:48:3: Error: The superclass, 'A5', has no unnamed constructor that takes no arguments.
-// B5(void Function() Function(void Function()) super.foo);
-// ^^
-//
-import self as self;
-import "dart:core" as core;
-
-class A1 extends core::Object {
- final field core::int foo;
- constructor •(core::int foo) → self::A1
- : self::A1::foo = foo, super core::Object::•()
- ;
-}
-class B1 extends self::A1 {
- constructor •(core::int foo) → self::B1
- : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:11:3: Error: The superclass, 'A1', has no unnamed constructor that takes no arguments.
- B1(int super.foo);
- ^^"
- ;
-}
-class A2 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((core::int) → core::int foo) → self::A2
- : self::A2::foo = foo, super core::Object::•()
- ;
-}
-class B2 extends self::A2 {
- constructor •((core::int) → core::int foo) → self::B2
- : final dynamic #t2 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:20:3: Error: The superclass, 'A2', has no unnamed constructor that takes no arguments.
- B2(int Function(int) super.foo);
- ^^"
- ;
-}
-class A3 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((dynamic) → core::int foo) → self::A3
- : self::A3::foo = foo, super core::Object::•()
- ;
-}
-class B3 extends self::A3 {
- constructor •((dynamic) → core::int foo) → self::B3
- : final dynamic #t3 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:29:3: Error: The superclass, 'A3', has no unnamed constructor that takes no arguments.
- B3(int super.foo(int));
- ^^"
- ;
-}
-class A4 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A4
- : self::A4::foo = foo, super core::Object::•()
- ;
-}
-class B4 extends self::A4 {
- constructor •((() → void) → () → void foo) → self::B4
- : final dynamic #t4 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:38:3: Error: The superclass, 'A4', has no unnamed constructor that takes no arguments.
- B4(void Function() super.foo(void Function()));
- ^^"
- ;
-}
-class A5 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A5
- : self::A5::foo = foo, super core::Object::•()
- ;
-}
-class B5 extends self::A5 {
- constructor •((() → void) → () → void foo) → self::B5
- : final dynamic #t5 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:48:3: Error: The superclass, 'A5', has no unnamed constructor that takes no arguments.
- B5(void Function() Function(void Function()) super.foo);
- ^^"
- ;
-}
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.strong.transformed.expect b/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.strong.transformed.expect
deleted file mode 100644
index aecf2d6..0000000
--- a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.strong.transformed.expect
+++ /dev/null
@@ -1,93 +0,0 @@
-library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:11:3: Error: The superclass, 'A1', has no unnamed constructor that takes no arguments.
-// B1(int super.foo);
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:20:3: Error: The superclass, 'A2', has no unnamed constructor that takes no arguments.
-// B2(int Function(int) super.foo);
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:29:3: Error: The superclass, 'A3', has no unnamed constructor that takes no arguments.
-// B3(int super.foo(int));
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:38:3: Error: The superclass, 'A4', has no unnamed constructor that takes no arguments.
-// B4(void Function() super.foo(void Function()));
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:48:3: Error: The superclass, 'A5', has no unnamed constructor that takes no arguments.
-// B5(void Function() Function(void Function()) super.foo);
-// ^^
-//
-import self as self;
-import "dart:core" as core;
-
-class A1 extends core::Object {
- final field core::int foo;
- constructor •(core::int foo) → self::A1
- : self::A1::foo = foo, super core::Object::•()
- ;
-}
-class B1 extends self::A1 {
- constructor •(core::int foo) → self::B1
- : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:11:3: Error: The superclass, 'A1', has no unnamed constructor that takes no arguments.
- B1(int super.foo);
- ^^"
- ;
-}
-class A2 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((core::int) → core::int foo) → self::A2
- : self::A2::foo = foo, super core::Object::•()
- ;
-}
-class B2 extends self::A2 {
- constructor •((core::int) → core::int foo) → self::B2
- : final dynamic #t2 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:20:3: Error: The superclass, 'A2', has no unnamed constructor that takes no arguments.
- B2(int Function(int) super.foo);
- ^^"
- ;
-}
-class A3 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((dynamic) → core::int foo) → self::A3
- : self::A3::foo = foo, super core::Object::•()
- ;
-}
-class B3 extends self::A3 {
- constructor •((dynamic) → core::int foo) → self::B3
- : final dynamic #t3 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:29:3: Error: The superclass, 'A3', has no unnamed constructor that takes no arguments.
- B3(int super.foo(int));
- ^^"
- ;
-}
-class A4 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A4
- : self::A4::foo = foo, super core::Object::•()
- ;
-}
-class B4 extends self::A4 {
- constructor •((() → void) → () → void foo) → self::B4
- : final dynamic #t4 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:38:3: Error: The superclass, 'A4', has no unnamed constructor that takes no arguments.
- B4(void Function() super.foo(void Function()));
- ^^"
- ;
-}
-class A5 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A5
- : self::A5::foo = foo, super core::Object::•()
- ;
-}
-class B5 extends self::A5 {
- constructor •((() → void) → () → void foo) → self::B5
- : final dynamic #t5 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:48:3: Error: The superclass, 'A5', has no unnamed constructor that takes no arguments.
- B5(void Function() Function(void Function()) super.foo);
- ^^"
- ;
-}
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.textual_outline.expect b/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.textual_outline.expect
deleted file mode 100644
index f29b981..0000000
--- a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.textual_outline.expect
+++ /dev/null
@@ -1,36 +0,0 @@
-class A1 {
- final int foo;
- A1(int this.foo);
-}
-class B1 extends A1 {
- B1(int super.foo);
-}
-class A2 {
- final int Function(int) foo;
- A2(int Function(int) this.foo);
-}
-class B2 extends A2 {
- B2(int Function(int) super.foo);
-}
-class A3 {
- final int Function(int) foo;
- A3(int this.foo(int));
-}
-class B3 extends A3 {
- B3(int super.foo(int));
-}
-class A4 {
- final void Function() Function(void Function()) foo;
- A4(void Function() this.foo(void Function()));
-}
-class B4 extends A4 {
- B4(void Function() super.foo(void Function()));
-}
-class A5 {
- final void Function() Function(void Function()) foo;
- A5(void Function() Function(void Function()) this.foo);
-}
-class B5 extends A5 {
- B5(void Function() Function(void Function()) super.foo);
-}
-main() {}
diff --git a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.expect b/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.expect
deleted file mode 100644
index aecf2d6..0000000
--- a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.expect
+++ /dev/null
@@ -1,93 +0,0 @@
-library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:11:3: Error: The superclass, 'A1', has no unnamed constructor that takes no arguments.
-// B1(int super.foo);
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:20:3: Error: The superclass, 'A2', has no unnamed constructor that takes no arguments.
-// B2(int Function(int) super.foo);
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:29:3: Error: The superclass, 'A3', has no unnamed constructor that takes no arguments.
-// B3(int super.foo(int));
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:38:3: Error: The superclass, 'A4', has no unnamed constructor that takes no arguments.
-// B4(void Function() super.foo(void Function()));
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:48:3: Error: The superclass, 'A5', has no unnamed constructor that takes no arguments.
-// B5(void Function() Function(void Function()) super.foo);
-// ^^
-//
-import self as self;
-import "dart:core" as core;
-
-class A1 extends core::Object {
- final field core::int foo;
- constructor •(core::int foo) → self::A1
- : self::A1::foo = foo, super core::Object::•()
- ;
-}
-class B1 extends self::A1 {
- constructor •(core::int foo) → self::B1
- : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:11:3: Error: The superclass, 'A1', has no unnamed constructor that takes no arguments.
- B1(int super.foo);
- ^^"
- ;
-}
-class A2 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((core::int) → core::int foo) → self::A2
- : self::A2::foo = foo, super core::Object::•()
- ;
-}
-class B2 extends self::A2 {
- constructor •((core::int) → core::int foo) → self::B2
- : final dynamic #t2 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:20:3: Error: The superclass, 'A2', has no unnamed constructor that takes no arguments.
- B2(int Function(int) super.foo);
- ^^"
- ;
-}
-class A3 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((dynamic) → core::int foo) → self::A3
- : self::A3::foo = foo, super core::Object::•()
- ;
-}
-class B3 extends self::A3 {
- constructor •((dynamic) → core::int foo) → self::B3
- : final dynamic #t3 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:29:3: Error: The superclass, 'A3', has no unnamed constructor that takes no arguments.
- B3(int super.foo(int));
- ^^"
- ;
-}
-class A4 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A4
- : self::A4::foo = foo, super core::Object::•()
- ;
-}
-class B4 extends self::A4 {
- constructor •((() → void) → () → void foo) → self::B4
- : final dynamic #t4 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:38:3: Error: The superclass, 'A4', has no unnamed constructor that takes no arguments.
- B4(void Function() super.foo(void Function()));
- ^^"
- ;
-}
-class A5 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A5
- : self::A5::foo = foo, super core::Object::•()
- ;
-}
-class B5 extends self::A5 {
- constructor •((() → void) → () → void foo) → self::B5
- : final dynamic #t5 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:48:3: Error: The superclass, 'A5', has no unnamed constructor that takes no arguments.
- B5(void Function() Function(void Function()) super.foo);
- ^^"
- ;
-}
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.outline.expect b/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.outline.expect
deleted file mode 100644
index 70b9d6e..0000000
--- a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.outline.expect
+++ /dev/null
@@ -1,51 +0,0 @@
-library /*isNonNullableByDefault*/;
-import self as self;
-import "dart:core" as core;
-
-class A1 extends core::Object {
- final field core::int foo;
- constructor •(core::int foo) → self::A1
- ;
-}
-class B1 extends self::A1 {
- constructor •(core::int foo) → self::B1
- ;
-}
-class A2 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((core::int) → core::int foo) → self::A2
- ;
-}
-class B2 extends self::A2 {
- constructor •((core::int) → core::int foo) → self::B2
- ;
-}
-class A3 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((dynamic) → core::int foo) → self::A3
- ;
-}
-class B3 extends self::A3 {
- constructor •((dynamic) → core::int foo) → self::B3
- ;
-}
-class A4 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A4
- ;
-}
-class B4 extends self::A4 {
- constructor •((() → void) → () → void foo) → self::B4
- ;
-}
-class A5 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A5
- ;
-}
-class B5 extends self::A5 {
- constructor •((() → void) → () → void foo) → self::B5
- ;
-}
-static method main() → dynamic
- ;
diff --git a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.transformed.expect b/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.transformed.expect
deleted file mode 100644
index aecf2d6..0000000
--- a/pkg/front_end/testcases/super_parameters/typed_super_parameter.dart.weak.transformed.expect
+++ /dev/null
@@ -1,93 +0,0 @@
-library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:11:3: Error: The superclass, 'A1', has no unnamed constructor that takes no arguments.
-// B1(int super.foo);
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:20:3: Error: The superclass, 'A2', has no unnamed constructor that takes no arguments.
-// B2(int Function(int) super.foo);
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:29:3: Error: The superclass, 'A3', has no unnamed constructor that takes no arguments.
-// B3(int super.foo(int));
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:38:3: Error: The superclass, 'A4', has no unnamed constructor that takes no arguments.
-// B4(void Function() super.foo(void Function()));
-// ^^
-//
-// pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:48:3: Error: The superclass, 'A5', has no unnamed constructor that takes no arguments.
-// B5(void Function() Function(void Function()) super.foo);
-// ^^
-//
-import self as self;
-import "dart:core" as core;
-
-class A1 extends core::Object {
- final field core::int foo;
- constructor •(core::int foo) → self::A1
- : self::A1::foo = foo, super core::Object::•()
- ;
-}
-class B1 extends self::A1 {
- constructor •(core::int foo) → self::B1
- : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:11:3: Error: The superclass, 'A1', has no unnamed constructor that takes no arguments.
- B1(int super.foo);
- ^^"
- ;
-}
-class A2 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((core::int) → core::int foo) → self::A2
- : self::A2::foo = foo, super core::Object::•()
- ;
-}
-class B2 extends self::A2 {
- constructor •((core::int) → core::int foo) → self::B2
- : final dynamic #t2 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:20:3: Error: The superclass, 'A2', has no unnamed constructor that takes no arguments.
- B2(int Function(int) super.foo);
- ^^"
- ;
-}
-class A3 extends core::Object {
- final field (core::int) → core::int foo;
- constructor •((dynamic) → core::int foo) → self::A3
- : self::A3::foo = foo, super core::Object::•()
- ;
-}
-class B3 extends self::A3 {
- constructor •((dynamic) → core::int foo) → self::B3
- : final dynamic #t3 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:29:3: Error: The superclass, 'A3', has no unnamed constructor that takes no arguments.
- B3(int super.foo(int));
- ^^"
- ;
-}
-class A4 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A4
- : self::A4::foo = foo, super core::Object::•()
- ;
-}
-class B4 extends self::A4 {
- constructor •((() → void) → () → void foo) → self::B4
- : final dynamic #t4 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:38:3: Error: The superclass, 'A4', has no unnamed constructor that takes no arguments.
- B4(void Function() super.foo(void Function()));
- ^^"
- ;
-}
-class A5 extends core::Object {
- final field (() → void) → () → void foo;
- constructor •((() → void) → () → void foo) → self::A5
- : self::A5::foo = foo, super core::Object::•()
- ;
-}
-class B5 extends self::A5 {
- constructor •((() → void) → () → void foo) → self::B5
- : final dynamic #t5 = invalid-expression "pkg/front_end/testcases/super_parameters/typed_super_parameter.dart:48:3: Error: The superclass, 'A5', has no unnamed constructor that takes no arguments.
- B5(void Function() Function(void Function()) super.foo);
- ^^"
- ;
-}
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index bed6b86..956276e 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -200,7 +200,6 @@
regress/issue_41265.crash: Crash
regress/issue_41265.crash: FormatterCrash
super_parameters/simple: FormatterCrash
-super_parameters/typed_super_parameter: FormatterCrash
triple_shift/invalid_operator: FormatterCrash
variance/class_type_parameter_modifier: FormatterCrash
variance/generic_covariance_sound_variance: FormatterCrash
diff --git a/sdk/lib/io/platform.dart b/sdk/lib/io/platform.dart
index 296456f..93bcbd4 100644
--- a/sdk/lib/io/platform.dart
+++ b/sdk/lib/io/platform.dart
@@ -205,11 +205,6 @@
/// Provides a new list every time the value is read.
static List<String> get executableArguments => _Platform.executableArguments;
- /// This returns `null`, as `packages/` directories are no longer supported.
- ///
- @Deprecated('packages/ directory resolution is not supported in Dart 2')
- static String? get packageRoot => null; // TODO(mfairhurst): remove this
-
/// The `--packages` flag passed to the executable used to run the script
/// in this isolate.
///
diff --git a/sdk/lib/isolate/isolate.dart b/sdk/lib/isolate/isolate.dart
index 438e967..48c046f 100644
--- a/sdk/lib/isolate/isolate.dart
+++ b/sdk/lib/isolate/isolate.dart
@@ -18,8 +18,8 @@
/// {@category VM}
library dart.isolate;
-import "dart:async";
import "dart:_internal" show Since;
+import "dart:async";
import "dart:typed_data" show ByteBuffer, TypedData, Uint8List;
part "capability.dart";
@@ -158,13 +158,6 @@
/// is a sure way to hang your program.
external static Isolate get current;
- /// The package root of the current isolate, if any.
- ///
- /// This getter returns `null`, as the `packages/` directory is not supported
- /// in Dart 2.
- @Deprecated('packages/ directory resolution is not supported in Dart 2.')
- external static Future<Uri?> get packageRoot;
-
/// The location of the package configuration of the current isolate, if any.
///
/// If the isolate has not been setup for package resolution,
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 2073134..26b0647 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -54,7 +54,6 @@
LibTest/core/int/parse_A01_t02: SkipByDesign # uses integer literal not representable as JavaScript number
LibTest/core/int/remainder_A01_t03: SkipByDesign # Division by zero is not an error in JavaScript
LibTest/ffi/*: SkipByDesign # dart:ffi is not supported
-LibTest/html/HttpRequest/responseText_A01_t02: Skip # https://github.com/dart-lang/co19/issues/932
LibTest/html/HttpRequestUpload/*: Skip # https://github.com/dart-lang/co19/issues/932
LibTest/io/*: SkipByDesign # dart:io not supported.
LibTest/isolate/*: SkipByDesign # dart:isolate not supported.
diff --git a/tests/co19/co19-dartdevc.status b/tests/co19/co19-dartdevc.status
index 7e761f2..4fa6538 100644
--- a/tests/co19/co19-dartdevc.status
+++ b/tests/co19/co19-dartdevc.status
@@ -50,7 +50,6 @@
LibTest/core/int/parse_A01_t02: SkipByDesign # big integers cannot be represented in JavaScript
LibTest/core/int/remainder_A01_t03: SkipByDesign # Division by zero is not an error in JavaScript
LibTest/ffi/*: SkipByDesign # dart:ffi is not supported
-LibTest/html/HttpRequest/responseText_A01_t02: Skip # https://github.com/dart-lang/co19/issues/932
LibTest/html/HttpRequestUpload/*: Skip # https://github.com/dart-lang/co19/issues/932
LibTest/io/*: SkipByDesign # dart:io not supported.
LibTest/isolate/*: SkipByDesign # dart:isolate not supported.
diff --git a/tests/lib/isolate/scenarios/automatic_resolution_root/package_resolve_test.dart b/tests/lib/isolate/scenarios/automatic_resolution_root/package_resolve_test.dart
deleted file mode 100644
index eb3cbf7..0000000
--- a/tests/lib/isolate/scenarios/automatic_resolution_root/package_resolve_test.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2016, 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.
-
-import 'dart:io';
-import 'dart:isolate';
-
-final PACKAGE_URI = "package:foo/bar.dart";
-
-main([args, port]) async {
- if (port != null) {
- testPackageResolution(port);
- return;
- }
- var p = new RawReceivePort();
- Isolate.spawnUri(Platform.script, [], p.sendPort,
- automaticPackageResolution: true);
- p.handler = (msg) {
- p.close();
- if (msg is! List) {
- print(msg.runtimeType);
- throw "Failure return from spawned isolate:\n\n$msg";
- }
- if (msg[0] != null) {
- throw "Bad package root in child isolate: ${msg[0]}.\n"
- "Expected: null";
- }
- if (msg[1] != null) {
- throw "Package path not matching: ${msg[1]}\n"
- "Expected: null";
- }
- print("SUCCESS");
- };
- print("Spawning isolate's package root: ${await Isolate.packageRoot}");
-}
-
-testPackageResolution(port) async {
- try {
- var packageRootStr = Platform.packageRoot;
- var packageConfigStr = Platform.packageConfig;
- var packageRoot = await Isolate.packageRoot;
- var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(PACKAGE_URI));
- print("Spawned isolate's package root flag: $packageRootStr");
- print("Spawned isolate's package config flag: $packageConfigStr");
- print("Spawned isolate's loaded package root: $packageRoot");
- print("Spawned isolate's resolved package path: $resolvedPkg");
- port.send([packageRoot?.toString(), resolvedPkg?.toString()]);
- } catch (e, s) {
- port.send("$e\n$s\n");
- }
-}
diff --git a/tests/lib/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart b/tests/lib/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
index dee6d10..4b2eba6 100644
--- a/tests/lib/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
+++ b/tests/lib/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
@@ -32,16 +32,13 @@
}
print("SUCCESS");
};
- print("Spawning isolate's package root: ${await Isolate.packageRoot}");
}
testPackageResolution(port) async {
try {
- var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(PACKAGE_URI));
- print("Spawned isolate's package root flag: $packageRootStr");
print("Spawned isolate's package config flag: $packageConfigStr");
print("Spawned isolate's loaded package config: $packageConfig");
print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tests/lib/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart b/tests/lib/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
index 5866729..1242b21 100644
--- a/tests/lib/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
+++ b/tests/lib/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
@@ -31,12 +31,10 @@
testBadResolvePackage(port) async {
try {
- var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
var badPackageUri = Uri.parse("package:asdf/qwerty.dart");
var resolvedPkg = await Isolate.resolvePackageUri(badPackageUri);
- print("Spawned isolate's package root flag: $packageRootStr");
print("Spawned isolate's package config flag: $packageConfigStr");
print("Spawned isolate's loaded package config: $packageConfig");
print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tests/lib/isolate/scenarios/package_relative_root/package_relative_root_test.dart b/tests/lib/isolate/scenarios/package_relative_root/package_relative_root_test.dart
index 034881b..47f4d3d 100644
--- a/tests/lib/isolate/scenarios/package_relative_root/package_relative_root_test.dart
+++ b/tests/lib/isolate/scenarios/package_relative_root/package_relative_root_test.dart
@@ -7,8 +7,8 @@
import 'dart:io';
import 'dart:isolate';
-import "package:foo/foo.dart";
import "package:bar/bar.dart";
+import "package:foo/foo.dart";
var CONFIG_URI = "package:bar/spawned_packages/";
@@ -18,8 +18,7 @@
return;
}
var p = new RawReceivePort();
- Isolate.spawnUri(Platform.script, [], p.sendPort,
- packageRoot: Uri.parse(CONFIG_URI));
+ Isolate.spawnUri(Platform.script, [], p.sendPort);
p.handler = (msg) {
p.close();
if (msg is! List) {
@@ -45,11 +44,9 @@
testCorrectBarPackage(port) async {
try {
- var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI));
- print("Spawned isolate's package root flag: $packageRootStr");
print("Spawned isolate's package config flag: $packageConfigStr");
print("Spawned isolate's loaded package config: $packageConfig");
print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tests/lib/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart b/tests/lib/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
index 9e5b603..6118d26 100644
--- a/tests/lib/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
+++ b/tests/lib/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
@@ -45,11 +45,9 @@
testCorrectBarPackage(port) async {
try {
- var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI));
- print("Spawned isolate's package root flag: $packageRootStr");
print("Spawned isolate's package config flag: $packageConfigStr");
print("Spawned isolate's loaded package config: $packageConfig");
print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tests/lib_2/isolate/scenarios/automatic_resolution_root/package_resolve_test.dart b/tests/lib_2/isolate/scenarios/automatic_resolution_root/package_resolve_test.dart
deleted file mode 100644
index 53ae200..0000000
--- a/tests/lib_2/isolate/scenarios/automatic_resolution_root/package_resolve_test.dart
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2016, 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
-
-import 'dart:io';
-import 'dart:isolate';
-
-final PACKAGE_URI = "package:foo/bar.dart";
-
-main([args, port]) async {
- if (port != null) {
- testPackageResolution(port);
- return;
- }
- var p = new RawReceivePort();
- Isolate.spawnUri(Platform.script, [], p.sendPort,
- automaticPackageResolution: true);
- p.handler = (msg) {
- p.close();
- if (msg is! List) {
- print(msg.runtimeType);
- throw "Failure return from spawned isolate:\n\n$msg";
- }
- if (msg[0] != null) {
- throw "Bad package root in child isolate: ${msg[0]}.\n"
- "Expected: null";
- }
- if (msg[1] != null) {
- throw "Package path not matching: ${msg[1]}\n"
- "Expected: null";
- }
- print("SUCCESS");
- };
- print("Spawning isolate's package root: ${await Isolate.packageRoot}");
-}
-
-testPackageResolution(port) async {
- try {
- var packageRootStr = Platform.packageRoot;
- var packageConfigStr = Platform.packageConfig;
- var packageRoot = await Isolate.packageRoot;
- var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(PACKAGE_URI));
- print("Spawned isolate's package root flag: $packageRootStr");
- print("Spawned isolate's package config flag: $packageConfigStr");
- print("Spawned isolate's loaded package root: $packageRoot");
- print("Spawned isolate's resolved package path: $resolvedPkg");
- port.send([packageRoot?.toString(), resolvedPkg?.toString()]);
- } catch (e, s) {
- port.send("$e\n$s\n");
- }
-}
diff --git a/tests/lib_2/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart b/tests/lib_2/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
index 4e3cbbd..ccd9088 100644
--- a/tests/lib_2/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
+++ b/tests/lib_2/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
@@ -34,16 +34,13 @@
}
print("SUCCESS");
};
- print("Spawning isolate's package root: ${await Isolate.packageRoot}");
}
testPackageResolution(port) async {
try {
- var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(PACKAGE_URI));
- print("Spawned isolate's package root flag: $packageRootStr");
print("Spawned isolate's package config flag: $packageConfigStr");
print("Spawned isolate's loaded package config: $packageConfig");
print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tests/lib_2/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart b/tests/lib_2/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
index a17f089..ccc4856 100644
--- a/tests/lib_2/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
+++ b/tests/lib_2/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
@@ -33,12 +33,10 @@
testBadResolvePackage(port) async {
try {
- var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
var badPackageUri = Uri.parse("package:asdf/qwerty.dart");
var resolvedPkg = await Isolate.resolvePackageUri(badPackageUri);
- print("Spawned isolate's package root flag: $packageRootStr");
print("Spawned isolate's package config flag: $packageConfigStr");
print("Spawned isolate's loaded package config: $packageConfig");
print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tests/lib_2/isolate/scenarios/package_relative_root/package_relative_root_test.dart b/tests/lib_2/isolate/scenarios/package_relative_root/package_relative_root_test.dart
index 49ee784..03f1e0b 100644
--- a/tests/lib_2/isolate/scenarios/package_relative_root/package_relative_root_test.dart
+++ b/tests/lib_2/isolate/scenarios/package_relative_root/package_relative_root_test.dart
@@ -9,8 +9,8 @@
import 'dart:io';
import 'dart:isolate';
-import "package:foo/foo.dart";
import "package:bar/bar.dart";
+import "package:foo/foo.dart";
var CONFIG_URI = "package:bar/spawned_packages/";
@@ -20,8 +20,7 @@
return;
}
var p = new RawReceivePort();
- Isolate.spawnUri(Platform.script, [], p.sendPort,
- packageRoot: Uri.parse(CONFIG_URI));
+ Isolate.spawnUri(Platform.script, [], p.sendPort);
p.handler = (msg) {
p.close();
if (msg is! List) {
@@ -47,11 +46,9 @@
testCorrectBarPackage(port) async {
try {
- var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI));
- print("Spawned isolate's package root flag: $packageRootStr");
print("Spawned isolate's package config flag: $packageConfigStr");
print("Spawned isolate's loaded package config: $packageConfig");
print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tests/lib_2/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart b/tests/lib_2/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
index a4c96d6..c8c7ea6 100644
--- a/tests/lib_2/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
+++ b/tests/lib_2/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
@@ -47,11 +47,9 @@
testCorrectBarPackage(port) async {
try {
- var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI));
- print("Spawned isolate's package root flag: $packageRootStr");
print("Spawned isolate's package config flag: $packageConfigStr");
print("Spawned isolate's loaded package config: $packageConfig");
print("Spawned isolate's resolved package path: $resolvedPkg");
diff --git a/tools/VERSION b/tools/VERSION
index b2f9f59..67da428 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 16
PATCH 0
-PRERELEASE 85
+PRERELEASE 86
PRERELEASE_PATCH 0
\ No newline at end of file