blob: bb23ee79a6612d1b075b8eac7de024489ac60ccf [file]
// Copyright (c) 2024, 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 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../dart/resolution/node_text_expectations.dart';
import '../elements_base.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ClassElementTest_keepLinking);
defineReflectiveTests(ClassElementTest_fromBytes);
defineReflectiveTests(UpdateNodeTextExpectations);
});
}
abstract class ClassElementTest extends ElementsBaseTest {
test_class_augmentation_chain_introductoryDeclaration_afterAugmentation() async {
var library = await buildLibrary(r'''
augment class A {
void foo1() {}
}
class A {
void foo2() {}
}
augment class A {
void foo3() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAugmentation class A (nameOffset:14) (firstTokenOffset:0) (offset:14)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo1 (nameOffset:25) (firstTokenOffset:20) (offset:25)
element: <testLibrary>::@class::A::@method::foo1
#F4 class A (nameOffset:44) (firstTokenOffset:38) (offset:44)
element: <testLibrary>::@class::A#1
nextFragment: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@class::A#1::@constructor::new
typeName: A
methods
#F7 isComplete isOriginDeclaration foo2 (nameOffset:55) (firstTokenOffset:50) (offset:55)
element: <testLibrary>::@class::A#1::@method::foo2
#F5 isAugmentation class A (nameOffset:82) (firstTokenOffset:68) (offset:82)
element: <testLibrary>::@class::A#1
previousFragment: #F4
methods
#F8 isComplete isOriginDeclaration foo3 (nameOffset:93) (firstTokenOffset:88) (offset:93)
element: <testLibrary>::@class::A#1::@method::foo3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@method::foo1
firstFragment: #F3
returnType: void
isSimplyBounded class A
reference: <testLibrary>::@class::A#1
firstFragment: #F4
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A#1::@constructor::new
firstFragment: #F6
methods
isOriginDeclaration foo2
reference: <testLibrary>::@class::A#1::@method::foo2
firstFragment: #F7
returnType: void
isOriginDeclaration foo3
reference: <testLibrary>::@class::A#1::@method::foo3
firstFragment: #F8
returnType: void
''');
}
test_class_augmentation_chain_noIntroductoryDeclaration() async {
var library = await buildLibrary(r'''
part 'a.dart';
class B {}
augment class A {
void foo1() {}
}
augment class A {
void foo2() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
parts
part_0
uri: source 'package:test/a.dart'
partKeywordOffset: 0
classes
#F1 class B (nameOffset:21) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::B
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F3 isAugmentation class A (nameOffset:41) (firstTokenOffset:27) (offset:41)
element: <testLibrary>::@class::A
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F6 isComplete isOriginDeclaration foo1 (nameOffset:52) (firstTokenOffset:47) (offset:52)
element: <testLibrary>::@class::A::@method::foo1
#F4 isAugmentation class A (nameOffset:79) (firstTokenOffset:65) (offset:79)
element: <testLibrary>::@class::A
previousFragment: #F3
methods
#F7 isComplete isOriginDeclaration foo2 (nameOffset:90) (firstTokenOffset:85) (offset:90)
element: <testLibrary>::@class::A::@method::foo2
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F2
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
methods
isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@method::foo1
firstFragment: #F6
returnType: void
isOriginDeclaration foo2
reference: <testLibrary>::@class::A::@method::foo2
firstFragment: #F7
returnType: void
''');
}
test_class_augmentation_chain_partTreePreorder() async {
newFile('$testPackageLibPath/a1.dart', r'''
part of 'test.dart';
part 'a11.dart';
part 'a12.dart';
augment class A {}
''');
newFile('$testPackageLibPath/a11.dart', r'''
part of 'a1.dart';
augment class A {}
''');
newFile('$testPackageLibPath/a12.dart', r'''
part of 'a1.dart';
augment class A {}
''');
newFile('$testPackageLibPath/a2.dart', r'''
part of 'test.dart';
part 'a21.dart';
part 'a22.dart';
augment class A {}
''');
newFile('$testPackageLibPath/a21.dart', r'''
part of 'a2.dart';
augment class A {}
''');
newFile('$testPackageLibPath/a22.dart', r'''
part of 'a2.dart';
augment class A {}
''');
configuration.withExportScope = true;
var library = await buildLibrary(r'''
part 'a1.dart';
part 'a2.dart';
class A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
nextFragment: #F1
parts
part_0
uri: package:test/a1.dart
partKeywordOffset: 0
unit: #F1
part_1
uri: package:test/a2.dart
partKeywordOffset: 16
unit: #F2
classes
#F3 class A (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::A
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F1 package:test/a1.dart
element: <testLibrary>
enclosingFragment: #F0
previousFragment: #F0
nextFragment: #F6
parts
part_2
uri: package:test/a11.dart
partKeywordOffset: 21
unit: #F6
part_3
uri: package:test/a12.dart
partKeywordOffset: 38
unit: #F7
classes
#F4 isAugmentation class A (nameOffset:69) (firstTokenOffset:55) (offset:69)
element: <testLibrary>::@class::A
previousFragment: #F3
nextFragment: #F8
#F6 package:test/a11.dart
element: <testLibrary>
enclosingFragment: #F1
previousFragment: #F1
nextFragment: #F7
classes
#F8 isAugmentation class A (nameOffset:33) (firstTokenOffset:19) (offset:33)
element: <testLibrary>::@class::A
previousFragment: #F4
nextFragment: #F9
#F7 package:test/a12.dart
element: <testLibrary>
enclosingFragment: #F1
previousFragment: #F6
nextFragment: #F2
classes
#F9 isAugmentation class A (nameOffset:33) (firstTokenOffset:19) (offset:33)
element: <testLibrary>::@class::A
previousFragment: #F8
nextFragment: #F10
#F2 package:test/a2.dart
element: <testLibrary>
enclosingFragment: #F0
previousFragment: #F7
nextFragment: #F11
parts
part_4
uri: package:test/a21.dart
partKeywordOffset: 21
unit: #F11
part_5
uri: package:test/a22.dart
partKeywordOffset: 38
unit: #F12
classes
#F10 isAugmentation class A (nameOffset:69) (firstTokenOffset:55) (offset:69)
element: <testLibrary>::@class::A
previousFragment: #F9
nextFragment: #F13
#F11 package:test/a21.dart
element: <testLibrary>
enclosingFragment: #F2
previousFragment: #F2
nextFragment: #F12
classes
#F13 isAugmentation class A (nameOffset:33) (firstTokenOffset:19) (offset:33)
element: <testLibrary>::@class::A
previousFragment: #F10
nextFragment: #F14
#F12 package:test/a22.dart
element: <testLibrary>
enclosingFragment: #F2
previousFragment: #F11
classes
#F14 isAugmentation class A (nameOffset:33) (firstTokenOffset:19) (offset:33)
element: <testLibrary>::@class::A
previousFragment: #F13
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
/// Invalid augmentation of class with mixin does not "own" the name.
/// When a valid class augmentation follows, it can use the name.
test_class_augmentation_sameName_class_mixin_class() async {
var library = await buildLibrary(r'''
class A {}
augment mixin A {}
augment class A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A#1
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46)
element: <testLibrary>::@class::A#1::@constructor::new
typeName: A
mixins
#F5 isAugmentation mixin A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@mixin::A
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class A
reference: <testLibrary>::@class::A#1
firstFragment: #F3
previousFragmentOfDifferentKind: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A#1::@constructor::new
firstFragment: #F4
mixins
isSimplyBounded mixin A
reference: <testLibrary>::@mixin::A
firstFragment: #F5
previousFragmentOfDifferentKind: #F1
superclassConstraints
Object
''');
}
test_class_augmentation_sameName_class_mixin_mixin() async {
var library = await buildLibrary(r'''
class A {}
augment mixin A {}
augment mixin A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
mixins
#F3 isAugmentation mixin A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@mixin::A
nextFragment: #F4
#F4 isAugmentation mixin A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@mixin::A
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
mixins
isSimplyBounded mixin A
reference: <testLibrary>::@mixin::A
firstFragment: #F3
previousFragmentOfDifferentKind: #F1
superclassConstraints
Object
''');
}
test_class_augmentation_sameName_mixinApplication() async {
var library = await buildLibrary(r'''
mixin M {}
class C = Object with M;
augment class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:17) (firstTokenOffset:11) (offset:17)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 isAugmentation class C (nameOffset:50) (firstTokenOffset:36) (offset:50)
element: <testLibrary>::@class::C#1
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:50)
element: <testLibrary>::@class::C#1::@constructor::new
typeName: C
mixins
#F5 mixin M (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@mixin::M
classes
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: Object
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: dart:core::@class::Object::@constructor::new
isSimplyBounded class C
reference: <testLibrary>::@class::C#1
firstFragment: #F3
previousFragmentOfDifferentKind: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C#1::@constructor::new
firstFragment: #F4
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F5
superclassConstraints
Object
''');
}
test_class_cycle_interfaces() async {
var library = await buildLibrary(r'''
class A implements B {}
class B implements A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
''');
}
test_class_cycle_mixins() async {
var library = await buildLibrary(r'''
class A with B {}
class B with A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 class B (nameOffset:25) (firstTokenOffset:19) (offset:25)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
''');
}
test_class_cycle_supertype() async {
var library = await buildLibrary(r'''
class A extends B {}
class B extends A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause class B (nameOffset:28) (firstTokenOffset:22) (offset:28)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
''');
}
test_class_documented() async {
var library = await buildLibrary(r'''
/**
* Docs
*/
class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:22) (firstTokenOffset:0) (offset:22)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
documentationComment: /**\n * Docs\n */
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_documented_mix() async {
var library = await buildLibrary(r'''
/**
* aaa
*/
/**
* bbb
*/
class A {}
/**
* aaa
*/
/// bbb
/// ccc
class B {}
/// aaa
/// bbb
/**
* ccc
*/
class C {}
/// aaa
/// bbb
/**
* ccc
*/
/// ddd
class D {}
/**
* aaa
*/
// bbb
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:36) (firstTokenOffset:15) (offset:36)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 class B (nameOffset:79) (firstTokenOffset:57) (offset:79)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:79)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F5 class C (nameOffset:122) (firstTokenOffset:101) (offset:122)
element: <testLibrary>::@class::C
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:122)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F7 class D (nameOffset:173) (firstTokenOffset:159) (offset:173)
element: <testLibrary>::@class::D
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:173)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F9 class E (nameOffset:207) (firstTokenOffset:179) (offset:207)
element: <testLibrary>::@class::E
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:207)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
documentationComment: /**\n * bbb\n */
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
documentationComment: /// bbb\n/// ccc
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F5
documentationComment: /**\n * ccc\n */
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F6
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F7
documentationComment: /// ddd
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F8
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F9
documentationComment: /**\n * aaa\n */
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F10
''');
}
test_class_documented_tripleSlash() async {
var library = await buildLibrary(r'''
/// first
/// second
/// third
class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:37) (firstTokenOffset:0) (offset:37)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
documentationComment: /// first\n/// second\n/// third
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_documented_with_references() async {
var library = await buildLibrary(r'''
/**
* Docs referring to [D] and [E]
*/
class C {}
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:47) (firstTokenOffset:0) (offset:47)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:59) (firstTokenOffset:53) (offset:59)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:59)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:71) (firstTokenOffset:65) (offset:71)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
documentationComment: /**\n * Docs referring to [D] and [E]\n */
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
''');
}
test_class_documented_with_windows_line_endings() async {
var library = await buildLibrary(
r'''
/**
* Docs
*/
class C {}
'''
.replaceAll('\n', '\r\n'),
);
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:25) (firstTokenOffset:0) (offset:25)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
documentationComment: /**\n * Docs\n */
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_documented_withLeadingNotDocumentation() async {
var library = await buildLibrary(r'''
// Extra comment so doc comment offset != 0
/**
* Docs
*/
class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:66) (firstTokenOffset:44) (offset:66)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
documentationComment: /**\n * Docs\n */
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_documented_withMetadata() async {
var library = await buildLibrary(r'''
/// Comment 1
/// Comment 2
@Annotation()
class BeforeMeta {}
/// Comment 1
/// Comment 2
@Annotation.named()
class BeforeMetaNamed {}
@Annotation()
/// Comment 1
/// Comment 2
class AfterMeta {}
/// Comment 1
@Annotation()
/// Comment 2
class AroundMeta {}
/// Doc comment.
@Annotation()
// Not doc comment.
class DocBeforeMetaNotDocAfter {}
class Annotation {
const Annotation();
const Annotation.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class BeforeMeta (nameOffset:48) (firstTokenOffset:0) (offset:48)
element: <testLibrary>::@class::BeforeMeta
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48)
element: <testLibrary>::@class::BeforeMeta::@constructor::new
typeName: BeforeMeta
#F3 class BeforeMetaNamed (nameOffset:117) (firstTokenOffset:63) (offset:117)
element: <testLibrary>::@class::BeforeMetaNamed
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:117)
element: <testLibrary>::@class::BeforeMetaNamed::@constructor::new
typeName: BeforeMetaNamed
#F5 class AfterMeta (nameOffset:185) (firstTokenOffset:137) (offset:185)
element: <testLibrary>::@class::AfterMeta
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:185)
element: <testLibrary>::@class::AfterMeta::@constructor::new
typeName: AfterMeta
#F7 class AroundMeta (nameOffset:247) (firstTokenOffset:213) (offset:247)
element: <testLibrary>::@class::AroundMeta
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:247)
element: <testLibrary>::@class::AroundMeta::@constructor::new
typeName: AroundMeta
#F9 class DocBeforeMetaNotDocAfter (nameOffset:319) (firstTokenOffset:262) (offset:319)
element: <testLibrary>::@class::DocBeforeMetaNotDocAfter
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:319)
element: <testLibrary>::@class::DocBeforeMetaNotDocAfter::@constructor::new
typeName: DocBeforeMetaNotDocAfter
#F11 class Annotation (nameOffset:354) (firstTokenOffset:348) (offset:354)
element: <testLibrary>::@class::Annotation
constructors
#F12 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:369) (offset:375)
element: <testLibrary>::@class::Annotation::@constructor::new
typeName: Annotation
typeNameOffset: 375
#F13 isConst isOriginDeclaration named (nameOffset:408) (firstTokenOffset:391) (offset:408)
element: <testLibrary>::@class::Annotation::@constructor::named
typeName: Annotation
typeNameOffset: 397
periodOffset: 407
classes
isSimplyBounded class BeforeMeta
reference: <testLibrary>::@class::BeforeMeta
firstFragment: #F1
documentationComment: /// Comment 1\n/// Comment 2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::BeforeMeta::@constructor::new
firstFragment: #F2
isSimplyBounded class BeforeMetaNamed
reference: <testLibrary>::@class::BeforeMetaNamed
firstFragment: #F3
documentationComment: /// Comment 1\n/// Comment 2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::BeforeMetaNamed::@constructor::new
firstFragment: #F4
isSimplyBounded class AfterMeta
reference: <testLibrary>::@class::AfterMeta
firstFragment: #F5
documentationComment: /// Comment 1\n/// Comment 2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::AfterMeta::@constructor::new
firstFragment: #F6
isSimplyBounded class AroundMeta
reference: <testLibrary>::@class::AroundMeta
firstFragment: #F7
documentationComment: /// Comment 2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::AroundMeta::@constructor::new
firstFragment: #F8
isSimplyBounded class DocBeforeMetaNotDocAfter
reference: <testLibrary>::@class::DocBeforeMetaNotDocAfter
firstFragment: #F9
documentationComment: /// Doc comment.
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::DocBeforeMetaNotDocAfter::@constructor::new
firstFragment: #F10
isSimplyBounded class Annotation
reference: <testLibrary>::@class::Annotation
firstFragment: #F11
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::Annotation::@constructor::new
firstFragment: #F12
isConst isOriginDeclaration named
reference: <testLibrary>::@class::Annotation::@constructor::named
firstFragment: #F13
''');
}
test_class_fragmentOrder_g1_s2_s1() async {
var library = await buildLibrary(r'''
class A {
int get a => 0;
set b(int _) {}
set a(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::a
#F3 isOriginGetterSetter b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::b
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration a (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::a
setters
#F6 hasImplicitReturnType isComplete isOriginDeclaration b (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::A::@setter::b
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:40) (firstTokenOffset:36) (offset:40)
element: <testLibrary>::@class::A::@setter::b::@formalParameter::_
#F8 hasImplicitReturnType isComplete isOriginDeclaration a (nameOffset:52) (firstTokenOffset:48) (offset:52)
element: <testLibrary>::@class::A::@setter::a
formalParameters
#F9 requiredPositional isOriginDeclaration _ (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@setter::a::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter a
reference: <testLibrary>::@class::A::@field::a
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::a
setter: <testLibrary>::@class::A::@setter::a
isOriginGetterSetter b
reference: <testLibrary>::@class::A::@field::b
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::b
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration a
reference: <testLibrary>::@class::A::@getter::a
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::a
setters
isOriginDeclaration b
reference: <testLibrary>::@class::A::@setter::b
firstFragment: #F6
formalParameters
#E0 requiredPositional _
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::b
isOriginDeclaration a
reference: <testLibrary>::@class::A::@setter::a
firstFragment: #F8
formalParameters
#E1 requiredPositional _
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::a
''');
}
test_class_fragmentOrder_s1_g2_g1() async {
var library = await buildLibrary(r'''
class A {
set a(int _) {}
int get b => 0;
int get a => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::a
#F3 isOriginGetterSetter b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::b
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration b (nameOffset:38) (firstTokenOffset:30) (offset:38)
element: <testLibrary>::@class::A::@getter::b
#F6 isComplete isOriginDeclaration a (nameOffset:56) (firstTokenOffset:48) (offset:56)
element: <testLibrary>::@class::A::@getter::a
setters
#F7 hasImplicitReturnType isComplete isOriginDeclaration a (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::a
formalParameters
#F8 requiredPositional isOriginDeclaration _ (nameOffset:22) (firstTokenOffset:18) (offset:22)
element: <testLibrary>::@class::A::@setter::a::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter a
reference: <testLibrary>::@class::A::@field::a
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::a
setter: <testLibrary>::@class::A::@setter::a
isOriginGetterSetter b
reference: <testLibrary>::@class::A::@field::b
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::b
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration b
reference: <testLibrary>::@class::A::@getter::b
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::b
isOriginDeclaration a
reference: <testLibrary>::@class::A::@getter::a
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::a
setters
isOriginDeclaration a
reference: <testLibrary>::@class::A::@setter::a
firstFragment: #F7
formalParameters
#E0 requiredPositional _
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::a
''');
}
test_class_interfaces() async {
var library = await buildLibrary(r'''
class C implements D, E {}
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:46) (firstTokenOffset:40) (offset:46)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
interfaces
D
E
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
''');
}
test_class_interfaces_augmentation_add() async {
var library = await buildLibrary(r'''
class A implements I1 {}
class I1 {}
augment class A implements I2 {}
class I2 {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F4 class I1 (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::I1
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::I1::@constructor::new
typeName: I1
#F2 isAugmentation class A (nameOffset:52) (firstTokenOffset:38) (offset:52)
element: <testLibrary>::@class::A
previousFragment: #F1
#F6 class I2 (nameOffset:77) (firstTokenOffset:71) (offset:77)
element: <testLibrary>::@class::I2
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:77)
element: <testLibrary>::@class::I2::@constructor::new
typeName: I2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
interfaces
I1
I2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
isSimplyBounded class I1
reference: <testLibrary>::@class::I1
firstFragment: #F4
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::I1::@constructor::new
firstFragment: #F5
isSimplyBounded class I2
reference: <testLibrary>::@class::I2
firstFragment: #F6
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::I2::@constructor::new
firstFragment: #F7
''');
}
test_class_interfaces_augmentation_add_chain() async {
var library = await buildLibrary(r'''
class A implements I1 {}
class I1 {}
augment class A implements I2 {}
class I2 {}
augment class A implements I3 {}
class I3 {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F4 class I1 (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::I1
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::I1::@constructor::new
typeName: I1
#F2 isAugmentation class A (nameOffset:52) (firstTokenOffset:38) (offset:52)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F6
#F7 class I2 (nameOffset:77) (firstTokenOffset:71) (offset:77)
element: <testLibrary>::@class::I2
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:77)
element: <testLibrary>::@class::I2::@constructor::new
typeName: I2
#F6 isAugmentation class A (nameOffset:98) (firstTokenOffset:84) (offset:98)
element: <testLibrary>::@class::A
previousFragment: #F2
#F9 class I3 (nameOffset:123) (firstTokenOffset:117) (offset:123)
element: <testLibrary>::@class::I3
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:123)
element: <testLibrary>::@class::I3::@constructor::new
typeName: I3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
interfaces
I1
I2
I3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
isSimplyBounded class I1
reference: <testLibrary>::@class::I1
firstFragment: #F4
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::I1::@constructor::new
firstFragment: #F5
isSimplyBounded class I2
reference: <testLibrary>::@class::I2
firstFragment: #F7
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::I2::@constructor::new
firstFragment: #F8
isSimplyBounded class I3
reference: <testLibrary>::@class::I3
firstFragment: #F9
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::I3::@constructor::new
firstFragment: #F10
''');
}
test_class_interfaces_augmentation_add_generic() async {
var library = await buildLibrary(r'''
class A<T> implements I1 {}
class I1 {}
augment class A<T> implements I2<T> {}
class I2<E> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F6 class I1 (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::I1
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::I1::@constructor::new
typeName: I1
#F2 isAugmentation class A (nameOffset:55) (firstTokenOffset:41) (offset:55)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: #E0 T
previousFragment: #F3
#F8 class I2 (nameOffset:86) (firstTokenOffset:80) (offset:86)
element: <testLibrary>::@class::I2
typeParameters
#F9 E (nameOffset:89) (firstTokenOffset:89) (offset:89)
element: #E1 E
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:86)
element: <testLibrary>::@class::I2::@constructor::new
typeName: I2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
interfaces
I1
I2<T>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
isSimplyBounded class I1
reference: <testLibrary>::@class::I1
firstFragment: #F6
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::I1::@constructor::new
firstFragment: #F7
isSimplyBounded class I2
reference: <testLibrary>::@class::I2
firstFragment: #F8
typeParameters
#E1 E
firstFragment: #F9
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::I2::@constructor::new
firstFragment: #F10
''');
}
test_class_interfaces_augmentation_add_generic_mismatch() async {
var library = await buildLibrary(r'''
class A<T> implements I1 {}
class I1 {}
augment class A<T, T2> implements I2<T2> {}
class I2<E> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F5 isOriginOtherFragmentOfEnclosing T2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: #E1 T2
nextFragment: #F6
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F8 class I1 (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::I1
constructors
#F9 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::I1::@constructor::new
typeName: I1
#F2 isAugmentation class A (nameOffset:55) (firstTokenOffset:41) (offset:55)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: #E0 T
previousFragment: #F3
#F6 T2 (nameOffset:60) (firstTokenOffset:60) (offset:60)
element: #E1 T2
previousFragment: #F5
#F10 class I2 (nameOffset:91) (firstTokenOffset:85) (offset:91)
element: <testLibrary>::@class::I2
typeParameters
#F11 E (nameOffset:94) (firstTokenOffset:94) (offset:94)
element: #E2 E
constructors
#F12 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:91)
element: <testLibrary>::@class::I2::@constructor::new
typeName: I2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
interfaces
I1
I2<InvalidType>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F7
isSimplyBounded class I1
reference: <testLibrary>::@class::I1
firstFragment: #F8
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::I1::@constructor::new
firstFragment: #F9
isSimplyBounded class I2
reference: <testLibrary>::@class::I2
firstFragment: #F10
typeParameters
#E2 E
firstFragment: #F11
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::I2::@constructor::new
firstFragment: #F12
''');
}
test_class_interfaces_extensionType() async {
var library = await buildLibrary(r'''
class A {}
extension type B(int it) {}
class C {}
class D implements A, B, C {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
#F2 class C (nameOffset:47) (firstTokenOffset:41) (offset:47)
element: <testLibrary>::@class::C
#F3 class D (nameOffset:59) (firstTokenOffset:53) (offset:59)
element: <testLibrary>::@class::D
extensionTypes
#F4 extension type B (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@extensionType::B
fields
#F5 isFinal isOriginDeclaringFormalParameter it (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@extensionType::B::@field::it
inducedGetter: #F6
getters
#F6 isComplete isOriginVariable it (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@extensionType::B::@getter::it
inducingVariable: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F2
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
interfaces
A
C
extensionTypes
isSimplyBounded extension type B
reference: <testLibrary>::@extensionType::B
firstFragment: #F4
representation: <testLibrary>::@extensionType::B::@field::it
primaryConstructor: <testLibrary>::@extensionType::B::@constructor::new
typeErasure: int
fields
isFinal isOriginDeclaringFormalParameter it
reference: <testLibrary>::@extensionType::B::@field::it
firstFragment: #F5
type: int
getter: <testLibrary>::@extensionType::B::@getter::it
declaringFormalParameter: <testLibrary>::@extensionType::B::@constructor::new::@formalParameter::it
getters
isExtensionTypeMember isOriginVariable it
reference: <testLibrary>::@extensionType::B::@getter::it
firstFragment: #F6
returnType: int
variable: <testLibrary>::@extensionType::B::@field::it
''');
}
test_class_interfaces_Function() async {
var library = await buildLibrary(r'''
class A {}
class B {}
class C implements A, Function, B {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 class B (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F5 class C (nameOffset:30) (firstTokenOffset:24) (offset:30)
element: <testLibrary>::@class::C
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F5
interfaces
A
B
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F6
''');
}
test_class_interfaces_mixin() async {
var library = await buildLibrary(r'''
class A implements M {}
mixin M {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
mixins
#F3 mixin M (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@mixin::M
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
interfaces
M
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F3
superclassConstraints
Object
''');
}
test_class_interfaces_unresolved() async {
var library = await buildLibrary(r'''
class C implements X, Y, Z {}
class X {}
class Z {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class X (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::X
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::X::@constructor::new
typeName: X
#F5 class Z (nameOffset:49) (firstTokenOffset:43) (offset:49)
element: <testLibrary>::@class::Z
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49)
element: <testLibrary>::@class::Z::@constructor::new
typeName: Z
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
interfaces
X
Z
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
isSimplyBounded class X
reference: <testLibrary>::@class::X
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::X::@constructor::new
firstFragment: #F4
isSimplyBounded class Z
reference: <testLibrary>::@class::Z
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::Z::@constructor::new
firstFragment: #F6
''');
}
test_class_lazy_all_constructors() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
''');
var constructors = library.getClass('A')!.constructors;
expect(constructors, hasLength(1));
}
test_class_lazy_all_fields() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
''');
var fields = library.getClass('A')!.fields;
expect(fields, hasLength(1));
}
test_class_lazy_all_getters() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
''');
var getters = library.getClass('A')!.getters;
expect(getters, hasLength(1));
}
test_class_lazy_all_methods() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
''');
var methods = library.getClass('A')!.methods;
expect(methods, hasLength(1));
}
test_class_lazy_all_setters() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
''');
var setters = library.getClass('A')!.setters;
expect(setters, hasLength(1));
}
test_class_lazy_byReference_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
''');
// Test ensureReadMembers() in LinkedElementFactory.
var A = library.getClass('A')!;
var foo = getConstructorElementOfReference(A, 'foo');
expect(foo.name, 'foo');
}
test_class_lazy_byReference_field() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
''');
// Test ensureReadMembers() in LinkedElementFactory.
var A = library.getClass('A')!;
var foo = getFieldElementOfReference(A, 'foo');
expect(foo.name, 'foo');
}
test_class_lazy_byReference_getter() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
''');
// Test ensureReadMembers() in LinkedElementFactory.
var A = library.getClass('A')!;
var foo = getGetterElementOfReference(A, 'foo');
expect(foo.name, 'foo');
}
test_class_lazy_byReference_method() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
''');
// Test ensureReadMembers() in LinkedElementFactory.
var A = library.getClass('A')!;
var foo = getMethodElementOfReference(A, 'foo');
expect(foo.name, 'foo');
}
test_class_lazy_byReference_setter() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
''');
// Test ensureReadMembers() in LinkedElementFactory.
var A = library.getClass('A')!;
var foo = getSetterElementOfReference(A, 'foo');
expect(foo.name, 'foo');
}
test_class_missingName() async {
configuration.withExportScope = true;
var library = await buildLibrary(r'''
class {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class <null-name> (nameOffset:<null>) (firstTokenOffset:0) (offset:0)
element: <testLibrary>::@class::#0
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:0)
element: <testLibrary>::@class::#0::@constructor::new
typeName: null
classes
isSimplyBounded class <null-name>
reference: <testLibrary>::@class::#0
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::#0::@constructor::new
firstFragment: #F2
exportEntries
exportNamespace
''');
}
test_class_mixins() async {
var library = await buildLibrary(r'''
class C extends D with E, F, G {}
class D {}
class E {}
class F {}
class G {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:41) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:53) (firstTokenOffset:47) (offset:53)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
#F7 class F (nameOffset:65) (firstTokenOffset:59) (offset:65)
element: <testLibrary>::@class::F
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:65)
element: <testLibrary>::@class::F::@constructor::new
typeName: F
#F9 class G (nameOffset:77) (firstTokenOffset:71) (offset:77)
element: <testLibrary>::@class::G
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:77)
element: <testLibrary>::@class::G::@constructor::new
typeName: G
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
mixins
E
F
G
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
isSimplyBounded class F
reference: <testLibrary>::@class::F
firstFragment: #F7
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::F::@constructor::new
firstFragment: #F8
isSimplyBounded class G
reference: <testLibrary>::@class::G
firstFragment: #F9
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::G::@constructor::new
firstFragment: #F10
''');
}
test_class_mixins_augmentation_add() async {
var library = await buildLibrary(r'''
class A with M1 {}
mixin M1 {}
augment class A with M2 {}
mixin M2 {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
withClauseMixinStartIndex: 1
mixins
#F4 mixin M1 (nameOffset:25) (firstTokenOffset:19) (offset:25)
element: <testLibrary>::@mixin::M1
#F5 mixin M2 (nameOffset:65) (firstTokenOffset:59) (offset:65)
element: <testLibrary>::@mixin::M2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
supertype: Object
mixins
M1
M2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
mixins
isSimplyBounded mixin M1
reference: <testLibrary>::@mixin::M1
firstFragment: #F4
superclassConstraints
Object
isSimplyBounded mixin M2
reference: <testLibrary>::@mixin::M2
firstFragment: #F5
superclassConstraints
Object
''');
}
test_class_mixins_augmentation_add_inferredTypeArguments() async {
var library = await buildLibrary(r'''
class B<S> {}
class A<T> extends B<T> with M1 {}
mixin M1<U1> on B<U1> {}
augment class A<T> with M2 {}
mixin M2<U2> on M1<U2> {}
augment class A<T> with M3 {}
mixin M3<U3> on M2<U3> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class B (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::B
typeParameters
#F2 S (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 S
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F4 hasExtendsClause class A (nameOffset:20) (firstTokenOffset:14) (offset:20)
element: <testLibrary>::@class::A
nextFragment: #F5
typeParameters
#F6 T (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: #E1 T
nextFragment: #F7
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F5 isAugmentation class A (nameOffset:89) (firstTokenOffset:75) (offset:89)
element: <testLibrary>::@class::A
previousFragment: #F4
nextFragment: #F9
withClauseMixinStartIndex: 1
typeParameters
#F7 T (nameOffset:91) (firstTokenOffset:91) (offset:91)
element: #E1 T
previousFragment: #F6
nextFragment: #F10
#F9 isAugmentation class A (nameOffset:146) (firstTokenOffset:132) (offset:146)
element: <testLibrary>::@class::A
previousFragment: #F5
withClauseMixinStartIndex: 2
typeParameters
#F10 T (nameOffset:148) (firstTokenOffset:148) (offset:148)
element: #E1 T
previousFragment: #F7
mixins
#F11 mixin M1 (nameOffset:55) (firstTokenOffset:49) (offset:55)
element: <testLibrary>::@mixin::M1
typeParameters
#F12 U1 (nameOffset:58) (firstTokenOffset:58) (offset:58)
element: #E2 U1
#F13 mixin M2 (nameOffset:111) (firstTokenOffset:105) (offset:111)
element: <testLibrary>::@mixin::M2
typeParameters
#F14 U2 (nameOffset:114) (firstTokenOffset:114) (offset:114)
element: #E3 U2
#F15 mixin M3 (nameOffset:168) (firstTokenOffset:162) (offset:168)
element: <testLibrary>::@mixin::M3
typeParameters
#F16 U3 (nameOffset:171) (firstTokenOffset:171) (offset:171)
element: #E4 U3
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
typeParameters
#E0 S
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F3
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F4
typeParameters
#E1 T
firstFragment: #F6
supertype: B<T>
mixins
M1<T>
M2<T>
M3<T>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F8
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::B::@constructor::new
substitution: {S: T}
mixins
isSimplyBounded mixin M1
reference: <testLibrary>::@mixin::M1
firstFragment: #F11
typeParameters
#E2 U1
firstFragment: #F12
superclassConstraints
B<U1>
isSimplyBounded mixin M2
reference: <testLibrary>::@mixin::M2
firstFragment: #F13
typeParameters
#E3 U2
firstFragment: #F14
superclassConstraints
M1<U2>
isSimplyBounded mixin M3
reference: <testLibrary>::@mixin::M3
firstFragment: #F15
typeParameters
#E4 U3
firstFragment: #F16
superclassConstraints
M2<U3>
''');
}
test_class_mixins_augmentation_extensionType() async {
var library = await buildLibrary(r'''
mixin A {}
extension type B(int it) {}
mixin C {}
class D extends Object with A, B {}
augment class D with C {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class D (nameOffset:59) (firstTokenOffset:53) (offset:59)
element: <testLibrary>::@class::D
nextFragment: #F2
#F2 isAugmentation class D (nameOffset:104) (firstTokenOffset:90) (offset:104)
element: <testLibrary>::@class::D
previousFragment: #F1
withClauseMixinStartIndex: 1
extensionTypes
#F3 extension type B (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@extensionType::B
fields
#F4 isFinal isOriginDeclaringFormalParameter it (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@extensionType::B::@field::it
inducedGetter: #F5
getters
#F5 isComplete isOriginVariable it (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@extensionType::B::@getter::it
inducingVariable: #F4
mixins
#F6 mixin A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@mixin::A
#F7 mixin C (nameOffset:47) (firstTokenOffset:41) (offset:47)
element: <testLibrary>::@mixin::C
classes
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F1
supertype: Object
mixins
A
C
extensionTypes
isSimplyBounded extension type B
reference: <testLibrary>::@extensionType::B
firstFragment: #F3
representation: <testLibrary>::@extensionType::B::@field::it
primaryConstructor: <testLibrary>::@extensionType::B::@constructor::new
typeErasure: int
fields
isFinal isOriginDeclaringFormalParameter it
reference: <testLibrary>::@extensionType::B::@field::it
firstFragment: #F4
type: int
getter: <testLibrary>::@extensionType::B::@getter::it
declaringFormalParameter: <testLibrary>::@extensionType::B::@constructor::new::@formalParameter::it
getters
isExtensionTypeMember isOriginVariable it
reference: <testLibrary>::@extensionType::B::@getter::it
firstFragment: #F5
returnType: int
variable: <testLibrary>::@extensionType::B::@field::it
mixins
isSimplyBounded mixin A
reference: <testLibrary>::@mixin::A
firstFragment: #F6
superclassConstraints
Object
isSimplyBounded mixin C
reference: <testLibrary>::@mixin::C
firstFragment: #F7
superclassConstraints
Object
''');
}
test_class_mixins_extensionType() async {
var library = await buildLibrary(r'''
mixin A {}
extension type B(int it) {}
mixin C {}
class D extends Object with A, B, C {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class D (nameOffset:59) (firstTokenOffset:53) (offset:59)
element: <testLibrary>::@class::D
extensionTypes
#F2 extension type B (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@extensionType::B
fields
#F3 isFinal isOriginDeclaringFormalParameter it (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@extensionType::B::@field::it
inducedGetter: #F4
getters
#F4 isComplete isOriginVariable it (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@extensionType::B::@getter::it
inducingVariable: #F3
mixins
#F5 mixin A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@mixin::A
#F6 mixin C (nameOffset:47) (firstTokenOffset:41) (offset:47)
element: <testLibrary>::@mixin::C
classes
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F1
supertype: Object
mixins
A
C
extensionTypes
isSimplyBounded extension type B
reference: <testLibrary>::@extensionType::B
firstFragment: #F2
representation: <testLibrary>::@extensionType::B::@field::it
primaryConstructor: <testLibrary>::@extensionType::B::@constructor::new
typeErasure: int
fields
isFinal isOriginDeclaringFormalParameter it
reference: <testLibrary>::@extensionType::B::@field::it
firstFragment: #F3
type: int
getter: <testLibrary>::@extensionType::B::@getter::it
declaringFormalParameter: <testLibrary>::@extensionType::B::@constructor::new::@formalParameter::it
getters
isExtensionTypeMember isOriginVariable it
reference: <testLibrary>::@extensionType::B::@getter::it
firstFragment: #F4
returnType: int
variable: <testLibrary>::@extensionType::B::@field::it
mixins
isSimplyBounded mixin A
reference: <testLibrary>::@mixin::A
firstFragment: #F5
superclassConstraints
Object
isSimplyBounded mixin C
reference: <testLibrary>::@mixin::C
firstFragment: #F6
superclassConstraints
Object
''');
}
test_class_mixins_generic() async {
var library = await buildLibrary(r'''
class Z extends A with B<int>, C<double> {}
class A {}
class B<B1> {}
class C<C1> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class Z (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::Z
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::Z::@constructor::new
typeName: Z
#F3 class A (nameOffset:51) (firstTokenOffset:45) (offset:51)
element: <testLibrary>::@class::A
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:51)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F5 class B (nameOffset:63) (firstTokenOffset:57) (offset:63)
element: <testLibrary>::@class::B
typeParameters
#F6 B1 (nameOffset:65) (firstTokenOffset:65) (offset:65)
element: #E0 B1
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F8 class C (nameOffset:79) (firstTokenOffset:73) (offset:79)
element: <testLibrary>::@class::C
typeParameters
#F9 C1 (nameOffset:81) (firstTokenOffset:81) (offset:81)
element: #E1 C1
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:79)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class Z
reference: <testLibrary>::@class::Z
firstFragment: #F1
supertype: A
mixins
B<int>
C<double>
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::Z::@constructor::new
firstFragment: #F2
superConstructor: <testLibrary>::@class::A::@constructor::new
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
typeParameters
#E0 B1
firstFragment: #F6
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F7
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F8
typeParameters
#E1 C1
firstFragment: #F9
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F10
''');
}
test_class_mixins_generic_superAfter() async {
var library = await buildLibrary(r'''
mixin M<T extends num> {}
mixin M2<T extends num> on M<T> {}
class Z extends S with M2 {}
class S with M<int> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class Z (nameOffset:69) (firstTokenOffset:63) (offset:69)
element: <testLibrary>::@class::Z
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:69)
element: <testLibrary>::@class::Z::@constructor::new
typeName: Z
#F3 class S (nameOffset:99) (firstTokenOffset:93) (offset:99)
element: <testLibrary>::@class::S
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:99)
element: <testLibrary>::@class::S::@constructor::new
typeName: S
mixins
#F5 mixin M (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@mixin::M
typeParameters
#F6 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F7 mixin M2 (nameOffset:33) (firstTokenOffset:27) (offset:33)
element: <testLibrary>::@mixin::M2
typeParameters
#F8 T (nameOffset:36) (firstTokenOffset:36) (offset:36)
element: #E1 T
classes
isSimplyBounded class Z
reference: <testLibrary>::@class::Z
firstFragment: #F1
supertype: S
mixins
M2<int>
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::Z::@constructor::new
firstFragment: #F2
superConstructor: <testLibrary>::@class::S::@constructor::new
isSimplyBounded class S
reference: <testLibrary>::@class::S
firstFragment: #F3
supertype: Object
mixins
M<int>
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::S::@constructor::new
firstFragment: #F4
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F5
typeParameters
#E0 T
firstFragment: #F6
bound: num
superclassConstraints
Object
isSimplyBounded mixin M2
reference: <testLibrary>::@mixin::M2
firstFragment: #F7
typeParameters
#E1 T
firstFragment: #F8
bound: num
superclassConstraints
M<T>
''');
}
test_class_mixins_genericMixin_tooManyArguments() async {
var library = await buildLibrary(r'''
mixin M<T> {}
class A extends Object with M<int, String> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class A (nameOffset:21) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
mixins
#F3 mixin M (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@mixin::M
typeParameters
#F4 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
supertype: Object
mixins
M<dynamic>
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F4
superclassConstraints
Object
''');
}
test_class_mixins_typeParameter() async {
var library = await buildLibrary(r'''
mixin M1 {}
mixin M2 {}
class A<T> extends Object with M1, T<int>, M2 {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class A (nameOffset:32) (firstTokenOffset:26) (offset:32)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:34) (firstTokenOffset:34) (offset:34)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
mixins
#F4 mixin M1 (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@mixin::M1
#F5 mixin M2 (nameOffset:19) (firstTokenOffset:13) (offset:19)
element: <testLibrary>::@mixin::M2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
supertype: Object
mixins
M1
M2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
mixins
isSimplyBounded mixin M1
reference: <testLibrary>::@mixin::M1
firstFragment: #F4
superclassConstraints
Object
isSimplyBounded mixin M2
reference: <testLibrary>::@mixin::M2
firstFragment: #F5
superclassConstraints
Object
''');
}
test_class_mixins_unresolved() async {
var library = await buildLibrary(r'''
class C extends Object with X, Y, Z {}
class X {}
class Z {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class X (nameOffset:46) (firstTokenOffset:40) (offset:46)
element: <testLibrary>::@class::X
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46)
element: <testLibrary>::@class::X::@constructor::new
typeName: X
#F5 class Z (nameOffset:58) (firstTokenOffset:52) (offset:58)
element: <testLibrary>::@class::Z
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:58)
element: <testLibrary>::@class::Z::@constructor::new
typeName: Z
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: Object
mixins
X
Z
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
isSimplyBounded class X
reference: <testLibrary>::@class::X
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::X::@constructor::new
firstFragment: #F4
isSimplyBounded class Z
reference: <testLibrary>::@class::Z
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::Z::@constructor::new
firstFragment: #F6
''');
}
test_class_modifiers_abstract() async {
var library = await buildLibrary(r'''
abstract class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class C (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isAbstract isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_modifiers_augmentation_chain_abstract_abstract() async {
var library = await buildLibrary(r'''
abstract class A {}
augment abstract class A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class A (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAbstract isAugmentation class A (nameOffset:44) (firstTokenOffset:21) (offset:44)
element: <testLibrary>::@class::A
previousFragment: #F1
classes
isAbstract isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_modifiers_augmentation_chain_base_base() async {
var library = await buildLibrary(r'''
base class A {}
augment base class A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isBase class A (nameOffset:11) (firstTokenOffset:0) (offset:11)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:11)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation isBase class A (nameOffset:36) (firstTokenOffset:17) (offset:36)
element: <testLibrary>::@class::A
previousFragment: #F1
classes
isBase isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_modifiers_augmentation_chain_final_final() async {
var library = await buildLibrary(r'''
final class A {}
augment final class A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isFinal class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation isFinal class A (nameOffset:38) (firstTokenOffset:18) (offset:38)
element: <testLibrary>::@class::A
previousFragment: #F1
classes
isFinal isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_modifiers_augmentation_chain_interface_interface() async {
var library = await buildLibrary(r'''
interface class A {}
augment interface class A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isInterface class A (nameOffset:16) (firstTokenOffset:0) (offset:16)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation isInterface class A (nameOffset:46) (firstTokenOffset:22) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
classes
isInterface isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_modifiers_augmentation_chain_mixin_class_mixin_class() async {
var library = await buildLibrary(r'''
mixin class A {}
augment mixin class A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinClass class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation isMixinClass class A (nameOffset:38) (firstTokenOffset:18) (offset:38)
element: <testLibrary>::@class::A
previousFragment: #F1
classes
isMixinClass isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_modifiers_augmentation_chain_sealed_sealed() async {
var library = await buildLibrary(r'''
sealed class A {}
augment sealed class A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isSealed class A (nameOffset:13) (firstTokenOffset:0) (offset:13)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation isSealed class A (nameOffset:40) (firstTokenOffset:19) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
classes
isAbstract isSealed isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_modifiers_base() async {
var library = await buildLibrary(r'''
base class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isBase class C (nameOffset:11) (firstTokenOffset:0) (offset:11)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:11)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isBase isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_modifiers_final() async {
var library = await buildLibrary(r'''
final class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isFinal class C (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isFinal isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_modifiers_interface() async {
var library = await buildLibrary(r'''
interface class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isInterface class C (nameOffset:16) (firstTokenOffset:0) (offset:16)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isInterface isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_modifiers_mixin_class() async {
var library = await buildLibrary(r'''
mixin class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinClass class C (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isMixinClass isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_modifiers_sealed() async {
var library = await buildLibrary(r'''
sealed class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isSealed class C (nameOffset:13) (firstTokenOffset:0) (offset:13)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isAbstract isSealed isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_modifiers_sealed_induced_base_extends_base() async {
var library = await buildLibrary(r'''
base class A {}
sealed class B extends A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isBase class A (nameOffset:11) (firstTokenOffset:0) (offset:11)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:11)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause isSealed class B (nameOffset:30) (firstTokenOffset:17) (offset:30)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isBase isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isAbstract isBase isSealed isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_class_modifiers_sealed_induced_base_implements_base() async {
var library = await buildLibrary(r'''
base class A {}
sealed class B implements A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isBase class A (nameOffset:11) (firstTokenOffset:0) (offset:11)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:11)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 isSealed class B (nameOffset:30) (firstTokenOffset:17) (offset:30)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isBase isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isAbstract isBase isSealed isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
interfaces
A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
''');
}
test_class_modifiers_sealed_induced_base_implements_final() async {
var library = await buildLibrary(r'''
final class A {}
sealed class B implements A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isFinal class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 isSealed class B (nameOffset:31) (firstTokenOffset:18) (offset:31)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isFinal isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isAbstract isBase isSealed isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
interfaces
A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
''');
}
test_class_modifiers_sealed_induced_final_extends_final() async {
var library = await buildLibrary(r'''
final class A {}
sealed class B extends A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isFinal class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause isSealed class B (nameOffset:31) (firstTokenOffset:18) (offset:31)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isFinal isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isAbstract isFinal isSealed isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_class_modifiers_sealed_induced_final_with_base_mixin() async {
var library = await buildLibrary(r'''
base mixin A {}
interface class B {}
sealed class C extends B with A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isInterface class B (nameOffset:33) (firstTokenOffset:17) (offset:33)
element: <testLibrary>::@class::B
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:33)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F3 hasExtendsClause isSealed class C (nameOffset:52) (firstTokenOffset:39) (offset:52)
element: <testLibrary>::@class::C
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:52)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
mixins
#F5 isBase mixin A (nameOffset:11) (firstTokenOffset:0) (offset:11)
element: <testLibrary>::@mixin::A
classes
isInterface isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F2
isAbstract isFinal isSealed isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F3
supertype: B
mixins
A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::B::@constructor::new
mixins
isBase isSimplyBounded mixin A
reference: <testLibrary>::@mixin::A
firstFragment: #F5
superclassConstraints
Object
''');
}
test_class_modifiers_sealed_induced_interface_extends_interface() async {
var library = await buildLibrary(r'''
interface class A {}
sealed class B extends A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isInterface class A (nameOffset:16) (firstTokenOffset:0) (offset:16)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause isSealed class B (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:35)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isInterface isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isAbstract isInterface isSealed isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_class_modifiers_sealed_induced_none_implements_interface() async {
var library = await buildLibrary(r'''
interface class A {}
sealed class B implements A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isInterface class A (nameOffset:16) (firstTokenOffset:0) (offset:16)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 isSealed class B (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:35)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isInterface isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isAbstract isSealed isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
interfaces
A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
''');
}
test_class_notSimplyBounded_augmentation_chain_self() async {
var library = await buildLibrary(r'''
class A<T extends A> {}
augment class A<T extends A> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation class A (nameOffset:39) (firstTokenOffset:25) (offset:39)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:41) (firstTokenOffset:41) (offset:41)
element: #E0 T
previousFragment: #F3
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
bound: A<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
''');
}
test_class_notSimplyBounded_circularity_via_typeAlias_recordType() async {
var library = await buildLibrary(r'''
class C<T extends A> {}
typedef A = (C, int);
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeAliases
#F4 A (nameOffset:33) (firstTokenOffset:25) (offset:33)
element: <testLibrary>::@typeAlias::A
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: dynamic
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
typeAliases
A
reference: <testLibrary>::@typeAlias::A
firstFragment: #F4
aliasedType: (C<dynamic>, int)
''');
}
test_class_notSimplyBounded_circularity_via_typedef() async {
// C's type parameter T is not simply bounded because its bound, F, expands
// to `dynamic F(C)`, which refers to C.
var library = await buildLibrary(r'''
class C<T extends F> {}
typedef F(C value);
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeAliases
#F4 F (nameOffset:33) (firstTokenOffset:25) (offset:33)
element: <testLibrary>::@typeAlias::F
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: dynamic
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
typeAliases
F
reference: <testLibrary>::@typeAlias::F
firstFragment: #F4
aliasedType: dynamic Function(C<dynamic>)
''');
}
test_class_notSimplyBounded_circularity_with_typeParameters() async {
// C's type parameter T is simply bounded because even though it refers to
// C, it specifies a bound.
var library = await buildLibrary(r'''
class C<T extends C<dynamic>> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: C<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_notSimplyBounded_complex_by_cycle_class() async {
var library = await buildLibrary(r'''
class C<T extends D> {}
class D<T extends C> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F4 class D (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::D
typeParameters
#F5 T (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E1 T
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: D<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
class D
reference: <testLibrary>::@class::D
firstFragment: #F4
typeParameters
#E1 T
firstFragment: #F5
bound: C<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F6
''');
}
test_class_notSimplyBounded_complex_by_cycle_typedef_functionType() async {
var library = await buildLibrary(r'''
typedef C<T extends D> = void Function();
typedef D<T extends C> = void Function();
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
typeAliases
#F1 C (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::C
typeParameters
#F2 T (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E0 T
#F3 D (nameOffset:50) (firstTokenOffset:42) (offset:50)
element: <testLibrary>::@typeAlias::D
typeParameters
#F4 T (nameOffset:52) (firstTokenOffset:52) (offset:52)
element: #E1 T
typeAliases
C
reference: <testLibrary>::@typeAlias::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: dynamic
aliasedType: void Function()
D
reference: <testLibrary>::@typeAlias::D
firstFragment: #F3
typeParameters
#E1 T
firstFragment: #F4
bound: dynamic
aliasedType: void Function()
''');
}
test_class_notSimplyBounded_complex_by_cycle_typedef_interfaceType() async {
var library = await buildLibrary(r'''
typedef C<T extends D> = List<T>;
typedef D<T extends C> = List<T>;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
typeAliases
#F1 C (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::C
typeParameters
#F2 T (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E0 T
#F3 D (nameOffset:42) (firstTokenOffset:34) (offset:42)
element: <testLibrary>::@typeAlias::D
typeParameters
#F4 T (nameOffset:44) (firstTokenOffset:44) (offset:44)
element: #E1 T
typeAliases
C
reference: <testLibrary>::@typeAlias::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: dynamic
aliasedType: List<T>
D
reference: <testLibrary>::@typeAlias::D
firstFragment: #F3
typeParameters
#E1 T
firstFragment: #F4
bound: dynamic
aliasedType: List<T>
''');
}
test_class_notSimplyBounded_complex_by_reference_to_cycle() async {
var library = await buildLibrary(r'''
class C<T extends D> {}
class D<T extends D> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F4 class D (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::D
typeParameters
#F5 T (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E1 T
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: D<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
class D
reference: <testLibrary>::@class::D
firstFragment: #F4
typeParameters
#E1 T
firstFragment: #F5
bound: D<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F6
''');
}
test_class_notSimplyBounded_complex_by_use_of_typeParameter() async {
var library = await buildLibrary(r'''
class C<T extends D<T>> {}
class D<T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F4 class D (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::D
typeParameters
#F5 T (nameOffset:36) (firstTokenOffset:36) (offset:36)
element: #E1 T
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: D<T>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F4
typeParameters
#E1 T
firstFragment: #F5
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F6
''');
}
test_class_notSimplyBounded_dependency_with_typeParameters() async {
// C's type parameter T is simply bounded because even though it refers to
// non-simply-bounded type D, it specifies a bound.
var library = await buildLibrary(r'''
class C<T extends D<dynamic>> {}
class D<T extends D<T>> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F4 class D (nameOffset:40) (firstTokenOffset:34) (offset:40)
element: <testLibrary>::@class::D
typeParameters
#F5 T (nameOffset:42) (firstTokenOffset:42) (offset:42)
element: #E1 T
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:40)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: D<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
class D
reference: <testLibrary>::@class::D
firstFragment: #F4
typeParameters
#E1 T
firstFragment: #F5
bound: D<T>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F6
''');
}
test_class_notSimplyBounded_function_typed_bound_complex_via_formalParameterType() async {
var library = await buildLibrary(r'''
class C<T extends void Function(T)> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: void Function(T)
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_notSimplyBounded_function_typed_bound_complex_via_return_type() async {
var library = await buildLibrary(r'''
class C<T extends T Function()> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: T Function()
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_notSimplyBounded_function_typed_bound_simple() async {
var library = await buildLibrary(r'''
class C<T extends void Function()> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: void Function()
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_notSimplyBounded_refers_to_circular_typedef() async {
// C's type parameter T has a bound of F, which is a circular typedef. This
// is illegal in Dart, but we need to make sure it doesn't lead to a crash
// or infinite loop.
var library = await buildLibrary(r'''
class C<T extends F> {}
typedef F(G value);
typedef G(F value);
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeAliases
#F4 F (nameOffset:33) (firstTokenOffset:25) (offset:33)
element: <testLibrary>::@typeAlias::F
#F5 G (nameOffset:53) (firstTokenOffset:45) (offset:53)
element: <testLibrary>::@typeAlias::G
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: dynamic
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
typeAliases
F
reference: <testLibrary>::@typeAlias::F
firstFragment: #F4
aliasedType: dynamic Function(dynamic)
G
reference: <testLibrary>::@typeAlias::G
firstFragment: #F5
aliasedType: dynamic Function(dynamic)
''');
}
test_class_notSimplyBounded_self() async {
var library = await buildLibrary(r'''
class C<T extends C> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: C<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_notSimplyBounded_simple_because_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 buildLibrary(r'''
class C {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_notSimplyBounded_simple_by_lack_of_cycles() async {
var library = await buildLibrary(r'''
class C<T extends D> {}
class D<T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F4 class D (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::D
typeParameters
#F5 T (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E1 T
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: D<dynamic>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F4
typeParameters
#E1 T
firstFragment: #F5
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F6
''');
}
test_class_notSimplyBounded_simple_by_syntax() 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 buildLibrary(r'''
class C<T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_ref_nullability_none() async {
var library = await buildLibrary(r'''
class C {}
C c;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
topLevelVariables
#F3 isOriginDeclaration isStatic c (nameOffset:14) (firstTokenOffset:14) (offset:14)
element: <testLibrary>::@topLevelVariable::c
inducedGetter: #F4
inducedSetter: #F5
getters
#F4 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@getter::c
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@setter::c
inducingVariable: #F3
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@setter::c::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
topLevelVariables
isOriginDeclaration isStatic c
reference: <testLibrary>::@topLevelVariable::c
firstFragment: #F3
type: C
getter: <testLibrary>::@getter::c
setter: <testLibrary>::@setter::c
getters
isOriginVariable isStatic c
reference: <testLibrary>::@getter::c
firstFragment: #F4
returnType: C
variable: <testLibrary>::@topLevelVariable::c
setters
isOriginVariable isStatic c
reference: <testLibrary>::@setter::c
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: C
returnType: void
variable: <testLibrary>::@topLevelVariable::c
''');
}
test_class_ref_nullability_question() async {
var library = await buildLibrary(r'''
class C {}
C? c;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
topLevelVariables
#F3 isOriginDeclaration isStatic c (nameOffset:15) (firstTokenOffset:15) (offset:15)
element: <testLibrary>::@topLevelVariable::c
inducedGetter: #F4
inducedSetter: #F5
getters
#F4 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@getter::c
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@setter::c
inducingVariable: #F3
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@setter::c::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
topLevelVariables
isOriginDeclaration isStatic c
reference: <testLibrary>::@topLevelVariable::c
firstFragment: #F3
type: C?
getter: <testLibrary>::@getter::c
setter: <testLibrary>::@setter::c
getters
isOriginVariable isStatic c
reference: <testLibrary>::@getter::c
firstFragment: #F4
returnType: C?
variable: <testLibrary>::@topLevelVariable::c
setters
isOriginVariable isStatic c
reference: <testLibrary>::@setter::c
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: C?
returnType: void
variable: <testLibrary>::@topLevelVariable::c
''');
}
test_class_supertype() async {
var library = await buildLibrary(r'''
class A {}
class B extends A {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
#F2 hasExtendsClause class B (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::B
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F2
supertype: A
''');
}
test_class_supertype_augmentation_add_extends() async {
var library = await buildLibrary(r'''
class A<T> {}
class B<T> {}
augment class B<T> extends A<T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F4 class B (nameOffset:20) (firstTokenOffset:14) (offset:20)
element: <testLibrary>::@class::B
nextFragment: #F5
typeParameters
#F6 T (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: #E1 T
nextFragment: #F7
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F5 hasExtendsClause isAugmentation class B (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::B
previousFragment: #F4
typeParameters
#F7 T (nameOffset:45) (firstTokenOffset:45) (offset:45)
element: #E1 T
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
typeParameters
#E1 T
firstFragment: #F6
supertype: A<T>
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: T}
''');
}
test_class_supertype_augmentation_add_extends_duplicateIgnored() async {
// `extends B` should be ignored, we already have `extends A`
var library = await buildLibrary(r'''
class A {}
class B {}
class C {}
augment class C extends A {}
augment class C extends B {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 class B (nameOffset:17) (firstTokenOffset:11) (offset:17)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F5 class C (nameOffset:28) (firstTokenOffset:22) (offset:28)
element: <testLibrary>::@class::C
nextFragment: #F6
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F6 hasExtendsClause isAugmentation class C (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::C
previousFragment: #F5
nextFragment: #F8
#F8 hasExtendsClause isAugmentation class C (nameOffset:77) (firstTokenOffset:63) (offset:77)
element: <testLibrary>::@class::C
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F5
supertype: A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F7
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_class_supertype_dynamic() async {
var library = await buildLibrary(r'''
class A extends dynamic {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
''');
}
test_class_supertype_extensionType() async {
var library = await buildLibrary(r'''
extension type A(int it) {}
class B extends A {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class B (nameOffset:35) (firstTokenOffset:29) (offset:35)
element: <testLibrary>::@class::B
extensionTypes
#F2 extension type A (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@extensionType::A
fields
#F3 isFinal isOriginDeclaringFormalParameter it (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@extensionType::A::@field::it
inducedGetter: #F4
getters
#F4 isComplete isOriginVariable it (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@extensionType::A::@getter::it
inducingVariable: #F3
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
extensionTypes
isSimplyBounded extension type A
reference: <testLibrary>::@extensionType::A
firstFragment: #F2
representation: <testLibrary>::@extensionType::A::@field::it
primaryConstructor: <testLibrary>::@extensionType::A::@constructor::new
typeErasure: int
fields
isFinal isOriginDeclaringFormalParameter it
reference: <testLibrary>::@extensionType::A::@field::it
firstFragment: #F3
type: int
getter: <testLibrary>::@extensionType::A::@getter::it
declaringFormalParameter: <testLibrary>::@extensionType::A::@constructor::new::@formalParameter::it
getters
isExtensionTypeMember isOriginVariable it
reference: <testLibrary>::@extensionType::A::@getter::it
firstFragment: #F4
returnType: int
variable: <testLibrary>::@extensionType::A::@field::it
''');
}
test_class_supertype_genericClass() async {
var library = await buildLibrary(r'''
class C extends D<int, double> {}
class D<T1, T2> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:41) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::D
typeParameters
#F4 T1 (nameOffset:43) (firstTokenOffset:43) (offset:43)
element: #E0 T1
#F5 T2 (nameOffset:47) (firstTokenOffset:47) (offset:47)
element: #E1 T2
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D<int, double>
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::D::@constructor::new
substitution: {T1: int, T2: double}
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
typeParameters
#E0 T1
firstFragment: #F4
#E1 T2
firstFragment: #F5
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F6
''');
}
test_class_supertype_genericClass_tooManyArguments() async {
var library = await buildLibrary(r'''
class A<T> {}
class B extends A<int, String> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 hasExtendsClause class B (nameOffset:21) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::B
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A<dynamic>
''');
}
test_class_supertype_typeArguments_self() async {
var library = await buildLibrary(r'''
class A<T> {}
class B extends A<B> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F4 hasExtendsClause class B (nameOffset:21) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::B
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A<B>
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: B}
''');
}
test_class_supertype_typeParameter() async {
var library = await buildLibrary(r'''
class A<T> extends T<int> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_supertype_unresolved() async {
var library = await buildLibrary(r'''
class C extends D {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_class_typeParameters() async {
var library = await buildLibrary(r'''
class C<T, U> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
''');
}
test_class_typeParameters_augmentation_chain_bounds_int_int() async {
var library = await buildLibrary(r'''
class A<T extends int> {}
augment class A<T extends int> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:42) (firstTokenOffset:42) (offset:42)
element: #E0 T
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
bound: int
''');
}
test_class_typeParameters_augmentation_chain_bounds_int_nothing() async {
var library = await buildLibrary(r'''
class A<T extends int> {}
augment class A<T> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:42) (firstTokenOffset:42) (offset:42)
element: #E0 T
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
bound: int
''');
}
test_class_typeParameters_augmentation_chain_bounds_int_string() async {
var library = await buildLibrary(r'''
class A<T extends int> {}
augment class A<T extends String> {}
''');
configuration.withConstructors = false;
configuration.withDefaultType = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:42) (firstTokenOffset:42) (offset:42)
element: #E0 T
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
bound: int
defaultType: int
''');
}
test_class_typeParameters_augmentation_chain_bounds_nothing_int() async {
var library = await buildLibrary(r'''
class A<T> {}
augment class A<T extends int> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:28) (firstTokenOffset:14) (offset:28)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: #E0 T
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
''');
}
test_class_typeParameters_augmentation_chain_count_111() async {
var library = await buildLibrary(r'''
class A<T> {}
augment class A<T> {}
augment class A<T> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:28) (firstTokenOffset:14) (offset:28)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F5
typeParameters
#F4 T (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: #E0 T
previousFragment: #F3
nextFragment: #F6
#F5 isAugmentation class A (nameOffset:50) (firstTokenOffset:36) (offset:50)
element: <testLibrary>::@class::A
previousFragment: #F2
typeParameters
#F6 T (nameOffset:52) (firstTokenOffset:52) (offset:52)
element: #E0 T
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
''');
}
test_class_typeParameters_augmentation_chain_count_112() async {
var library = await buildLibrary(r'''
class A<T> {}
augment class A<T> {}
augment class A<T, U> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F5 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: #E1 U
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:28) (firstTokenOffset:14) (offset:28)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
typeParameters
#F4 T (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: #E0 T
previousFragment: #F3
nextFragment: #F8
#F6 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: #E1 U
previousFragment: #F5
nextFragment: #F9
#F7 isAugmentation class A (nameOffset:50) (firstTokenOffset:36) (offset:50)
element: <testLibrary>::@class::A
previousFragment: #F2
typeParameters
#F8 T (nameOffset:52) (firstTokenOffset:52) (offset:52)
element: #E0 T
previousFragment: #F4
#F9 U (nameOffset:55) (firstTokenOffset:55) (offset:55)
element: #E1 U
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
''');
}
test_class_typeParameters_augmentation_chain_count_121() async {
var library = await buildLibrary(r'''
class A<T> {}
augment class A<T, U> {}
augment class A<T> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F5 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: #E1 U
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:28) (firstTokenOffset:14) (offset:28)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
typeParameters
#F4 T (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: #E0 T
previousFragment: #F3
nextFragment: #F8
#F6 U (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E1 U
previousFragment: #F5
nextFragment: #F9
#F7 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F2
typeParameters
#F8 T (nameOffset:55) (firstTokenOffset:55) (offset:55)
element: #E0 T
previousFragment: #F4
#F9 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: #E1 U
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
''');
}
test_class_typeParameters_augmentation_chain_count_123() async {
var library = await buildLibrary(r'''
class A<T> {}
augment class A<T, U> {}
augment class A<T, U, V> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F5 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: #E1 U
nextFragment: #F6
#F7 isOriginOtherFragmentOfEnclosing V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: #E2 V
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:28) (firstTokenOffset:14) (offset:28)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
typeParameters
#F4 T (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: #E0 T
previousFragment: #F3
nextFragment: #F10
#F6 U (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E1 U
previousFragment: #F5
nextFragment: #F11
#F8 isOriginOtherFragmentOfEnclosing V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: #E2 V
previousFragment: #F7
nextFragment: #F12
#F9 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F2
typeParameters
#F10 T (nameOffset:55) (firstTokenOffset:55) (offset:55)
element: #E0 T
previousFragment: #F4
#F11 U (nameOffset:58) (firstTokenOffset:58) (offset:58)
element: #E1 U
previousFragment: #F6
#F12 V (nameOffset:61) (firstTokenOffset:61) (offset:61)
element: #E2 V
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
''');
}
test_class_typeParameters_augmentation_chain_count_211() async {
var library = await buildLibrary(r'''
class A<T, U> {}
augment class A<T> {}
augment class A<T> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F5 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:31) (firstTokenOffset:17) (offset:31)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
typeParameters
#F4 T (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E0 T
previousFragment: #F3
nextFragment: #F8
#F6 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: #E1 U
previousFragment: #F5
nextFragment: #F9
#F7 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F2
typeParameters
#F8 T (nameOffset:55) (firstTokenOffset:55) (offset:55)
element: #E0 T
previousFragment: #F4
#F9 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: #E1 U
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
#E1 U
firstFragment: #F5
''');
}
test_class_typeParameters_augmentation_chain_count_212() async {
var library = await buildLibrary(r'''
class A<T, U> {}
augment class A<T> {}
augment class A<T, U> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F5 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:31) (firstTokenOffset:17) (offset:31)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
typeParameters
#F4 T (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E0 T
previousFragment: #F3
nextFragment: #F8
#F6 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: #E1 U
previousFragment: #F5
nextFragment: #F9
#F7 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F2
typeParameters
#F8 T (nameOffset:55) (firstTokenOffset:55) (offset:55)
element: #E0 T
previousFragment: #F4
#F9 U (nameOffset:58) (firstTokenOffset:58) (offset:58)
element: #E1 U
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
#E1 U
firstFragment: #F5
''');
}
test_class_typeParameters_augmentation_chain_differentNames() async {
var library = await buildLibrary(r'''
class A<T, U> {}
augment class A<U, T> {}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F5 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:31) (firstTokenOffset:17) (offset:31)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 U (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E0 T
previousFragment: #F3
#F6 T (nameOffset:36) (firstTokenOffset:36) (offset:36)
element: #E1 U
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
#E1 U
firstFragment: #F5
''');
}
test_class_typeParameters_bound() async {
var library = await buildLibrary(r'''
class C<T extends Object, U extends D> {}
class D {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:26) (firstTokenOffset:26) (offset:26)
element: #E1 U
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F5 class D (nameOffset:49) (firstTokenOffset:43) (offset:49)
element: <testLibrary>::@class::D
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: Object
#E1 U
firstFragment: #F3
bound: D
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F6
''');
}
test_class_typeParameters_cycle_1of1() async {
var library = await buildLibrary(r'''
class C<T extends T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: dynamic
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_cycle_2of3() async {
var library = await buildLibrary(r'''
class C<T extends V, U, V extends T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E1 U
#F4 V (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: #E2 V
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: dynamic
#E1 U
firstFragment: #F3
#E2 V
firstFragment: #F4
bound: dynamic
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
''');
}
test_class_typeParameters_defaultType_cycle_genericFunctionType() async {
var library = await buildLibrary(r'''
class A<T extends void Function(A)> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: void Function(A<dynamic>)
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_defaultType_cycle_genericFunctionType2() async {
var library = await buildLibrary(r'''
class C<T extends void Function<U extends C>()> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: void Function<U extends C<dynamic>>()
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_defaultType_functionTypeAlias_contravariant() async {
var library = await buildLibrary(r'''
typedef F<X> = void Function(X);
class A<X extends F<X>> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:40) (firstTokenOffset:34) (offset:40)
element: <testLibrary>::@class::A
typeParameters
#F2 X (nameOffset:42) (firstTokenOffset:42) (offset:42)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:40)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeAliases
#F4 F (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::F
typeParameters
#F5 X (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E1 X
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: void Function(X)
alias: <testLibrary>::@typeAlias::F
typeArguments
X
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
typeAliases
isSimplyBounded F
reference: <testLibrary>::@typeAlias::F
firstFragment: #F4
typeParameters
#E1 X
firstFragment: #F5
aliasedType: void Function(X)
''');
}
test_class_typeParameters_defaultType_functionTypeAlias_covariant() async {
var library = await buildLibrary(r'''
typedef F<X> = X Function();
class A<X extends F<X>> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:36) (firstTokenOffset:30) (offset:36)
element: <testLibrary>::@class::A
typeParameters
#F2 X (nameOffset:38) (firstTokenOffset:38) (offset:38)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeAliases
#F4 F (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::F
typeParameters
#F5 X (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E1 X
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: X Function()
alias: <testLibrary>::@typeAlias::F
typeArguments
X
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
typeAliases
isSimplyBounded F
reference: <testLibrary>::@typeAlias::F
firstFragment: #F4
typeParameters
#E1 X
firstFragment: #F5
aliasedType: X Function()
''');
}
test_class_typeParameters_defaultType_functionTypeAlias_invariant() async {
var library = await buildLibrary(r'''
typedef F<X> = X Function(X);
class A<X extends F<X>> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::A
typeParameters
#F2 X (nameOffset:39) (firstTokenOffset:39) (offset:39)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeAliases
#F4 F (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::F
typeParameters
#F5 X (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E1 X
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: X Function(X)
alias: <testLibrary>::@typeAlias::F
typeArguments
X
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
typeAliases
isSimplyBounded F
reference: <testLibrary>::@typeAlias::F
firstFragment: #F4
typeParameters
#E1 X
firstFragment: #F5
aliasedType: X Function(X)
''');
}
test_class_typeParameters_defaultType_functionTypeAlias_invariant_legacy() async {
var library = await buildLibrary(r'''
typedef F<X> = X Function(X);
class A<X extends F<X>> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::A
typeParameters
#F2 X (nameOffset:39) (firstTokenOffset:39) (offset:39)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeAliases
#F4 F (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::F
typeParameters
#F5 X (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E1 X
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: X Function(X)
alias: <testLibrary>::@typeAlias::F
typeArguments
X
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
typeAliases
isSimplyBounded F
reference: <testLibrary>::@typeAlias::F
firstFragment: #F4
typeParameters
#E1 X
firstFragment: #F5
aliasedType: X Function(X)
''');
}
test_class_typeParameters_defaultType_genericFunctionType_both() async {
var library = await buildLibrary(r'''
class A<X extends X Function(X)> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 X (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: X Function(X)
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_defaultType_genericFunctionType_contravariant() async {
var library = await buildLibrary(r'''
class A<X extends void Function(X)> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 X (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: void Function(X)
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_defaultType_genericFunctionType_covariant() async {
var library = await buildLibrary(r'''
class A<X extends X Function()> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 X (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: X Function()
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_defaultType_genericFunctionType_covariant_legacy() async {
var library = await buildLibrary(r'''
class A<X extends X Function()> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 X (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: X Function()
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_defaultType_typeAlias_interface_contravariant() async {
var library = await buildLibrary(r'''
typedef A<X> = List<void Function(X)>;
class B<X extends A<X>> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class B (nameOffset:46) (firstTokenOffset:40) (offset:46)
element: <testLibrary>::@class::B
typeParameters
#F2 X (nameOffset:48) (firstTokenOffset:48) (offset:48)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeAliases
#F4 A (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::A
typeParameters
#F5 X (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E1 X
classes
class B
reference: <testLibrary>::@class::B
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: List<void Function(X)>
alias: <testLibrary>::@typeAlias::A
typeArguments
X
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F3
typeAliases
isSimplyBounded A
reference: <testLibrary>::@typeAlias::A
firstFragment: #F4
typeParameters
#E1 X
firstFragment: #F5
aliasedType: List<void Function(X)>
''');
}
test_class_typeParameters_defaultType_typeAlias_interface_covariant() async {
var library = await buildLibrary(r'''
typedef A<X> = Map<X, int>;
class B<X extends A<X>> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class B (nameOffset:35) (firstTokenOffset:29) (offset:35)
element: <testLibrary>::@class::B
typeParameters
#F2 X (nameOffset:37) (firstTokenOffset:37) (offset:37)
element: #E0 X
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:35)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeAliases
#F4 A (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::A
typeParameters
#F5 X (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E1 X
classes
class B
reference: <testLibrary>::@class::B
firstFragment: #F1
typeParameters
#E0 X
firstFragment: #F2
bound: Map<X, int>
alias: <testLibrary>::@typeAlias::A
typeArguments
X
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F3
typeAliases
isSimplyBounded A
reference: <testLibrary>::@typeAlias::A
firstFragment: #F4
typeParameters
#E1 X
firstFragment: #F5
aliasedType: Map<X, int>
''');
}
test_class_typeParameters_f_bound_complex() async {
var library = await buildLibrary(r'''
class C<T extends List<U>, U> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:27) (firstTokenOffset:27) (offset:27)
element: #E1 U
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: List<U>
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
''');
}
test_class_typeParameters_f_bound_simple() async {
var library = await buildLibrary(r'''
class C<T extends U, U> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E1 U
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: U
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
''');
}
test_class_typeParameters_missingName() async {
var library = await buildLibrary(r'''
class A<T,> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 <null-name> (nameOffset:<null>) (firstTokenOffset:10) (offset:10)
element: #E1 <null-name>
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 <null-name>
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
''');
}
test_class_typeParameters_variance_contravariant() async {
var library = await buildLibrary(r'''
class C<in T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:11) (firstTokenOffset:8) (offset:11)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_variance_covariant() async {
var library = await buildLibrary(r'''
class C<out T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_variance_invariant() async {
var library = await buildLibrary(r'''
class C<inout T> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:14) (firstTokenOffset:8) (offset:14)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_class_typeParameters_variance_multiple() async {
var library = await buildLibrary(r'''
class C<inout T, in U, out V> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:14) (firstTokenOffset:8) (offset:14)
element: #E0 T
#F3 U (nameOffset:20) (firstTokenOffset:17) (offset:20)
element: #E1 U
#F4 V (nameOffset:27) (firstTokenOffset:23) (offset:27)
element: #E2 V
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
#E2 V
firstFragment: #F4
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
''');
}
test_classAlias() async {
var library = await buildLibrary(r'''
class C = D with E, F, G;
class D {}
class E {}
class F {}
class G {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:33) (firstTokenOffset:27) (offset:33)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:33)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:45) (firstTokenOffset:39) (offset:45)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:45)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
#F7 class F (nameOffset:57) (firstTokenOffset:51) (offset:57)
element: <testLibrary>::@class::F
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::F::@constructor::new
typeName: F
#F9 class G (nameOffset:69) (firstTokenOffset:63) (offset:69)
element: <testLibrary>::@class::G
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:69)
element: <testLibrary>::@class::G::@constructor::new
typeName: G
classes
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
mixins
E
F
G
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
isSimplyBounded class F
reference: <testLibrary>::@class::F
firstFragment: #F7
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::F::@constructor::new
firstFragment: #F8
isSimplyBounded class G
reference: <testLibrary>::@class::G
firstFragment: #F9
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::G::@constructor::new
firstFragment: #F10
''');
}
test_classAlias_abstract() async {
var library = await buildLibrary(r'''
abstract class C = D with E;
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract isMixinApplication class C (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::C
constructors
#F2 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:36) (firstTokenOffset:30) (offset:36)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:48) (firstTokenOffset:42) (offset:48)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isAbstract isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
mixins
E
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
''');
}
test_classAlias_base() async {
var library = await buildLibrary(r'''
base class C = Object with M;
mixin M {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isBase isMixinApplication class C (nameOffset:11) (firstTokenOffset:0) (offset:11)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:11)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
mixins
#F3 mixin M (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@mixin::M
classes
isBase isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: Object
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: dart:core::@class::Object::@constructor::new
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F3
superclassConstraints
Object
''');
}
test_classAlias_constructors_beforeOtherProperties() async {
// https://github.com/dart-lang/sdk/issues/57035
var library = await buildLibrary(r'''
abstract mixin class A {}
mixin M {}
class X = A with M;
''');
var X = library.getClass('X')!;
expect(X.constructors, hasLength(1));
}
test_classAlias_constructors_chain_backward() async {
var library = await buildLibrary(r'''
class A {
A.named();
}
class C = B with M;
class B = A with M;
mixin M {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
#F3 isMixinApplication class C (nameOffset:32) (firstTokenOffset:26) (offset:32)
element: <testLibrary>::@class::C
constructors
#F4 isOriginMixinApplication named (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
#F5 isMixinApplication class B (nameOffset:52) (firstTokenOffset:46) (offset:52)
element: <testLibrary>::@class::B
constructors
#F6 isOriginMixinApplication named (nameOffset:<null>) (firstTokenOffset:<null>) (offset:52)
element: <testLibrary>::@class::B::@constructor::named
typeName: B
mixins
#F7 mixin M (nameOffset:73) (firstTokenOffset:67) (offset:73)
element: <testLibrary>::@mixin::M
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F2
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F3
supertype: B
mixins
M
constructors
isOriginMixinApplication named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F4
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: named @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: named @0
element: <testLibrary>::@class::B::@constructor::named
staticType: null
element: <testLibrary>::@class::B::@constructor::named
superConstructor: <testLibrary>::@class::B::@constructor::named
isMixinApplication isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
mixins
M
constructors
isOriginMixinApplication named
reference: <testLibrary>::@class::B::@constructor::named
firstFragment: #F6
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: named @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: named @0
element: <testLibrary>::@class::A::@constructor::named
staticType: null
element: <testLibrary>::@class::A::@constructor::named
superConstructor: <testLibrary>::@class::A::@constructor::named
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F7
superclassConstraints
Object
''');
}
test_classAlias_constructors_chain_forward() async {
var library = await buildLibrary(r'''
class A {
A.named();
}
class B = A with M;
class C = B with M;
mixin M {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
#F3 isMixinApplication class B (nameOffset:32) (firstTokenOffset:26) (offset:32)
element: <testLibrary>::@class::B
constructors
#F4 isOriginMixinApplication named (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32)
element: <testLibrary>::@class::B::@constructor::named
typeName: B
#F5 isMixinApplication class C (nameOffset:52) (firstTokenOffset:46) (offset:52)
element: <testLibrary>::@class::C
constructors
#F6 isOriginMixinApplication named (nameOffset:<null>) (firstTokenOffset:<null>) (offset:52)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
mixins
#F7 mixin M (nameOffset:73) (firstTokenOffset:67) (offset:73)
element: <testLibrary>::@mixin::M
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F2
isMixinApplication isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
mixins
M
constructors
isOriginMixinApplication named
reference: <testLibrary>::@class::B::@constructor::named
firstFragment: #F4
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: named @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: named @0
element: <testLibrary>::@class::A::@constructor::named
staticType: null
element: <testLibrary>::@class::A::@constructor::named
superConstructor: <testLibrary>::@class::A::@constructor::named
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F5
supertype: B
mixins
M
constructors
isOriginMixinApplication named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F6
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: named @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: named @0
element: <testLibrary>::@class::B::@constructor::named
staticType: null
element: <testLibrary>::@class::B::@constructor::named
superConstructor: <testLibrary>::@class::B::@constructor::named
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F7
superclassConstraints
Object
''');
}
test_classAlias_constructors_default() async {
var library = await buildLibrary(r'''
class A {}
mixin class M {}
class X = A with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 isMixinClass class M (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::M
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@class::M::@constructor::new
typeName: M
#F5 isMixinApplication class X (nameOffset:36) (firstTokenOffset:30) (offset:36)
element: <testLibrary>::@class::X
constructors
#F6 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::X::@constructor::new
typeName: X
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isMixinClass isSimplyBounded class M
reference: <testLibrary>::@class::M
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M::@constructor::new
firstFragment: #F4
isMixinApplication isSimplyBounded class X
reference: <testLibrary>::@class::X
firstFragment: #F5
supertype: A
mixins
M
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::X::@constructor::new
firstFragment: #F6
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::A::@constructor::new
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_classAlias_constructors_dependencies() async {
var library = await buildLibrary(r'''
class A {
A(int i);
}
mixin class M1 {}
mixin class M2 {}
class C2 = C1 with M2;
class C1 = A with M1;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration i (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::i
#F4 isMixinClass class M1 (nameOffset:37) (firstTokenOffset:25) (offset:37)
element: <testLibrary>::@class::M1
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::M1::@constructor::new
typeName: M1
#F6 isMixinClass class M2 (nameOffset:56) (firstTokenOffset:44) (offset:56)
element: <testLibrary>::@class::M2
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:56)
element: <testLibrary>::@class::M2::@constructor::new
typeName: M2
#F8 isMixinApplication class C2 (nameOffset:69) (firstTokenOffset:63) (offset:69)
element: <testLibrary>::@class::C2
constructors
#F9 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:69)
element: <testLibrary>::@class::C2::@constructor::new
typeName: C2
formalParameters
#F10 requiredPositional isOriginMixinApplicationClassConstructor i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:69)
element: <testLibrary>::@class::C2::@constructor::new::@formalParameter::i
#F11 isMixinApplication class C1 (nameOffset:92) (firstTokenOffset:86) (offset:92)
element: <testLibrary>::@class::C1
constructors
#F12 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:92)
element: <testLibrary>::@class::C1::@constructor::new
typeName: C1
formalParameters
#F13 requiredPositional isOriginMixinApplicationClassConstructor i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:92)
element: <testLibrary>::@class::C1::@constructor::new::@formalParameter::i
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional i
firstFragment: #F3
type: int
isMixinClass isSimplyBounded class M1
reference: <testLibrary>::@class::M1
firstFragment: #F4
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M1::@constructor::new
firstFragment: #F5
isMixinClass isSimplyBounded class M2
reference: <testLibrary>::@class::M2
firstFragment: #F6
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M2::@constructor::new
firstFragment: #F7
isMixinApplication isSimplyBounded class C2
reference: <testLibrary>::@class::C2
firstFragment: #F8
supertype: C1
mixins
M2
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C2::@constructor::new
firstFragment: #F9
formalParameters
#E1 requiredPositional i
firstFragment: #F10
type: int
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: i @-1
element: <testLibrary>::@class::C2::@constructor::new::@formalParameter::i
staticType: int
rightParenthesis: ) @0
element: <testLibrary>::@class::C1::@constructor::new
superConstructor: <testLibrary>::@class::C1::@constructor::new
isMixinApplication isSimplyBounded class C1
reference: <testLibrary>::@class::C1
firstFragment: #F11
supertype: A
mixins
M1
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C1::@constructor::new
firstFragment: #F12
formalParameters
#E2 requiredPositional i
firstFragment: #F13
type: int
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: i @-1
element: <testLibrary>::@class::C1::@constructor::new::@formalParameter::i
staticType: int
rightParenthesis: ) @0
element: <testLibrary>::@class::A::@constructor::new
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_classAlias_constructors_optionalFormalParameters() async {
var library = await buildLibrary(r'''
class A {
A.c1(int a);
A.c2(int a, [int? b, int c = 0]);
A.c3(int a, {int? b, int c = 0});
}
mixin M {}
class C = A with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration c1 (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::c1
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:21) (firstTokenOffset:17) (offset:21)
element: <testLibrary>::@class::A::@constructor::c1::@formalParameter::a
#F4 isOriginDeclaration c2 (nameOffset:29) (firstTokenOffset:27) (offset:29)
element: <testLibrary>::@class::A::@constructor::c2
typeName: A
typeNameOffset: 27
periodOffset: 28
formalParameters
#F5 requiredPositional isOriginDeclaration a (nameOffset:36) (firstTokenOffset:32) (offset:36)
element: <testLibrary>::@class::A::@constructor::c2::@formalParameter::a
#F6 optionalPositional isOriginDeclaration b (nameOffset:45) (firstTokenOffset:40) (offset:45)
element: <testLibrary>::@class::A::@constructor::c2::@formalParameter::b
#F7 optionalPositional isOriginDeclaration c (nameOffset:52) (firstTokenOffset:48) (offset:52)
element: <testLibrary>::@class::A::@constructor::c2::@formalParameter::c
initializer: expression_0
IntegerLiteral
literal: 0 @56
staticType: int
#F8 isOriginDeclaration c3 (nameOffset:65) (firstTokenOffset:63) (offset:65)
element: <testLibrary>::@class::A::@constructor::c3
typeName: A
typeNameOffset: 63
periodOffset: 64
formalParameters
#F9 requiredPositional isOriginDeclaration a (nameOffset:72) (firstTokenOffset:68) (offset:72)
element: <testLibrary>::@class::A::@constructor::c3::@formalParameter::a
#F10 optionalNamed isOriginDeclaration b (nameOffset:81) (firstTokenOffset:76) (offset:81)
element: <testLibrary>::@class::A::@constructor::c3::@formalParameter::b
#F11 optionalNamed isOriginDeclaration c (nameOffset:88) (firstTokenOffset:84) (offset:88)
element: <testLibrary>::@class::A::@constructor::c3::@formalParameter::c
initializer: expression_1
IntegerLiteral
literal: 0 @92
staticType: int
#F12 isMixinApplication class C (nameOffset:118) (firstTokenOffset:112) (offset:118)
element: <testLibrary>::@class::C
constructors
#F13 isOriginMixinApplication c1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c1
typeName: C
formalParameters
#F14 requiredPositional isOriginMixinApplicationClassConstructor a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c1::@formalParameter::a
#F15 isOriginMixinApplication c2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c2
typeName: C
formalParameters
#F16 requiredPositional isOriginMixinApplicationClassConstructor a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::a
#F17 optionalPositional isOriginMixinApplicationClassConstructor b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::b
#F18 optionalPositional isOriginMixinApplicationClassConstructor c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::c
initializer: expression_0
#F19 isOriginMixinApplication c3 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c3
typeName: C
formalParameters
#F20 requiredPositional isOriginMixinApplicationClassConstructor a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::a
#F21 optionalNamed isOriginMixinApplicationClassConstructor b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::b
#F22 optionalNamed isOriginMixinApplicationClassConstructor c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:118)
element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::c
initializer: expression_1
mixins
#F23 mixin M (nameOffset:106) (firstTokenOffset:100) (offset:106)
element: <testLibrary>::@mixin::M
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration c1
reference: <testLibrary>::@class::A::@constructor::c1
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
isOriginDeclaration c2
reference: <testLibrary>::@class::A::@constructor::c2
firstFragment: #F4
formalParameters
#E1 requiredPositional a
firstFragment: #F5
type: int
#E2 optionalPositional b
firstFragment: #F6
type: int?
#E3 optionalPositional hasDefaultValue c
firstFragment: #F7
type: int
constantInitializer
fragment: #F7
expression: expression_0
isOriginDeclaration c3
reference: <testLibrary>::@class::A::@constructor::c3
firstFragment: #F8
formalParameters
#E4 requiredPositional a
firstFragment: #F9
type: int
#E5 optionalNamed b
firstFragment: #F10
type: int?
#E6 optionalNamed hasDefaultValue c
firstFragment: #F11
type: int
constantInitializer
fragment: #F11
expression: expression_1
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F12
supertype: A
mixins
M
constructors
isOriginMixinApplication c1
reference: <testLibrary>::@class::C::@constructor::c1
firstFragment: #F13
formalParameters
#E7 requiredPositional a
firstFragment: #F14
type: int
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: c1 @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: a @-1
element: <testLibrary>::@class::C::@constructor::c1::@formalParameter::a
staticType: int
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: c1 @0
element: <testLibrary>::@class::A::@constructor::c1
staticType: null
element: <testLibrary>::@class::A::@constructor::c1
superConstructor: <testLibrary>::@class::A::@constructor::c1
isOriginMixinApplication c2
reference: <testLibrary>::@class::C::@constructor::c2
firstFragment: #F15
formalParameters
#E8 requiredPositional a
firstFragment: #F16
type: int
#E9 optionalPositional b
firstFragment: #F17
type: int?
#E10 optionalPositional hasDefaultValue c
firstFragment: #F18
type: int
constantInitializer
fragment: #F18
expression: expression_0
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: c2 @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: a @-1
element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::a
staticType: int
SimpleIdentifier
token: b @-1
element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::b
staticType: int?
SimpleIdentifier
token: c @-1
element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::c
staticType: int
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: c2 @0
element: <testLibrary>::@class::A::@constructor::c2
staticType: null
element: <testLibrary>::@class::A::@constructor::c2
superConstructor: <testLibrary>::@class::A::@constructor::c2
isOriginMixinApplication c3
reference: <testLibrary>::@class::C::@constructor::c3
firstFragment: #F19
formalParameters
#E11 requiredPositional a
firstFragment: #F20
type: int
#E12 optionalNamed b
firstFragment: #F21
type: int?
#E13 optionalNamed hasDefaultValue c
firstFragment: #F22
type: int
constantInitializer
fragment: #F22
expression: expression_1
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: c3 @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: a @-1
element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::a
staticType: int
SimpleIdentifier
token: b @-1
element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::b
staticType: int?
SimpleIdentifier
token: c @-1
element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::c
staticType: int
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: c3 @0
element: <testLibrary>::@class::A::@constructor::c3
staticType: null
element: <testLibrary>::@class::A::@constructor::c3
superConstructor: <testLibrary>::@class::A::@constructor::c3
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F23
superclassConstraints
Object
''');
}
test_classAlias_constructors_reading() async {
newFile('$testPackageLibPath/a.dart', r'''
mixin M {}
class A {
const A.named();
}
class B = A with M;
''');
var library = await buildLibrary(r'''
import 'a.dart';
const x = B.named();
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/a.dart
topLevelVariables
#F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: <testLibrary>::@topLevelVariable::x
initializer: expression_0
InstanceCreationExpression
constructorName: ConstructorName
type: NamedType
name: B @28
element: package:test/a.dart::@class::B
type: B
period: . @29
name: SimpleIdentifier
token: named @30
element: package:test/a.dart::@class::B::@constructor::named
staticType: null
element: package:test/a.dart::@class::B::@constructor::named
argumentList: ArgumentList
leftParenthesis: ( @35
rightParenthesis: ) @36
staticType: B
inducedGetter: #F2
getters
#F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@getter::x
inducingVariable: #F1
topLevelVariables
hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer x
reference: <testLibrary>::@topLevelVariable::x
firstFragment: #F1
type: B
constantInitializer
fragment: #F1
expression: expression_0
getter: <testLibrary>::@getter::x
getters
isOriginVariable isStatic x
reference: <testLibrary>::@getter::x
firstFragment: #F2
returnType: B
variable: <testLibrary>::@topLevelVariable::x
''');
}
test_classAlias_constructors_requiredFormalParameters() async {
var library = await buildLibrary(r'''
class A<T extends num> {
A(T x, T y);
}
mixin M {}
class B<E extends num> = A<E> with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:27) (offset:27)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 27
formalParameters
#F4 requiredPositional isOriginDeclaration x (nameOffset:31) (firstTokenOffset:29) (offset:31)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
#F5 requiredPositional isOriginDeclaration y (nameOffset:36) (firstTokenOffset:34) (offset:36)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::y
#F6 isMixinApplication class B (nameOffset:61) (firstTokenOffset:55) (offset:61)
element: <testLibrary>::@class::B
typeParameters
#F7 E (nameOffset:63) (firstTokenOffset:63) (offset:63)
element: #E1 E
constructors
#F8 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
formalParameters
#F9 requiredPositional isOriginMixinApplicationClassConstructor x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::x
#F10 requiredPositional isOriginMixinApplicationClassConstructor y (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::y
mixins
#F11 mixin M (nameOffset:49) (firstTokenOffset:43) (offset:49)
element: <testLibrary>::@mixin::M
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: num
constructors
hasEnclosingTypeParameterReference isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
formalParameters
#E2 requiredPositional x
firstFragment: #F4
type: T
#E3 requiredPositional y
firstFragment: #F5
type: T
isMixinApplication isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F6
typeParameters
#E1 E
firstFragment: #F7
bound: num
supertype: A<E>
mixins
M
constructors
hasEnclosingTypeParameterReference isOriginMixinApplication new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E4 requiredPositional x
firstFragment: #F9
type: E
#E5 requiredPositional y
firstFragment: #F10
type: E
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: x @-1
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::x
staticType: E
SimpleIdentifier
token: y @-1
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::y
staticType: E
rightParenthesis: ) @0
element: <testLibrary>::@class::A::@constructor::new
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: E}
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F11
superclassConstraints
Object
''');
}
test_classAlias_documented() async {
var library = await buildLibrary(r'''
/**
* Docs
*/
class C = D with E;
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:22) (firstTokenOffset:0) (offset:22)
element: <testLibrary>::@class::C
constructors
#F2 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:43) (firstTokenOffset:37) (offset:43)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:43)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:55) (firstTokenOffset:49) (offset:55)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:55)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
documentationComment: /**\n * Docs\n */
supertype: D
mixins
E
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
''');
}
test_classAlias_documented_tripleSlash() async {
var library = await buildLibrary(r'''
/// aaa
/// b
/// cc
class C = D with E;
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:27) (firstTokenOffset:0) (offset:27)
element: <testLibrary>::@class::C
constructors
#F2 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:48) (firstTokenOffset:42) (offset:48)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:60) (firstTokenOffset:54) (offset:60)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
documentationComment: /// aaa\n/// b\n/// cc
supertype: D
mixins
E
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
''');
}
test_classAlias_documented_withLeadingNonDocumentation() async {
var library = await buildLibrary(r'''
// Extra comment so doc comment offset != 0
/**
* Docs
*/
class C = D with E;
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:66) (firstTokenOffset:44) (offset:66)
element: <testLibrary>::@class::C
constructors
#F2 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:87) (firstTokenOffset:81) (offset:87)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:87)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:99) (firstTokenOffset:93) (offset:99)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:99)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
documentationComment: /**\n * Docs\n */
supertype: D
mixins
E
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
''');
}
test_classAlias_final() async {
var library = await buildLibrary(r'''
final class C = Object with M;
mixin M {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isFinal isMixinApplication class C (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
mixins
#F3 mixin M (nameOffset:38) (firstTokenOffset:32) (offset:38)
element: <testLibrary>::@mixin::M
classes
isFinal isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: Object
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: dart:core::@class::Object::@constructor::new
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F3
superclassConstraints
Object
''');
}
test_classAlias_generic() async {
var library = await buildLibrary(r'''
class Z = A with B<int>, C<double>;
class A {}
class B<B1> {}
class C<C1> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class Z (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::Z
constructors
#F2 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::Z::@constructor::new
typeName: Z
#F3 class A (nameOffset:43) (firstTokenOffset:37) (offset:43)
element: <testLibrary>::@class::A
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:43)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F5 class B (nameOffset:55) (firstTokenOffset:49) (offset:55)
element: <testLibrary>::@class::B
typeParameters
#F6 B1 (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: #E0 B1
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:55)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F8 class C (nameOffset:71) (firstTokenOffset:65) (offset:71)
element: <testLibrary>::@class::C
typeParameters
#F9 C1 (nameOffset:73) (firstTokenOffset:73) (offset:73)
element: #E1 C1
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isMixinApplication isSimplyBounded class Z
reference: <testLibrary>::@class::Z
firstFragment: #F1
supertype: A
mixins
B<int>
C<double>
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::Z::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::A::@constructor::new
superConstructor: <testLibrary>::@class::A::@constructor::new
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
typeParameters
#E0 B1
firstFragment: #F6
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F7
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F8
typeParameters
#E1 C1
firstFragment: #F9
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F10
''');
}
test_classAlias_interface() async {
var library = await buildLibrary(r'''
interface class C = Object with M;
mixin M {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isInterface isMixinApplication class C (nameOffset:16) (firstTokenOffset:0) (offset:16)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
mixins
#F3 mixin M (nameOffset:42) (firstTokenOffset:36) (offset:42)
element: <testLibrary>::@mixin::M
classes
isInterface isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: Object
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: dart:core::@class::Object::@constructor::new
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F3
superclassConstraints
Object
''');
}
test_classAlias_invalid_extendsEnum() async {
newFile('$testPackageLibPath/a.dart', r'''
enum E { v }
mixin M {}
''');
var library = await buildLibrary(r'''
import 'a.dart';
class A = E with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/a.dart
classes
#F1 isMixinApplication class A (nameOffset:24) (firstTokenOffset:18) (offset:24)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
isMixinApplication isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
supertype: Object
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: dart:core::@class::Object::@constructor::new
''');
}
test_classAlias_invalid_extendsMixin() async {
var library = await buildLibrary(r'''
mixin M1 {}
mixin M2 {}
class A = M1 with M2;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class A (nameOffset:32) (firstTokenOffset:26) (offset:32)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
mixins
#F3 mixin M1 (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@mixin::M1
#F4 mixin M2 (nameOffset:19) (firstTokenOffset:13) (offset:19)
element: <testLibrary>::@mixin::M2
classes
isMixinApplication isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
supertype: Object
mixins
M2
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: dart:core::@class::Object::@constructor::new
mixins
isSimplyBounded mixin M1
reference: <testLibrary>::@mixin::M1
firstFragment: #F3
superclassConstraints
Object
isSimplyBounded mixin M2
reference: <testLibrary>::@mixin::M2
firstFragment: #F4
superclassConstraints
Object
''');
}
test_classAlias_mixin_class() async {
var library = await buildLibrary(r'''
mixin class C = Object with M;
mixin M {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication isMixinClass class C (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
mixins
#F3 mixin M (nameOffset:38) (firstTokenOffset:32) (offset:38)
element: <testLibrary>::@mixin::M
classes
isMixinApplication isMixinClass isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: Object
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: dart:core::@class::Object::@constructor::new
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F3
superclassConstraints
Object
''');
}
test_classAlias_notSimplyBounded_self() async {
var library = await buildLibrary(r'''
class C<T extends C> = D with E;
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F4 class D (nameOffset:40) (firstTokenOffset:34) (offset:40)
element: <testLibrary>::@class::D
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:40)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F6 class E (nameOffset:52) (firstTokenOffset:46) (offset:52)
element: <testLibrary>::@class::E
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:52)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isMixinApplication class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: C<dynamic>
supertype: D
mixins
E
constructors
hasEnclosingTypeParameterReference isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F4
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F5
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F6
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F7
''');
}
test_classAlias_notSimplyBounded_simple_no_typeParameter_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 buildLibrary(r'''
class C<T> = D with E;
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F4 class D (nameOffset:30) (firstTokenOffset:24) (offset:30)
element: <testLibrary>::@class::D
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F6 class E (nameOffset:42) (firstTokenOffset:36) (offset:42)
element: <testLibrary>::@class::E
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:42)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
supertype: D
mixins
E
constructors
hasEnclosingTypeParameterReference isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F4
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F5
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F6
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F7
''');
}
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 buildLibrary(r'''
class C = D with E;
class D {}
class E {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:27) (firstTokenOffset:21) (offset:27)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::E
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
classes
isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
mixins
E
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F6
''');
}
test_classAlias_sealed() async {
var library = await buildLibrary(r'''
sealed class C = Object with M;
mixin M {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication isSealed class C (nameOffset:13) (firstTokenOffset:0) (offset:13)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
mixins
#F3 mixin M (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@mixin::M
classes
isAbstract isMixinApplication isSealed isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: Object
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: dart:core::@class::Object::@constructor::new
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F3
superclassConstraints
Object
''');
}
test_classAlias_with_const_constructors() async {
newFile('$testPackageLibPath/a.dart', r'''
class Base {
const Base._priv();
const Base();
const Base.named();
}
''');
var library = await buildLibrary(r'''
import "a.dart";
class M {}
class MixinApp = Base with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/a.dart
classes
#F1 class M (nameOffset:24) (firstTokenOffset:18) (offset:24)
element: <testLibrary>::@class::M
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@class::M::@constructor::new
typeName: M
#F3 isMixinApplication class MixinApp (nameOffset:36) (firstTokenOffset:30) (offset:36)
element: <testLibrary>::@class::MixinApp
constructors
#F4 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::new
typeName: MixinApp
#F5 isConst isOriginMixinApplication named (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::named
typeName: MixinApp
classes
isSimplyBounded class M
reference: <testLibrary>::@class::M
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M::@constructor::new
firstFragment: #F2
isMixinApplication isSimplyBounded class MixinApp
reference: <testLibrary>::@class::MixinApp
firstFragment: #F3
supertype: Base
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::MixinApp::@constructor::new
firstFragment: #F4
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: package:test/a.dart::@class::Base::@constructor::new
superConstructor: package:test/a.dart::@class::Base::@constructor::new
isConst isOriginMixinApplication named
reference: <testLibrary>::@class::MixinApp::@constructor::named
firstFragment: #F5
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: named @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: named @0
element: package:test/a.dart::@class::Base::@constructor::named
staticType: null
element: package:test/a.dart::@class::Base::@constructor::named
superConstructor: package:test/a.dart::@class::Base::@constructor::named
''');
}
test_classAlias_with_const_constructors_mixinInstanceField() async {
newFile('$testPackageLibPath/a.dart', r'''
class Base {
const Base();
const Base.named();
}
''');
var library = await buildLibrary(r'''
import "a.dart";
mixin class M {
int x = 0;
}
class MixinApp = Base with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/a.dart
classes
#F1 isMixinClass class M (nameOffset:30) (firstTokenOffset:18) (offset:30)
element: <testLibrary>::@class::M
fields
#F2 hasInitializer isOriginDeclaration x (nameOffset:40) (firstTokenOffset:40) (offset:40)
element: <testLibrary>::@class::M::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::M::@constructor::new
typeName: M
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:40)
element: <testLibrary>::@class::M::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:40)
element: <testLibrary>::@class::M::@setter::x
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:40)
element: <testLibrary>::@class::M::@setter::x::@formalParameter::value
#F7 isMixinApplication class MixinApp (nameOffset:56) (firstTokenOffset:50) (offset:56)
element: <testLibrary>::@class::MixinApp
constructors
#F8 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:56)
element: <testLibrary>::@class::MixinApp::@constructor::new
typeName: MixinApp
#F9 isOriginMixinApplication named (nameOffset:<null>) (firstTokenOffset:<null>) (offset:56)
element: <testLibrary>::@class::MixinApp::@constructor::named
typeName: MixinApp
classes
hasNonFinalField isMixinClass isSimplyBounded class M
reference: <testLibrary>::@class::M
firstFragment: #F1
fields
hasInitializer isOriginDeclaration x
reference: <testLibrary>::@class::M::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::M::@getter::x
setter: <testLibrary>::@class::M::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M::@constructor::new
firstFragment: #F5
getters
isOriginVariable x
reference: <testLibrary>::@class::M::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::M::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::M::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::M::@field::x
hasNonFinalField isMixinApplication isSimplyBounded class MixinApp
reference: <testLibrary>::@class::MixinApp
firstFragment: #F7
supertype: Base
mixins
M
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::MixinApp::@constructor::new
firstFragment: #F8
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: package:test/a.dart::@class::Base::@constructor::new
superConstructor: package:test/a.dart::@class::Base::@constructor::new
isOriginMixinApplication named
reference: <testLibrary>::@class::MixinApp::@constructor::named
firstFragment: #F9
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: named @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: named @0
element: package:test/a.dart::@class::Base::@constructor::named
staticType: null
element: package:test/a.dart::@class::Base::@constructor::named
superConstructor: package:test/a.dart::@class::Base::@constructor::named
''');
}
test_classAlias_with_const_constructors_mixinStaticField() async {
newFile('$testPackageLibPath/a.dart', r'''
class Base {
const Base();
const Base.named();
}
''');
var library = await buildLibrary(r'''
import "a.dart";
mixin class M {
static int x = 0;
}
class MixinApp = Base with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/a.dart
classes
#F1 isMixinClass class M (nameOffset:30) (firstTokenOffset:18) (offset:30)
element: <testLibrary>::@class::M
fields
#F2 hasInitializer isOriginDeclaration isStatic x (nameOffset:47) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::M::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::M::@constructor::new
typeName: M
getters
#F3 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47)
element: <testLibrary>::@class::M::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47)
element: <testLibrary>::@class::M::@setter::x
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47)
element: <testLibrary>::@class::M::@setter::x::@formalParameter::value
#F7 isMixinApplication class MixinApp (nameOffset:63) (firstTokenOffset:57) (offset:63)
element: <testLibrary>::@class::MixinApp
constructors
#F8 isConst isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::MixinApp::@constructor::new
typeName: MixinApp
#F9 isConst isOriginMixinApplication named (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::MixinApp::@constructor::named
typeName: MixinApp
classes
isMixinClass isSimplyBounded class M
reference: <testLibrary>::@class::M
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic x
reference: <testLibrary>::@class::M::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::M::@getter::x
setter: <testLibrary>::@class::M::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M::@constructor::new
firstFragment: #F5
getters
isOriginVariable isStatic x
reference: <testLibrary>::@class::M::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::M::@field::x
setters
isOriginVariable isStatic x
reference: <testLibrary>::@class::M::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::M::@field::x
isMixinApplication isSimplyBounded class MixinApp
reference: <testLibrary>::@class::MixinApp
firstFragment: #F7
supertype: Base
mixins
M
constructors
isConst isOriginMixinApplication new
reference: <testLibrary>::@class::MixinApp::@constructor::new
firstFragment: #F8
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: package:test/a.dart::@class::Base::@constructor::new
superConstructor: package:test/a.dart::@class::Base::@constructor::new
isConst isOriginMixinApplication named
reference: <testLibrary>::@class::MixinApp::@constructor::named
firstFragment: #F9
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: named @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: named @0
element: package:test/a.dart::@class::Base::@constructor::named
staticType: null
element: package:test/a.dart::@class::Base::@constructor::named
superConstructor: package:test/a.dart::@class::Base::@constructor::named
''');
}
test_classAlias_with_forwarding_constructors() async {
newFile('$testPackageLibPath/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 buildLibrary(r'''
import "a.dart";
class M {}
class MixinApp = Base with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/a.dart
classes
#F1 class M (nameOffset:24) (firstTokenOffset:18) (offset:24)
element: <testLibrary>::@class::M
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@class::M::@constructor::new
typeName: M
#F3 isMixinApplication class MixinApp (nameOffset:36) (firstTokenOffset:30) (offset:36)
element: <testLibrary>::@class::MixinApp
constructors
#F4 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::new
typeName: MixinApp
#F5 isOriginMixinApplication noArgs (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::noArgs
typeName: MixinApp
#F6 isOriginMixinApplication requiredArg (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::requiredArg
typeName: MixinApp
formalParameters
#F7 requiredPositional isOriginMixinApplicationClassConstructor x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::requiredArg::@formalParameter::x
#F8 isOriginMixinApplication positionalArg (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::positionalArg
typeName: MixinApp
formalParameters
#F9 optionalPositional isOriginMixinApplicationClassConstructor x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::positionalArg::@formalParameter::x
initializer: expression_0
BooleanLiteral
literal: true @127
staticType: bool
#F10 isOriginMixinApplication positionalArg2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::positionalArg2
typeName: MixinApp
formalParameters
#F11 optionalPositional isFinal isOriginMixinApplicationClassConstructor x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::positionalArg2::@formalParameter::x
initializer: expression_1
BooleanLiteral
literal: true @167
staticType: bool
#F12 isOriginMixinApplication namedArg (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::namedArg
typeName: MixinApp
formalParameters
#F13 optionalNamed isOriginMixinApplicationClassConstructor x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::namedArg::@formalParameter::x
initializer: expression_2
IntegerLiteral
literal: 42 @200
staticType: int
#F14 isOriginMixinApplication namedArg2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::namedArg2
typeName: MixinApp
formalParameters
#F15 optionalNamed isFinal isOriginMixinApplicationClassConstructor x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::MixinApp::@constructor::namedArg2::@formalParameter::x
initializer: expression_3
BooleanLiteral
literal: true @233
staticType: bool
classes
isSimplyBounded class M
reference: <testLibrary>::@class::M
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M::@constructor::new
firstFragment: #F2
hasNonFinalField isMixinApplication isSimplyBounded class MixinApp
reference: <testLibrary>::@class::MixinApp
firstFragment: #F3
supertype: Base
mixins
M
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::MixinApp::@constructor::new
firstFragment: #F4
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: package:test/a.dart::@class::Base::@constructor::new
superConstructor: package:test/a.dart::@class::Base::@constructor::new
isOriginMixinApplication noArgs
reference: <testLibrary>::@class::MixinApp::@constructor::noArgs
firstFragment: #F5
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: noArgs @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: noArgs @0
element: package:test/a.dart::@class::Base::@constructor::noArgs
staticType: null
element: package:test/a.dart::@class::Base::@constructor::noArgs
superConstructor: package:test/a.dart::@class::Base::@constructor::noArgs
isOriginMixinApplication requiredArg
reference: <testLibrary>::@class::MixinApp::@constructor::requiredArg
firstFragment: #F6
formalParameters
#E0 requiredPositional x
firstFragment: #F7
type: dynamic
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: requiredArg @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: x @-1
element: <testLibrary>::@class::MixinApp::@constructor::requiredArg::@formalParameter::x
staticType: dynamic
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: requiredArg @0
element: package:test/a.dart::@class::Base::@constructor::requiredArg
staticType: null
element: package:test/a.dart::@class::Base::@constructor::requiredArg
superConstructor: package:test/a.dart::@class::Base::@constructor::requiredArg
isOriginMixinApplication positionalArg
reference: <testLibrary>::@class::MixinApp::@constructor::positionalArg
firstFragment: #F8
formalParameters
#E1 optionalPositional hasDefaultValue x
firstFragment: #F9
type: bool
constantInitializer
fragment: #F9
expression: expression_0
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: positionalArg @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: x @-1
element: <testLibrary>::@class::MixinApp::@constructor::positionalArg::@formalParameter::x
staticType: bool
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: positionalArg @0
element: package:test/a.dart::@class::Base::@constructor::positionalArg
staticType: null
element: package:test/a.dart::@class::Base::@constructor::positionalArg
superConstructor: package:test/a.dart::@class::Base::@constructor::positionalArg
isOriginMixinApplication positionalArg2
reference: <testLibrary>::@class::MixinApp::@constructor::positionalArg2
firstFragment: #F10
formalParameters
#E2 optionalPositional hasDefaultValue isFinal x
firstFragment: #F11
type: bool
constantInitializer
fragment: #F11
expression: expression_1
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: positionalArg2 @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: x @-1
element: <testLibrary>::@class::MixinApp::@constructor::positionalArg2::@formalParameter::x
staticType: bool
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: positionalArg2 @0
element: package:test/a.dart::@class::Base::@constructor::positionalArg2
staticType: null
element: package:test/a.dart::@class::Base::@constructor::positionalArg2
superConstructor: package:test/a.dart::@class::Base::@constructor::positionalArg2
isOriginMixinApplication namedArg
reference: <testLibrary>::@class::MixinApp::@constructor::namedArg
firstFragment: #F12
formalParameters
#E3 optionalNamed hasDefaultValue x
firstFragment: #F13
type: int
constantInitializer
fragment: #F13
expression: expression_2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: namedArg @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: x @-1
element: <testLibrary>::@class::MixinApp::@constructor::namedArg::@formalParameter::x
staticType: int
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: namedArg @0
element: package:test/a.dart::@class::Base::@constructor::namedArg
staticType: null
element: package:test/a.dart::@class::Base::@constructor::namedArg
superConstructor: package:test/a.dart::@class::Base::@constructor::namedArg
isOriginMixinApplication namedArg2
reference: <testLibrary>::@class::MixinApp::@constructor::namedArg2
firstFragment: #F14
formalParameters
#E4 optionalNamed hasDefaultValue isFinal x
firstFragment: #F15
type: bool
constantInitializer
fragment: #F15
expression: expression_3
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: namedArg2 @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: x @-1
element: <testLibrary>::@class::MixinApp::@constructor::namedArg2::@formalParameter::x
staticType: bool
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: namedArg2 @0
element: package:test/a.dart::@class::Base::@constructor::namedArg2
staticType: null
element: package:test/a.dart::@class::Base::@constructor::namedArg2
superConstructor: package:test/a.dart::@class::Base::@constructor::namedArg2
''');
}
test_classAlias_with_forwarding_constructors_type_substitution() async {
var library = await buildLibrary(r'''
class Base<T> {
Base.ctor(T t, List<T> l);
}
class M {}
class MixinApp = Base with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class Base (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::Base
typeParameters
#F2 T (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E0 T
constructors
#F3 isOriginDeclaration ctor (nameOffset:23) (firstTokenOffset:18) (offset:23)
element: <testLibrary>::@class::Base::@constructor::ctor
typeName: Base
typeNameOffset: 18
periodOffset: 22
formalParameters
#F4 requiredPositional isOriginDeclaration t (nameOffset:30) (firstTokenOffset:28) (offset:30)
element: <testLibrary>::@class::Base::@constructor::ctor::@formalParameter::t
#F5 requiredPositional isOriginDeclaration l (nameOffset:41) (firstTokenOffset:33) (offset:41)
element: <testLibrary>::@class::Base::@constructor::ctor::@formalParameter::l
#F6 class M (nameOffset:54) (firstTokenOffset:48) (offset:54)
element: <testLibrary>::@class::M
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:54)
element: <testLibrary>::@class::M::@constructor::new
typeName: M
#F8 isMixinApplication class MixinApp (nameOffset:66) (firstTokenOffset:60) (offset:66)
element: <testLibrary>::@class::MixinApp
constructors
#F9 isOriginMixinApplication ctor (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::MixinApp::@constructor::ctor
typeName: MixinApp
formalParameters
#F10 requiredPositional isOriginMixinApplicationClassConstructor t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::t
#F11 requiredPositional isOriginMixinApplicationClassConstructor l (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::l
classes
isSimplyBounded class Base
reference: <testLibrary>::@class::Base
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginDeclaration ctor
reference: <testLibrary>::@class::Base::@constructor::ctor
firstFragment: #F3
formalParameters
#E1 requiredPositional t
firstFragment: #F4
type: T
#E2 requiredPositional l
firstFragment: #F5
type: List<T>
isSimplyBounded class M
reference: <testLibrary>::@class::M
firstFragment: #F6
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M::@constructor::new
firstFragment: #F7
isMixinApplication isSimplyBounded class MixinApp
reference: <testLibrary>::@class::MixinApp
firstFragment: #F8
supertype: Base<dynamic>
mixins
M
constructors
isOriginMixinApplication ctor
reference: <testLibrary>::@class::MixinApp::@constructor::ctor
firstFragment: #F9
formalParameters
#E3 requiredPositional t
firstFragment: #F10
type: dynamic
#E4 requiredPositional l
firstFragment: #F11
type: List<dynamic>
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: ctor @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: t @-1
element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::t
staticType: dynamic
SimpleIdentifier
token: l @-1
element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::l
staticType: List<dynamic>
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: ctor @0
element: <testLibrary>::@class::Base::@constructor::ctor
staticType: null
element: <testLibrary>::@class::Base::@constructor::ctor
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::Base::@constructor::ctor
substitution: {T: dynamic}
''');
}
test_classAlias_with_forwarding_constructors_type_substitution_complex() async {
var library = await buildLibrary(r'''
class Base<T> {
Base.ctor(T t, List<T> l);
}
class M {}
class MixinApp<U> = Base<List<U>> with M;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class Base (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::Base
typeParameters
#F2 T (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E0 T
constructors
#F3 isOriginDeclaration ctor (nameOffset:23) (firstTokenOffset:18) (offset:23)
element: <testLibrary>::@class::Base::@constructor::ctor
typeName: Base
typeNameOffset: 18
periodOffset: 22
formalParameters
#F4 requiredPositional isOriginDeclaration t (nameOffset:30) (firstTokenOffset:28) (offset:30)
element: <testLibrary>::@class::Base::@constructor::ctor::@formalParameter::t
#F5 requiredPositional isOriginDeclaration l (nameOffset:41) (firstTokenOffset:33) (offset:41)
element: <testLibrary>::@class::Base::@constructor::ctor::@formalParameter::l
#F6 class M (nameOffset:54) (firstTokenOffset:48) (offset:54)
element: <testLibrary>::@class::M
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:54)
element: <testLibrary>::@class::M::@constructor::new
typeName: M
#F8 isMixinApplication class MixinApp (nameOffset:66) (firstTokenOffset:60) (offset:66)
element: <testLibrary>::@class::MixinApp
typeParameters
#F9 U (nameOffset:75) (firstTokenOffset:75) (offset:75)
element: #E1 U
constructors
#F10 isOriginMixinApplication ctor (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::MixinApp::@constructor::ctor
typeName: MixinApp
formalParameters
#F11 requiredPositional isOriginMixinApplicationClassConstructor t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::t
#F12 requiredPositional isOriginMixinApplicationClassConstructor l (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::l
classes
isSimplyBounded class Base
reference: <testLibrary>::@class::Base
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginDeclaration ctor
reference: <testLibrary>::@class::Base::@constructor::ctor
firstFragment: #F3
formalParameters
#E2 requiredPositional t
firstFragment: #F4
type: T
#E3 requiredPositional l
firstFragment: #F5
type: List<T>
isSimplyBounded class M
reference: <testLibrary>::@class::M
firstFragment: #F6
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::M::@constructor::new
firstFragment: #F7
isMixinApplication isSimplyBounded class MixinApp
reference: <testLibrary>::@class::MixinApp
firstFragment: #F8
typeParameters
#E1 U
firstFragment: #F9
supertype: Base<List<U>>
mixins
M
constructors
hasEnclosingTypeParameterReference isOriginMixinApplication ctor
reference: <testLibrary>::@class::MixinApp::@constructor::ctor
firstFragment: #F10
formalParameters
#E4 requiredPositional t
firstFragment: #F11
type: List<U>
#E5 requiredPositional l
firstFragment: #F12
type: List<List<U>>
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
constructorSelector: ConstructorSelector
period: . @0
name2: ctor @0
argumentList: ArgumentList
leftParenthesis: ( @0
arguments2
SimpleIdentifier
token: t @-1
element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::t
staticType: List<U>
SimpleIdentifier
token: l @-1
element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::l
staticType: List<List<U>>
rightParenthesis: ) @0
period: . @0
constructorName: SimpleIdentifier
token: ctor @0
element: <testLibrary>::@class::Base::@constructor::ctor
staticType: null
element: <testLibrary>::@class::Base::@constructor::ctor
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::Base::@constructor::ctor
substitution: {T: List<U>}
''');
}
test_classAlias_with_mixin_members() async {
var library = await buildLibrary(r'''
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
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isMixinApplication class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginMixinApplication new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:27) (firstTokenOffset:21) (offset:27)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F5 class E (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::E
fields
#F6 isOriginGetterSetter a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::E::@field::a
#F7 isOriginGetterSetter b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::E::@field::b
#F8 isOriginDeclaration x (nameOffset:107) (firstTokenOffset:107) (offset:107)
element: <testLibrary>::@class::E::@field::x
inducedGetter: #F9
inducedSetter: #F10
constructors
#F11 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::E::@constructor::new
typeName: E
getters
#F12 isComplete isOriginDeclaration a (nameOffset:53) (firstTokenOffset:45) (offset:53)
element: <testLibrary>::@class::E::@getter::a
#F9 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:107)
element: <testLibrary>::@class::E::@getter::x
inducingVariable: #F8
setters
#F13 isComplete isOriginDeclaration b (nameOffset:75) (firstTokenOffset:66) (offset:75)
element: <testLibrary>::@class::E::@setter::b
formalParameters
#F14 requiredPositional isOriginDeclaration i (nameOffset:81) (firstTokenOffset:77) (offset:81)
element: <testLibrary>::@class::E::@setter::b::@formalParameter::i
#F10 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:107)
element: <testLibrary>::@class::E::@setter::x
inducingVariable: #F8
formalParameters
#F15 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:107)
element: <testLibrary>::@class::E::@setter::x::@formalParameter::value
methods
#F16 isComplete isOriginDeclaration f (nameOffset:94) (firstTokenOffset:89) (offset:94)
element: <testLibrary>::@class::E::@method::f
classes
hasNonFinalField isMixinApplication isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
mixins
E
constructors
isOriginMixinApplication new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
SuperConstructorInvocation
superKeyword: super @0
argumentList: ArgumentList
leftParenthesis: ( @0
rightParenthesis: ) @0
element: <testLibrary>::@class::D::@constructor::new
superConstructor: <testLibrary>::@class::D::@constructor::new
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
hasNonFinalField isSimplyBounded class E
reference: <testLibrary>::@class::E
firstFragment: #F5
fields
isOriginGetterSetter a
reference: <testLibrary>::@class::E::@field::a
firstFragment: #F6
type: int
getter: <testLibrary>::@class::E::@getter::a
isOriginGetterSetter b
reference: <testLibrary>::@class::E::@field::b
firstFragment: #F7
type: int
setter: <testLibrary>::@class::E::@setter::b
isOriginDeclaration x
reference: <testLibrary>::@class::E::@field::x
firstFragment: #F8
type: int
getter: <testLibrary>::@class::E::@getter::x
setter: <testLibrary>::@class::E::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::E::@constructor::new
firstFragment: #F11
getters
isOriginDeclaration a
reference: <testLibrary>::@class::E::@getter::a
firstFragment: #F12
returnType: int
variable: <testLibrary>::@class::E::@field::a
isOriginVariable x
reference: <testLibrary>::@class::E::@getter::x
firstFragment: #F9
returnType: int
variable: <testLibrary>::@class::E::@field::x
setters
isOriginDeclaration b
reference: <testLibrary>::@class::E::@setter::b
firstFragment: #F13
formalParameters
#E0 requiredPositional i
firstFragment: #F14
type: int
returnType: void
variable: <testLibrary>::@class::E::@field::b
isOriginVariable x
reference: <testLibrary>::@class::E::@setter::x
firstFragment: #F10
formalParameters
#E1 requiredPositional value
firstFragment: #F15
type: int
returnType: void
variable: <testLibrary>::@class::E::@field::x
methods
isOriginDeclaration f
reference: <testLibrary>::@class::E::@method::f
firstFragment: #F16
returnType: void
''');
}
test_classes() async {
var library = await buildLibrary(r'''
class C {}
class D {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F3 class D (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::D
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F3
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F4
''');
}
test_constructor_primary_augmentation_chain() async {
var library = await buildLibrary(r'''
class A(int x);
augment class A {
augment A(int x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F4 requiredPositional isOriginDeclaration x (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:31) (firstTokenOffset:17) (offset:31)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:37) (offset:45)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 45
formalParameters
#F5 requiredPositional isOriginDeclaration x (nameOffset:51) (firstTokenOffset:47) (offset:51)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
formalParameters
#E0 requiredPositional x
firstFragment: #F4
type: int
''');
}
test_constructor_primary_augmentation_chain_completedByAugmentation() async {
var library = await buildLibrary(r'''
class A() {}
augment class A {
augment A() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:28) (firstTokenOffset:14) (offset:28)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:34) (offset:42)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 42
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_constructor_primary_body_constantInitializers_assertInitializer() async {
var library = await buildLibrary(r'''
class const A() {
this : assert(true);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
constructors
#F2 isComplete isConst isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
thisKeywordOffset: 20
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isConst isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
constantInitializers
AssertInitializer
assertKeyword: assert @27
leftParenthesis: ( @33
condition2: BooleanLiteral
literal: true @34
staticType: bool
rightParenthesis: ) @38
''');
}
test_constructor_primary_body_constantInitializers_fieldInitializer() async {
var library = await buildLibrary(r'''
class const A() {
final int x;
this : x = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration x (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: <testLibrary>::@class::A::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
thisKeywordOffset: 35
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::A::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration x
reference: <testLibrary>::@class::A::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::x
constructors
isConst isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: x @42
element: <testLibrary>::@class::A::@field::x
staticType: null
equals: = @44
expression2: IntegerLiteral
literal: 0 @46
staticType: int
getters
isOriginVariable x
reference: <testLibrary>::@class::A::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::x
''');
}
test_constructor_primary_body_constantInitializers_superConstructorInvocation() async {
var library = await buildLibrary(r'''
class A(int x);
class const B() extends A {
this : super(0);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F3 requiredPositional isOriginDeclaration x (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
#F4 hasExtendsClause class B (nameOffset:29) (firstTokenOffset:17) (offset:29)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isConst isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:23) (offset:29)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 29
thisKeywordOffset: 47
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional x
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isConst isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
constantInitializers
SuperConstructorInvocation
superKeyword: super @54
argumentList: ArgumentList
leftParenthesis: ( @59
arguments2
IntegerLiteral
literal: 0 @60
staticType: int
rightParenthesis: ) @61
element: <testLibrary>::@class::A::@constructor::new
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_primary_body_documented() async {
var library = await buildLibrary(r'''
/// Class docs
class const A() {
/// first
/// second
/// third
this;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:27) (firstTokenOffset:0) (offset:27)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:21) (offset:27)
element: <testLibrary>::@class::A::@constructor::new
documentationComment: /// first\n/// second\n/// third
typeName: A
typeNameOffset: 27
thisKeywordOffset: 72
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
documentationComment: /// Class docs
constructors
isConst isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
documentationComment: /// first\n/// second\n/// third
''');
}
test_constructor_primary_body_duplicate() async {
var library = await buildLibrary(r'''
class const A() {
final int x;
@Deprecated('0')
this : x = 0;
@Deprecated('1')
this : x = 1;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration x (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: <testLibrary>::@class::A::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
metadata
Annotation
atSign: @ @35
name: SimpleIdentifier
token: Deprecated @36
element: dart:core::@class::Deprecated
staticType: null
arguments: ArgumentList
leftParenthesis: ( @46
arguments2
SimpleStringLiteral
literal: '0' @47
rightParenthesis: ) @50
element: dart:core::@class::Deprecated::@constructor::new
typeName: A
typeNameOffset: 12
thisKeywordOffset: 54
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::A::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration x
reference: <testLibrary>::@class::A::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::x
constructors
isConst isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
metadata
Annotation
atSign: @ @35
name: SimpleIdentifier
token: Deprecated @36
element: dart:core::@class::Deprecated
staticType: null
arguments: ArgumentList
leftParenthesis: ( @46
arguments2
SimpleStringLiteral
literal: '0' @47
rightParenthesis: ) @50
element: dart:core::@class::Deprecated::@constructor::new
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: x @61
element: <testLibrary>::@class::A::@field::x
staticType: null
equals: = @63
expression2: IntegerLiteral
literal: 0 @65
staticType: int
getters
isOriginVariable x
reference: <testLibrary>::@class::A::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::x
''');
}
test_constructor_primary_body_metadata() async {
var library = await buildLibrary(r'''
class const A(final int x) {
@deprecated
this;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
metadata
Annotation
atSign: @ @31
name: SimpleIdentifier
token: deprecated @32
element: dart:core::@getter::deprecated
staticType: null
element: dart:core::@getter::deprecated
typeName: A
typeNameOffset: 12
thisKeywordOffset: 45
formalParameters
#F5 requiredPositional isDeclaring isFinal isOriginDeclaration this.x (nameOffset:24) (firstTokenOffset:14) (offset:24)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter x
reference: <testLibrary>::@class::A::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::x
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
constructors
isConst isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
metadata
Annotation
atSign: @ @31
name: SimpleIdentifier
token: deprecated @32
element: dart:core::@getter::deprecated
staticType: null
element: dart:core::@getter::deprecated
formalParameters
#E0 requiredPositional isDeclaring isFinal this.x
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::A::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::x
''');
}
test_constructor_primary_body_named() async {
var library = await buildLibrary(r'''
class const A.named() {
this : assert(true);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
constructors
#F2 isComplete isConst isOriginDeclaration isPrimary named (nameOffset:14) (firstTokenOffset:6) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
thisKeywordOffset: 26
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isConst isOriginDeclaration isPrimary named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F2
constantInitializers
AssertInitializer
assertKeyword: assert @33
leftParenthesis: ( @39
condition2: BooleanLiteral
literal: true @40
staticType: bool
rightParenthesis: ) @44
''');
}
test_constructor_primary_body_noDeclaration() async {
var library = await buildLibrary(r'''
class A {
this : assert(true) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
''');
}
test_constructor_primary_body_notConst() async {
var library = await buildLibrary(r'''
class A() {
this : assert(true) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
thisKeywordOffset: 14
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
''');
}
test_constructor_primary_body_primaryInitializerScope() async {
var library = await buildLibrary(r'''
class const A(final int x) {
this : assert(x > 0);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
thisKeywordOffset: 31
formalParameters
#F5 requiredPositional isDeclaring isFinal isOriginDeclaration this.x (nameOffset:24) (firstTokenOffset:14) (offset:24)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter x
reference: <testLibrary>::@class::A::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::x
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
constructors
isConst isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional isDeclaring isFinal this.x
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::x
constantInitializers
AssertInitializer
assertKeyword: assert @38
leftParenthesis: ( @44
condition2: BinaryExpression
leftOperand2: SimpleIdentifier
token: x @45
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
staticType: int
operator: > @47
rightOperand2: IntegerLiteral
literal: 0 @49
staticType: int
element: dart:core::@class::num::@method::>
staticInvokeType: bool Function(num)
staticType: bool
rightParenthesis: ) @50
getters
isOriginVariable x
reference: <testLibrary>::@class::A::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::x
''');
}
test_constructor_primary_const() async {
var library = await buildLibrary(r'''
class const A(final int foo) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:12) (firstTokenOffset:0) (offset:12)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F5 requiredPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:24) (firstTokenOffset:14) (offset:24)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isConst isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional isDeclaring isFinal this.foo
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_optionalNamed_functionTypedSuffix_final() async {
var library = await buildLibrary(r'''
class A({final int foo()}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:19) (firstTokenOffset:9) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int Function()
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed isDeclaring isFinal this.foo
firstFragment: #F5
type: int Function()
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int Function()
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_optionalNamed_private() async {
var library = await buildLibrary(r'''
class A({final int? _foo}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter isPromotable _foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::_foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:20) (firstTokenOffset:9) (offset:20)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable _foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::_foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed isDeclaring isFinal this.foo
firstFragment: #F5
type: int?
privateName: _foo
field: <testLibrary>::@class::A::@field::_foo
getters
isOriginVariable _foo
reference: <testLibrary>::@class::A::@getter::_foo
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::A::@field::_foo
''');
}
test_constructor_primary_declaringFormalParameter_optionalNamed_private_noCorrespondingPublic() async {
var library = await buildLibrary(r'''
class A({final int? _123}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter isPromotable _123 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::_123
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed isDeclaring isFinal isOriginDeclaration this._123 (nameOffset:20) (firstTokenOffset:9) (offset:20)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::_123
getters
#F3 isComplete isOriginVariable _123 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::_123
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter isPromotable _123
reference: <testLibrary>::@class::A::@field::_123
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::A::@getter::_123
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::_123
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed isDeclaring isFinal this._123
firstFragment: #F5
type: int?
field: <testLibrary>::@class::A::@field::_123
getters
isOriginVariable _123
reference: <testLibrary>::@class::A::@getter::_123
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::A::@field::_123
''');
}
test_constructor_primary_declaringFormalParameter_optionalNamed_simple_final() async {
var library = await buildLibrary(r'''
class A({final int foo}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:19) (firstTokenOffset:9) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed isDeclaring isFinal this.foo
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_optionalPositional_functionTypedSuffix_final() async {
var library = await buildLibrary(r'''
class A([final int foo()]) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:19) (firstTokenOffset:9) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int Function()
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalPositional isDeclaring isFinal this.foo
firstFragment: #F5
type: int Function()
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int Function()
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_optionalPositional_simple_final() async {
var library = await buildLibrary(r'''
class A([final int foo]) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:19) (firstTokenOffset:9) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalPositional isDeclaring isFinal this.foo
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredNamed_functionTypedSuffix_final() async {
var library = await buildLibrary(r'''
class A({required final int foo()}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredNamed isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:28) (firstTokenOffset:9) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int Function()
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredNamed isDeclaring isFinal this.foo
firstFragment: #F5
type: int Function()
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int Function()
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredNamed_private() async {
var library = await buildLibrary(r'''
class A({required final int _foo}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter isPromotable _foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::_foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredNamed isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:28) (firstTokenOffset:9) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable _foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::_foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::_foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredNamed isDeclaring isFinal this.foo
firstFragment: #F5
type: int
privateName: _foo
field: <testLibrary>::@class::A::@field::_foo
getters
isOriginVariable _foo
reference: <testLibrary>::@class::A::@getter::_foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::_foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredNamed_simple_final() async {
var library = await buildLibrary(r'''
class A({required final int foo}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredNamed isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:28) (firstTokenOffset:9) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredNamed isDeclaring isFinal this.foo
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredNamed_type_defaultObjectQuestion() async {
var library = await buildLibrary(r'''
class A({final foo}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 hasImplicitType isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed hasImplicitType isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:15) (firstTokenOffset:9) (offset:15)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: Object?
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed hasImplicitType isDeclaring isFinal this.foo
firstFragment: #F5
type: Object?
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: Object?
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredNamed_type_fromDefaultValue() async {
var library = await buildLibrary(r'''
class A({final foo = 0}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 hasImplicitType isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed hasImplicitType isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:15) (firstTokenOffset:9) (offset:15)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
initializer: expression_0
IntegerLiteral
literal: 0 @21
staticType: int
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaringFormalParameter isTypeInferredFromInitializer foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed hasDefaultValue hasImplicitType isDeclaring isFinal this.foo
firstFragment: #F5
type: int
constantInitializer
fragment: #F5
expression: expression_0
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredNamed_type_fromDefaultValue_null() async {
var library = await buildLibrary(r'''
class A({final foo = null}) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 hasImplicitType isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed hasImplicitType isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:15) (firstTokenOffset:9) (offset:15)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
initializer: expression_0
NullLiteral
literal: null @21
staticType: Null
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaringFormalParameter isTypeInferredFromInitializer foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: Object?
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed hasDefaultValue hasImplicitType isDeclaring isFinal this.foo
firstFragment: #F5
type: Object?
constantInitializer
fragment: #F5
expression: expression_0
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: Object?
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredNamed_type_fromField_inferred() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
class B({required final foo}) implements A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F5 class B (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::B
fields
#F6 hasImplicitType isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::B::@field::foo
inducedGetter: #F7
constructors
#F8 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:39) (offset:39)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 39
formalParameters
#F9 requiredNamed hasImplicitType isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:57) (firstTokenOffset:42) (offset:57)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::foo
getters
#F7 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::B::@getter::foo
inducingVariable: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
interfaces
A
fields
hasImplicitType isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::B::@field::foo
firstFragment: #F6
type: int
getter: <testLibrary>::@class::B::@getter::foo
declaringFormalParameter: <testLibrary>::@class::B::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E0 requiredNamed hasImplicitType isDeclaring isFinal this.foo
firstFragment: #F9
type: int
field: <testLibrary>::@class::B::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::B::@getter::foo
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::B::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredNamed_type_fromField_inferred_hasDefaultValue() async {
var library = await buildLibrary(r'''
class A {
num get foo => 0;
}
class B({final foo = 0}) implements A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F5 class B (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::B
fields
#F6 hasImplicitType isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::B::@field::foo
inducedGetter: #F7
constructors
#F8 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:39) (offset:39)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 39
formalParameters
#F9 optionalNamed hasImplicitType isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:48) (firstTokenOffset:42) (offset:48)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::foo
initializer: expression_0
IntegerLiteral
literal: 0 @54
staticType: int
getters
#F7 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::B::@getter::foo
inducingVariable: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: num
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: num
variable: <testLibrary>::@class::A::@field::foo
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
interfaces
A
fields
hasImplicitType isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::B::@field::foo
firstFragment: #F6
type: num
getter: <testLibrary>::@class::B::@getter::foo
declaringFormalParameter: <testLibrary>::@class::B::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E0 optionalNamed hasDefaultValue hasImplicitType isDeclaring isFinal this.foo
firstFragment: #F9
type: num
constantInitializer
fragment: #F9
expression: expression_0
field: <testLibrary>::@class::B::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::B::@getter::foo
firstFragment: #F7
returnType: num
variable: <testLibrary>::@class::B::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredPositional_functionTypedSuffix_final() async {
var library = await buildLibrary(r'''
class A(
/// first
/// second
@deprecated final int foo(),
) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:58) (firstTokenOffset:11) (offset:58)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
documentationComment: /// first\n/// second
metadata
Annotation
atSign: @ @36
name: SimpleIdentifier
token: deprecated @37
element: dart:core::@getter::deprecated
staticType: null
element: dart:core::@getter::deprecated
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
documentationComment: /// first\n/// second
metadata
Annotation
atSign: @ @36
name: SimpleIdentifier
token: deprecated @37
element: dart:core::@getter::deprecated
staticType: null
element: dart:core::@getter::deprecated
type: int Function()
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional isDeclaring isFinal this.foo
firstFragment: #F5
type: int Function()
documentationComment: /// first\n/// second
metadata
Annotation
atSign: @ @36
name: SimpleIdentifier
token: deprecated @37
element: dart:core::@getter::deprecated
staticType: null
element: dart:core::@getter::deprecated
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int Function()
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredPositional_functionTypedSuffix_var() async {
var library = await buildLibrary(r'''
class A(var int foo()) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:16) (firstTokenOffset:8) (offset:16)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int Function()
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isDeclaring isFinal this.foo
firstFragment: #F6
type: int Function()
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int Function()
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int Function()
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredPositional_simple_covariantVar() async {
var library = await buildLibrary(r'''
class A(covariant var int foo);
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isExplicitlyCovariant isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:26) (firstTokenOffset:8) (offset:26)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F2
formalParameters
#F7 requiredPositional isExplicitlyCovariant value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isCovariant isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isDeclaring isFinal this.foo
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F4
formalParameters
#E1 requiredPositional isCovariant value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredPositional_simple_final() async {
var library = await buildLibrary(r'''
class A(
/// first
/// second
@deprecated final int foo,
);
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:58) (firstTokenOffset:11) (offset:58)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
documentationComment: /// first\n/// second
metadata
Annotation
atSign: @ @36
name: SimpleIdentifier
token: deprecated @37
element: dart:core::@getter::deprecated
staticType: null
element: dart:core::@getter::deprecated
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
documentationComment: /// first\n/// second
metadata
Annotation
atSign: @ @36
name: SimpleIdentifier
token: deprecated @37
element: dart:core::@getter::deprecated
staticType: null
element: dart:core::@getter::deprecated
type: int
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional isDeclaring isFinal this.foo
firstFragment: #F5
type: int
documentationComment: /// first\n/// second
metadata
Annotation
atSign: @ @36
name: SimpleIdentifier
token: deprecated @37
element: dart:core::@getter::deprecated
staticType: null
element: dart:core::@getter::deprecated
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredPositional_simple_var() async {
var library = await buildLibrary(r'''
class A(var int foo) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:16) (firstTokenOffset:8) (offset:16)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isDeclaring isFinal this.foo
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredPositional_type_defaultObjectQuestion() async {
var library = await buildLibrary(r'''
class A(final foo) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 hasImplicitType isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredPositional hasImplicitType isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:14) (firstTokenOffset:8) (offset:14)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: Object?
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType isDeclaring isFinal this.foo
firstFragment: #F5
type: Object?
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: Object?
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredPositional_type_fromField_inferred() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
class B(final foo) implements A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F5 class B (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::B
fields
#F6 hasImplicitType isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::B::@field::foo
inducedGetter: #F7
constructors
#F8 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:39) (offset:39)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 39
formalParameters
#F9 requiredPositional hasImplicitType isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:47) (firstTokenOffset:41) (offset:47)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::foo
getters
#F7 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::B::@getter::foo
inducingVariable: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
interfaces
A
fields
hasImplicitType isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::B::@field::foo
firstFragment: #F6
type: int
getter: <testLibrary>::@class::B::@getter::foo
declaringFormalParameter: <testLibrary>::@class::B::@constructor::new::@formalParameter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E0 requiredPositional hasImplicitType isDeclaring isFinal this.foo
firstFragment: #F9
type: int
field: <testLibrary>::@class::B::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::B::@getter::foo
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::B::@field::foo
''');
}
test_constructor_primary_declaringFormalParameter_requiredPositional_type_typeParameter() async {
var library = await buildLibrary(r'''
class A<T>(final T foo) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
fields
#F3 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
constructors
#F5 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:19) (firstTokenOffset:11) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
fields
hasEnclosingTypeParameterReference isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: T
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
constructors
hasEnclosingTypeParameterReference isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional isDeclaring isFinal this.foo
firstFragment: #F6
type: T
field: <testLibrary>::@class::A::@field::foo
getters
hasEnclosingTypeParameterReference isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: T
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_fieldTypeAnnotation_usesClassScope() async {
var library = await buildLibrary(r'''
class A(int A) {
A? field;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginDeclaration field (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::field
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isOriginDeclaration A (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::A
getters
#F3 isComplete isOriginVariable field (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::field
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable field (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@setter::field
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@setter::field::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginDeclaration field
reference: <testLibrary>::@class::A::@field::field
firstFragment: #F2
type: A?
getter: <testLibrary>::@class::A::@getter::field
setter: <testLibrary>::@class::A::@setter::field
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional A
firstFragment: #F6
type: int
getters
isOriginVariable field
reference: <testLibrary>::@class::A::@getter::field
firstFragment: #F3
returnType: A?
variable: <testLibrary>::@class::A::@field::field
setters
isOriginVariable field
reference: <testLibrary>::@class::A::@setter::field
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: A?
returnType: void
variable: <testLibrary>::@class::A::@field::field
''');
}
test_constructor_primary_formalParameter_field_optionalNamed_private() async {
var library = await buildLibrary(r'''
class A({this._foo}) {
final int? _foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration isPromotable _foo (nameOffset:36) (firstTokenOffset:36) (offset:36)
element: <testLibrary>::@class::A::@field::_foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed hasImplicitType isFinal isOriginDeclaration this.foo (nameOffset:14) (firstTokenOffset:9) (offset:14)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable _foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::A::@getter::_foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed hasImplicitType isFinal this.foo
firstFragment: #F5
type: int?
privateName: _foo
field: <testLibrary>::@class::A::@field::_foo
getters
isOriginVariable _foo
reference: <testLibrary>::@class::A::@getter::_foo
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::A::@field::_foo
''');
}
test_constructor_primary_formalParameter_field_optionalNamed_private_noCorrespondingPublic() async {
var library = await buildLibrary(r'''
class A({this._123}) {
final int? _123;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration isPromotable _123 (nameOffset:36) (firstTokenOffset:36) (offset:36)
element: <testLibrary>::@class::A::@field::_123
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 optionalNamed hasImplicitType isFinal isOriginDeclaration this._123 (nameOffset:14) (firstTokenOffset:9) (offset:14)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::_123
getters
#F3 isComplete isOriginVariable _123 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::A::@getter::_123
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration isPromotable _123
reference: <testLibrary>::@class::A::@field::_123
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::A::@getter::_123
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed hasImplicitType isFinal this._123
firstFragment: #F5
type: int?
field: <testLibrary>::@class::A::@field::_123
getters
isOriginVariable _123
reference: <testLibrary>::@class::A::@getter::_123
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::A::@field::_123
''');
}
test_constructor_primary_formalParameter_field_requiredNamed_private() async {
var library = await buildLibrary(r'''
class A({required this._foo}) {
final int? _foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration isPromotable _foo (nameOffset:45) (firstTokenOffset:45) (offset:45)
element: <testLibrary>::@class::A::@field::_foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredNamed hasImplicitType isFinal isOriginDeclaration this.foo (nameOffset:23) (firstTokenOffset:9) (offset:23)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable _foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:45)
element: <testLibrary>::@class::A::@getter::_foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredNamed hasImplicitType isFinal this.foo
firstFragment: #F5
type: int?
privateName: _foo
field: <testLibrary>::@class::A::@field::_foo
getters
isOriginVariable _foo
reference: <testLibrary>::@class::A::@getter::_foo
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::A::@field::_foo
''');
}
test_constructor_primary_formalParameter_field_requiredPositional() async {
var library = await buildLibrary(r'''
class A(this.foo) {
final int foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration foo (nameOffset:32) (firstTokenOffset:32) (offset:32)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredPositional hasImplicitType isFinal isOriginDeclaration this.foo (nameOffset:13) (firstTokenOffset:8) (offset:13)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.foo
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_formalParameter_field_requiredPositional_final() async {
var library = await buildLibrary(r'''
class A(final this.foo) {
final int foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration foo (nameOffset:38) (firstTokenOffset:38) (offset:38)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredPositional hasImplicitType isFinal isOriginDeclaration this.foo (nameOffset:19) (firstTokenOffset:8) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:38)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.foo
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_primary_formalParameter_regular_requiredPositional_functionTypedSuffix() async {
var library = await buildLibrary(r'''
class A(int foo()) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F3 requiredPositional isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional foo
firstFragment: #F3
type: int Function()
''');
}
test_constructor_primary_formalParameter_regular_requiredPositional_simple() async {
var library = await buildLibrary(r'''
class A(int foo) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F3 requiredPositional isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional foo
firstFragment: #F3
type: int
''');
}
test_constructor_primary_formalParameter_super_requiredPositional() async {
var library = await buildLibrary(r'''
class A(int foo) {}
class B(super.foo) extends A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F3 requiredPositional isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
#F4 hasExtendsClause class B (nameOffset:27) (firstTokenOffset:21) (offset:27)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:27) (offset:27)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 27
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration super.foo (nameOffset:35) (firstTokenOffset:29) (offset:35)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional foo
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.foo
firstFragment: #F6
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_primary_formalParameter_super_requiredPositional_final() async {
var library = await buildLibrary(r'''
class A(int foo) {}
class B(final super.foo) extends A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F3 requiredPositional isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
#F4 hasExtendsClause class B (nameOffset:27) (firstTokenOffset:21) (offset:27)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:27) (offset:27)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 27
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration super.foo (nameOffset:41) (firstTokenOffset:29) (offset:41)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional foo
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.foo
firstFragment: #F6
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_primary_named_formalParameter_super_optionalNamed() async {
var library = await buildLibrary(r'''
class A {
A.named({required int a, required double b});
}
class B({String o1, super.a, String o2, super.b}) extends A {
this : super.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F3 requiredNamed isOriginDeclaration a (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#F4 requiredNamed isOriginDeclaration b (nameOffset:53) (firstTokenOffset:37) (offset:53)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:67) (firstTokenOffset:61) (offset:67)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:67) (offset:67)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 67
thisKeywordOffset: 125
formalParameters
#F7 optionalNamed isOriginDeclaration o1 (nameOffset:77) (firstTokenOffset:70) (offset:77)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 optionalNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:87) (firstTokenOffset:81) (offset:87)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 optionalNamed isOriginDeclaration o2 (nameOffset:97) (firstTokenOffset:90) (offset:97)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 optionalNamed hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:107) (firstTokenOffset:101) (offset:107)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F2
formalParameters
#E0 requiredNamed a
firstFragment: #F3
type: int
#E1 requiredNamed b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 optionalNamed o1
firstFragment: #F7
type: String
#E3 optionalNamed hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#E4 optionalNamed o2
firstFragment: #F9
type: String
#E5 optionalNamed hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::named::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::named
''');
}
test_constructor_primary_named_formalParameter_super_optionalPositional() async {
var library = await buildLibrary(r'''
class A {
A.named(int a, double b);
}
class B([String o1, super.a, String o2, super.b]) extends A {
this : super.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#F4 requiredPositional isOriginDeclaration b (nameOffset:34) (firstTokenOffset:27) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:47) (firstTokenOffset:41) (offset:47)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
thisKeywordOffset: 105
formalParameters
#F7 optionalPositional isOriginDeclaration o1 (nameOffset:57) (firstTokenOffset:50) (offset:57)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 optionalPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:67) (firstTokenOffset:61) (offset:67)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 optionalPositional isOriginDeclaration o2 (nameOffset:77) (firstTokenOffset:70) (offset:77)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 optionalPositional hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:87) (firstTokenOffset:81) (offset:87)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
#E1 requiredPositional b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 optionalPositional o1
firstFragment: #F7
type: String
#E3 optionalPositional hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#E4 optionalPositional o2
firstFragment: #F9
type: String
#E5 optionalPositional hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::named::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::named
''');
}
test_constructor_primary_named_formalParameter_super_requiredNamed() async {
var library = await buildLibrary(r'''
class A {
A.named({required int a, required double b});
}
class B({
required String o1,
required super.a,
required String o2,
required super.b,
}) extends A {
this : super.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F3 requiredNamed isOriginDeclaration a (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#F4 requiredNamed isOriginDeclaration b (nameOffset:53) (firstTokenOffset:37) (offset:53)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:67) (firstTokenOffset:61) (offset:67)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:67) (offset:67)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 67
thisKeywordOffset: 172
formalParameters
#F7 requiredNamed isOriginDeclaration o1 (nameOffset:89) (firstTokenOffset:73) (offset:89)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 requiredNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:110) (firstTokenOffset:95) (offset:110)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 requiredNamed isOriginDeclaration o2 (nameOffset:131) (firstTokenOffset:115) (offset:131)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 requiredNamed hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:152) (firstTokenOffset:137) (offset:152)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F2
formalParameters
#E0 requiredNamed a
firstFragment: #F3
type: int
#E1 requiredNamed b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 requiredNamed o1
firstFragment: #F7
type: String
#E3 requiredNamed hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#E4 requiredNamed o2
firstFragment: #F9
type: String
#E5 requiredNamed hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::named::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::named
''');
}
test_constructor_primary_named_formalParameter_super_requiredPositional() async {
var library = await buildLibrary(r'''
class A {
A.named(int a, double b);
}
class B(String o1, super.a, String o2, super.b) extends A {
this : super.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#F4 requiredPositional isOriginDeclaration b (nameOffset:34) (firstTokenOffset:27) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:47) (firstTokenOffset:41) (offset:47)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
thisKeywordOffset: 103
formalParameters
#F7 requiredPositional isOriginDeclaration o1 (nameOffset:56) (firstTokenOffset:49) (offset:56)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:66) (firstTokenOffset:60) (offset:66)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 requiredPositional isOriginDeclaration o2 (nameOffset:76) (firstTokenOffset:69) (offset:76)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 requiredPositional hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:86) (firstTokenOffset:80) (offset:86)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
#E1 requiredPositional b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 requiredPositional o1
firstFragment: #F7
type: String
#E3 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#E4 requiredPositional o2
firstFragment: #F9
type: String
#E5 requiredPositional hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::named::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::named
''');
}
test_constructor_primary_scopes() async {
var library = await buildLibrary(r'''
const foo = 0;
class A<@foo T>([@foo int x = foo]) {
static const foo = 1;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:22) (firstTokenOffset:16) (offset:22)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:29) (firstTokenOffset:24) (offset:29)
element: #E0 T
metadata
Annotation
atSign: @ @24
name: SimpleIdentifier
token: foo @25
element: <testLibrary>::@getter::foo
staticType: null
element: <testLibrary>::@getter::foo
fields
#F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic foo (nameOffset:69) (firstTokenOffset:69) (offset:69)
element: <testLibrary>::@class::A::@field::foo
initializer: expression_0
IntegerLiteral
literal: 1 @75
staticType: int
inducedGetter: #F4
constructors
#F5 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 22
formalParameters
#F6 optionalPositional isOriginDeclaration x (nameOffset:42) (firstTokenOffset:33) (offset:42)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
metadata
Annotation
atSign: @ @33
name: SimpleIdentifier
token: foo @34
element: <testLibrary>::@class::A::@getter::foo
staticType: null
element: <testLibrary>::@class::A::@getter::foo
initializer: expression_1
SimpleIdentifier
token: foo @46
element: <testLibrary>::@class::A::@getter::foo
staticType: int
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:69)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
topLevelVariables
#F7 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic foo (nameOffset:6) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@topLevelVariable::foo
initializer: expression_2
IntegerLiteral
literal: 0 @12
staticType: int
inducedGetter: #F8
getters
#F8 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@getter::foo
inducingVariable: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
metadata
Annotation
atSign: @ @24
name: SimpleIdentifier
token: foo @25
element: <testLibrary>::@getter::foo
staticType: null
element: <testLibrary>::@getter::foo
fields
hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
constantInitializer
fragment: #F3
expression: expression_0
getter: <testLibrary>::@class::A::@getter::foo
constructors
hasEnclosingTypeParameterReference isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E1 optionalPositional hasDefaultValue x
firstFragment: #F6
type: int
metadata
Annotation
atSign: @ @33
name: SimpleIdentifier
token: foo @34
element: <testLibrary>::@class::A::@getter::foo
staticType: null
element: <testLibrary>::@class::A::@getter::foo
constantInitializer
fragment: #F6
expression: expression_1
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
topLevelVariables
hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer foo
reference: <testLibrary>::@topLevelVariable::foo
firstFragment: #F7
type: int
constantInitializer
fragment: #F7
expression: expression_2
getter: <testLibrary>::@getter::foo
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@getter::foo
firstFragment: #F8
returnType: int
variable: <testLibrary>::@topLevelVariable::foo
''');
}
test_constructor_primary_typeParameters() async {
var library = await buildLibrary(r'''
class A<T extends U, U extends num>(T t, U u);
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E1 U
constructors
#F4 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F5 requiredPositional isOriginDeclaration t (nameOffset:38) (firstTokenOffset:36) (offset:38)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::t
#F6 requiredPositional isOriginDeclaration u (nameOffset:43) (firstTokenOffset:41) (offset:43)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::u
classes
class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
bound: U
#E1 U
firstFragment: #F3
bound: num
constructors
hasEnclosingTypeParameterReference isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E2 requiredPositional t
firstFragment: #F5
type: T
#E3 requiredPositional u
firstFragment: #F6
type: U
''');
}
test_constructor_primary_unnamed_formalParameter_super_optionalNamed() async {
var library = await buildLibrary(r'''
class A {
A({required int a, required double b});
}
class B({String o1, super.a, String o2, super.b}) extends A;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration a (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 requiredNamed isOriginDeclaration b (nameOffset:47) (firstTokenOffset:31) (offset:47)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:61) (firstTokenOffset:55) (offset:61)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:61) (offset:61)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 61
formalParameters
#F7 optionalNamed isOriginDeclaration o1 (nameOffset:71) (firstTokenOffset:64) (offset:71)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 optionalNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:81) (firstTokenOffset:75) (offset:81)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 optionalNamed isOriginDeclaration o2 (nameOffset:91) (firstTokenOffset:84) (offset:91)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 optionalNamed hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:101) (firstTokenOffset:95) (offset:101)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed a
firstFragment: #F3
type: int
#E1 requiredNamed b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 optionalNamed o1
firstFragment: #F7
type: String
#E3 optionalNamed hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#E4 optionalNamed o2
firstFragment: #F9
type: String
#E5 optionalNamed hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_primary_unnamed_formalParameter_super_optionalPositional() async {
var library = await buildLibrary(r'''
class A {
A(int a, double b);
}
class B([String o1, super.a, String o2, super.b]) extends A;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 requiredPositional isOriginDeclaration b (nameOffset:28) (firstTokenOffset:21) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:41) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:41) (offset:41)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 41
formalParameters
#F7 optionalPositional isOriginDeclaration o1 (nameOffset:51) (firstTokenOffset:44) (offset:51)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 optionalPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:61) (firstTokenOffset:55) (offset:61)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 optionalPositional isOriginDeclaration o2 (nameOffset:71) (firstTokenOffset:64) (offset:71)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 optionalPositional hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:81) (firstTokenOffset:75) (offset:81)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
#E1 requiredPositional b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 optionalPositional o1
firstFragment: #F7
type: String
#E3 optionalPositional hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#E4 optionalPositional o2
firstFragment: #F9
type: String
#E5 optionalPositional hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_primary_unnamed_formalParameter_super_requiredNamed() async {
var library = await buildLibrary(r'''
class A {
A({required int a, required double b});
}
class B({
required String o1,
required super.a,
required String o2,
required super.b,
}) extends A;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration a (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 requiredNamed isOriginDeclaration b (nameOffset:47) (firstTokenOffset:31) (offset:47)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:61) (firstTokenOffset:55) (offset:61)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:61) (offset:61)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 61
formalParameters
#F7 requiredNamed isOriginDeclaration o1 (nameOffset:83) (firstTokenOffset:67) (offset:83)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 requiredNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:104) (firstTokenOffset:89) (offset:104)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 requiredNamed isOriginDeclaration o2 (nameOffset:125) (firstTokenOffset:109) (offset:125)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 requiredNamed hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:146) (firstTokenOffset:131) (offset:146)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed a
firstFragment: #F3
type: int
#E1 requiredNamed b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 requiredNamed o1
firstFragment: #F7
type: String
#E3 requiredNamed hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#E4 requiredNamed o2
firstFragment: #F9
type: String
#E5 requiredNamed hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_primary_unnamed_formalParameter_super_requiredPositional() async {
var library = await buildLibrary(r'''
class A {
A(int a, double b);
}
class B(String o1, super.a, String o2, super.b) extends A;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 requiredPositional isOriginDeclaration b (nameOffset:28) (firstTokenOffset:21) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:41) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:41) (offset:41)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 41
formalParameters
#F7 requiredPositional isOriginDeclaration o1 (nameOffset:50) (firstTokenOffset:43) (offset:50)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:60) (firstTokenOffset:54) (offset:60)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 requiredPositional isOriginDeclaration o2 (nameOffset:70) (firstTokenOffset:63) (offset:70)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 requiredPositional hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:80) (firstTokenOffset:74) (offset:80)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
#E1 requiredPositional b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 requiredPositional o1
firstFragment: #F7
type: String
#E3 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#E4 requiredPositional o2
firstFragment: #F9
type: String
#E5 requiredPositional hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_add_named() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
A.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F3 isOriginDeclaration named (nameOffset:34) (firstTokenOffset:32) (offset:34)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 32
periodOffset: 33
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_add_named_generic() async {
var library = await buildLibrary(r'''
class A<T> {}
augment class A<T> {
A.named(T a);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:29) (firstTokenOffset:15) (offset:29)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:31) (firstTokenOffset:31) (offset:31)
element: #E0 T
previousFragment: #F3
constructors
#F5 isOriginDeclaration named (nameOffset:40) (firstTokenOffset:38) (offset:40)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 38
periodOffset: 39
formalParameters
#F6 requiredPositional isOriginDeclaration a (nameOffset:49) (firstTokenOffset:46) (offset:49)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F5
formalParameters
#E1 requiredPositional a
firstFragment: #F6
type: T
''');
}
test_constructor_secondary_augmentation_add_named_hasUnnamed() async {
var library = await buildLibrary(r'''
class A {
A();
}
augment class A {
A.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
#F2 isAugmentation class A (nameOffset:34) (firstTokenOffset:20) (offset:34)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isOriginDeclaration named (nameOffset:42) (firstTokenOffset:40) (offset:42)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 40
periodOffset: 41
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F4
''');
}
test_constructor_secondary_augmentation_add_unnamed() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
A();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:32) (offset:32)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 32
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_add_unnamed_hasNamed() async {
var library = await buildLibrary(r'''
class A {
A.named();
}
augment class A {
A();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:46) (offset:46)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 46
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
''');
}
test_constructor_secondary_augmentation_add_withConstructorFieldInitializer() async {
var library = await buildLibrary(r'''
class A {
final int f;
}
augment class A {
const A.named() : f = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration f (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::f
inducedGetter: #F4
getters
#F4 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::f
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F5 isComplete isConst isOriginDeclaration named (nameOffset:56) (firstTokenOffset:48) (offset:56)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 54
periodOffset: 55
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration f
reference: <testLibrary>::@class::A::@field::f
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::f
constructors
isConst isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F5
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: f @66
element: <testLibrary>::@class::A::@field::f
staticType: null
equals: = @68
expression2: IntegerLiteral
literal: 0 @70
staticType: int
getters
isOriginVariable f
reference: <testLibrary>::@class::A::@getter::f
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::f
''');
}
test_constructor_secondary_augmentation_add_withFieldFormalParameter() async {
var library = await buildLibrary(r'''
class A {
final int f;
}
augment class A {
A.named(this.f);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration f (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::f
inducedGetter: #F4
getters
#F4 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::f
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F5 isComplete isOriginDeclaration named (nameOffset:50) (firstTokenOffset:48) (offset:50)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 48
periodOffset: 49
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.f (nameOffset:61) (firstTokenOffset:56) (offset:61)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::f
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration f
reference: <testLibrary>::@class::A::@field::f
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::f
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F5
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.f
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::f
getters
isOriginVariable f
reference: <testLibrary>::@class::A::@getter::f
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::f
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_fN1__rN1__fN1() async {
var library = await buildLibrary(r'''
class A {
final int n1;
A({required this.n1});
}
augment class A {
augment A({required int n1});
}
augment class A {
augment A({required this.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration n1 (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::n1
inducedGetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 28
formalParameters
#F6 requiredNamed hasImplicitType isFinal isOriginDeclaration this.n1 (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
getters
#F4 isComplete isOriginVariable n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::n1
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:67) (firstTokenOffset:53) (offset:67)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
constructors
#F8 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:73) (offset:81)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 81
formalParameters
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:97) (firstTokenOffset:84) (offset:97)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
previousFragment: #F6
nextFragment: #F10
nextFragment: #F11
previousFragment: #F5
#F9 isAugmentation class A (nameOffset:119) (firstTokenOffset:105) (offset:119)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F11 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:125) (offset:133)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 133
formalParameters
#F10 requiredNamed hasImplicitType isFinal isOriginDeclaration this.n1 (nameOffset:150) (firstTokenOffset:136) (offset:150)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration n1
reference: <testLibrary>::@class::A::@field::n1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::n1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredNamed hasImplicitType isFinal this.n1
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::n1
getters
isOriginVariable n1
reference: <testLibrary>::@class::A::@getter::n1
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::n1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_fN1__rN2__fN1() async {
var library = await buildLibrary(r'''
class A {
final int n1;
A({required this.n1});
}
augment class A {
augment A({required int n2});
}
augment class A {
augment A({required this.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration n1 (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::n1
inducedGetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 28
formalParameters
#F6 requiredNamed hasImplicitType isFinal isOriginDeclaration this.n1 (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
nextFragment: #F7
#F8 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n2
nextFragment: #F9
nextFragment: #F10
getters
#F4 isComplete isOriginVariable n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::n1
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:67) (firstTokenOffset:53) (offset:67)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F11
constructors
#F10 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:73) (offset:81)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 81
formalParameters
#F9 requiredNamed isOriginDeclaration n2 (nameOffset:97) (firstTokenOffset:84) (offset:97)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n2
previousFragment: #F8
nextFragment: #F12
#F7 requiredNamed isFinal isOriginOtherFragmentOfEnclosing this.n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:81)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
previousFragment: #F6
nextFragment: #F13
nextFragment: #F14
previousFragment: #F5
#F11 isAugmentation class A (nameOffset:119) (firstTokenOffset:105) (offset:119)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F14 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:125) (offset:133)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 133
formalParameters
#F13 requiredNamed hasImplicitType isFinal isOriginDeclaration this.n1 (nameOffset:150) (firstTokenOffset:136) (offset:150)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
previousFragment: #F7
#F12 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:133)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n2
previousFragment: #F9
previousFragment: #F10
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration n1
reference: <testLibrary>::@class::A::@field::n1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::n1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredNamed hasImplicitType isFinal this.n1
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::n1
getters
isOriginVariable n1
reference: <testLibrary>::@class::A::@getter::n1
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::n1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_fP1__fP1() async {
var library = await buildLibrary(r'''
class A {
final int p1;
A(this.p1);
}
augment class A {
augment A(this.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration p1 (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::p1
inducedGetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 28
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:35) (firstTokenOffset:30) (offset:35)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
getters
#F4 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::p1
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:62) (offset:70)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 70
formalParameters
#F7 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:77) (firstTokenOffset:72) (offset:77)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::A::@field::p1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.p1
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::p1
getters
isOriginVariable p1
reference: <testLibrary>::@class::A::@getter::p1
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_fP1__rP1() async {
var library = await buildLibrary(r'''
class A {
final int p1;
A(this.p1);
}
augment class A {
augment A(int p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration p1 (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::p1
inducedGetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 28
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:35) (firstTokenOffset:30) (offset:35)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
getters
#F4 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::p1
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:62) (offset:70)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 70
formalParameters
#F7 requiredPositional isOriginDeclaration p1 (nameOffset:76) (firstTokenOffset:72) (offset:76)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::A::@field::p1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.p1
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::p1
getters
isOriginVariable p1
reference: <testLibrary>::@class::A::@getter::p1
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_fP1__rP1__fP1() async {
var library = await buildLibrary(r'''
class A {
final int p1;
A(this.p1);
}
augment class A {
augment A(int p1);
}
augment class A {
augment A(this.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration p1 (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::p1
inducedGetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 28
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:35) (firstTokenOffset:30) (offset:35)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
getters
#F4 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::p1
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
constructors
#F8 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:62) (offset:70)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 70
formalParameters
#F7 requiredPositional isOriginDeclaration p1 (nameOffset:76) (firstTokenOffset:72) (offset:76)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F6
nextFragment: #F10
nextFragment: #F11
previousFragment: #F5
#F9 isAugmentation class A (nameOffset:97) (firstTokenOffset:83) (offset:97)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F11 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:103) (offset:111)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 111
formalParameters
#F10 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:118) (firstTokenOffset:113) (offset:118)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::A::@field::p1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.p1
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::p1
getters
isOriginVariable p1
reference: <testLibrary>::@class::A::@getter::p1
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_fP1__rP1__sP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
final int p1;
B(this.p1) : super(0);
}
augment class B {
augment B(int p1);
}
augment class B {
augment B(super.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
fields
#F6 isFinal isOriginDeclaration p1 (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: <testLibrary>::@class::B::@field::p1
inducedGetter: #F7
constructors
#F8 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:63) (offset:63)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 63
formalParameters
#F9 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:70) (firstTokenOffset:65) (offset:70)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F10
nextFragment: #F11
getters
#F7 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::B::@getter::p1
inducingVariable: #F6
#F5 isAugmentation class B (nameOffset:102) (firstTokenOffset:88) (offset:102)
element: <testLibrary>::@class::B
previousFragment: #F4
nextFragment: #F12
constructors
#F11 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:108) (offset:116)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 116
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:122) (firstTokenOffset:118) (offset:122)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F9
nextFragment: #F13
nextFragment: #F14
previousFragment: #F8
#F12 isAugmentation class B (nameOffset:143) (firstTokenOffset:129) (offset:143)
element: <testLibrary>::@class::B
previousFragment: #F5
constructors
#F14 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:149) (offset:157)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 157
formalParameters
#F13 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:165) (firstTokenOffset:159) (offset:165)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F10
previousFragment: #F11
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::B::@field::p1
firstFragment: #F6
type: int
getter: <testLibrary>::@class::B::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E1 requiredPositional hasImplicitType isFinal this.p1
firstFragment: #F9
type: int
field: <testLibrary>::@class::B::@field::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable p1
reference: <testLibrary>::@class::B::@getter::p1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::B::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_fP1__sP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
final int p1;
B(this.p1) : super(0);
}
augment class B {
augment B(super.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
fields
#F6 isFinal isOriginDeclaration p1 (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: <testLibrary>::@class::B::@field::p1
inducedGetter: #F7
constructors
#F8 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:63) (offset:63)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 63
formalParameters
#F9 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:70) (firstTokenOffset:65) (offset:70)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F10
nextFragment: #F11
getters
#F7 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::B::@getter::p1
inducingVariable: #F6
#F5 isAugmentation class B (nameOffset:102) (firstTokenOffset:88) (offset:102)
element: <testLibrary>::@class::B
previousFragment: #F4
constructors
#F11 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:108) (offset:116)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 116
formalParameters
#F10 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:124) (firstTokenOffset:118) (offset:124)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F9
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::B::@field::p1
firstFragment: #F6
type: int
getter: <testLibrary>::@class::B::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E1 requiredPositional hasImplicitType isFinal this.p1
firstFragment: #F9
type: int
field: <testLibrary>::@class::B::@field::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable p1
reference: <testLibrary>::@class::B::@getter::p1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::B::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rn1__fn1_intQ_numQ_nothing() async {
var library = await buildLibrary(r'''
class A {
final int? n1;
A({num? n1});
augment A({this.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration n1 (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::n1
inducedGetter: #F3
constructors
#F4 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:29) (offset:29)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 29
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:37) (firstTokenOffset:32) (offset:37)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
nextFragment: #F6
nextFragment: #F7
#F7 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:45) (offset:53)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 53
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration this.n1 (nameOffset:61) (firstTokenOffset:56) (offset:61)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
previousFragment: #F5
previousFragment: #F4
getters
#F3 isComplete isOriginVariable n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::n1
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration n1
reference: <testLibrary>::@class::A::@field::n1
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::A::@getter::n1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed isFinal this.n1
firstFragment: #F5
type: num?
field: <testLibrary>::@class::A::@field::n1
getters
isOriginVariable n1
reference: <testLibrary>::@class::A::@getter::n1
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::A::@field::n1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rn1__fn1_omittedIntroductoryType() async {
var library = await buildLibrary(r'''
class A {
final int? n1;
A({n1});
augment A({this.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration n1 (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::n1
inducedGetter: #F3
constructors
#F4 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:29) (offset:29)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 29
formalParameters
#F5 optionalNamed hasImplicitType isOriginDeclaration n1 (nameOffset:32) (firstTokenOffset:32) (offset:32)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
nextFragment: #F6
nextFragment: #F7
#F7 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:40) (offset:48)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 48
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration this.n1 (nameOffset:56) (firstTokenOffset:51) (offset:56)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
previousFragment: #F5
previousFragment: #F4
getters
#F3 isComplete isOriginVariable n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::n1
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration n1
reference: <testLibrary>::@class::A::@field::n1
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::A::@getter::n1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalNamed hasImplicitType isFinal this.n1
firstFragment: #F5
type: dynamic
field: <testLibrary>::@class::A::@field::n1
getters
isOriginVariable n1
reference: <testLibrary>::@class::A::@getter::n1
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::A::@field::n1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1__rN1() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1});
}
augment class A {
augment A.named({required int n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:72) (firstTokenOffset:62) (offset:72)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 70
periodOffset: 71
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:92) (firstTokenOffset:79) (offset:92)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1__rn1() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1});
}
augment class A {
augment A.named({int n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:72) (firstTokenOffset:62) (offset:72)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 70
periodOffset: 71
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:83) (firstTokenOffset:79) (offset:83)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rn1__rN1() async {
var library = await buildLibrary(r'''
class A {
A.named({int n1});
}
augment class A {
augment A.named({required int n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalNamed isOriginDeclaration n1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:83) (firstTokenOffset:70) (offset:83)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rn1__rn1() async {
var library = await buildLibrary(r'''
class A {
A.named({int n1});
}
augment class A {
augment A.named({int n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalNamed isOriginDeclaration n1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1__rN1_differentType() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1});
}
augment class A {
augment A.named({required double n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:72) (firstTokenOffset:62) (offset:72)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 70
periodOffset: 71
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:95) (firstTokenOffset:79) (offset:95)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1__rN1_rN1() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1});
}
augment class A {
augment A.named({required int n1, required int n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
#F6 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:72) (firstTokenOffset:62) (offset:72)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 70
periodOffset: 71
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:92) (firstTokenOffset:79) (offset:92)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:109) (firstTokenOffset:96) (offset:109)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1__rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1});
}
augment class A {
augment A.named({required int n1, required int n2});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
#F6 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:72) (firstTokenOffset:62) (offset:72)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 70
periodOffset: 71
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:92) (firstTokenOffset:79) (offset:92)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
#F7 requiredNamed isOriginDeclaration n2 (nameOffset:109) (firstTokenOffset:96) (offset:109)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1__rP1() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1});
}
augment class A {
augment A.named(int p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:72) (firstTokenOffset:62) (offset:72)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 70
periodOffset: 71
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:82) (firstTokenOffset:78) (offset:82)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:72)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F6
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1__rp1() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1});
}
augment class A {
augment A.named([int p1]);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:56) (firstTokenOffset:42) (offset:56)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:72) (firstTokenOffset:62) (offset:72)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 70
periodOffset: 71
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:83) (firstTokenOffset:79) (offset:83)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:72)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F6
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rn1__rP1() async {
var library = await buildLibrary(r'''
class A {
A.named({int n1});
}
augment class A {
augment A.named(int p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:73) (firstTokenOffset:69) (offset:73)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 optionalNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F6
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rn1__rp1() async {
var library = await buildLibrary(r'''
class A {
A.named({int n1});
}
augment class A {
augment A.named([int p1]);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 optionalNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F6
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1__sN1_omittedIntroductoryType() async {
var library = await buildLibrary(r'''
class A {
A({required int n1});
}
class B extends A {
B({required n1});
augment B({required super.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration n1 (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
#F4 hasExtendsClause class B (nameOffset:42) (firstTokenOffset:36) (offset:42)
element: <testLibrary>::@class::B
constructors
#F5 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:58) (offset:58)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 58
formalParameters
#F6 requiredNamed hasImplicitType isOriginDeclaration n1 (nameOffset:70) (firstTokenOffset:61) (offset:70)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F8 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:78) (offset:86)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 86
formalParameters
#F7 requiredNamed hasImplicitType isFinal isOriginDeclaration super.n1 (nameOffset:104) (firstTokenOffset:89) (offset:104)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed n1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredNamed hasImplicitType isFinal super.n1
firstFragment: #F6
type: dynamic
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rn1__sn1_omittedIntroductoryType() async {
var library = await buildLibrary(r'''
class A {
A({int? n1});
}
class B extends A {
B({n1});
augment B({super.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 optionalNamed isOriginDeclaration n1 (nameOffset:20) (firstTokenOffset:15) (offset:20)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
#F4 hasExtendsClause class B (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::B
constructors
#F5 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:50) (offset:50)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 50
formalParameters
#F6 optionalNamed hasImplicitType isOriginDeclaration n1 (nameOffset:53) (firstTokenOffset:53) (offset:53)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F8 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:61) (offset:69)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 69
formalParameters
#F7 optionalNamed hasImplicitType isFinal isOriginDeclaration super.n1 (nameOffset:78) (firstTokenOffset:72) (offset:78)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 optionalNamed n1
firstFragment: #F3
type: int?
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 optionalNamed hasImplicitType isFinal super.n1
firstFragment: #F6
type: dynamic
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1_rN1__rN1() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1, required int n1});
}
augment class A {
augment A.named({required int n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:51) (firstTokenOffset:38) (offset:51)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:73) (firstTokenOffset:59) (offset:73)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:89) (firstTokenOffset:79) (offset:89)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 87
periodOffset: 88
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:109) (firstTokenOffset:96) (offset:109)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:89)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
#E1 requiredNamed n1
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1_rN1__rN1_rN1() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1, required int n1});
}
augment class A {
augment A.named({required int n1, required int n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:51) (firstTokenOffset:38) (offset:51)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:73) (firstTokenOffset:59) (offset:73)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:89) (firstTokenOffset:79) (offset:89)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 87
periodOffset: 88
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:109) (firstTokenOffset:96) (offset:109)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:126) (firstTokenOffset:113) (offset:126)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
#E1 requiredNamed n1
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1_rN2__rN1() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1, required int n2});
}
augment class A {
augment A.named({required int n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n2 (nameOffset:51) (firstTokenOffset:38) (offset:51)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:73) (firstTokenOffset:59) (offset:73)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:89) (firstTokenOffset:79) (offset:89)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 87
periodOffset: 88
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:109) (firstTokenOffset:96) (offset:109)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:89)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
#E1 requiredNamed n2
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN1_rN2__rN1__rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n1, required int n2});
}
augment class A {
augment A.named({required int n1});
}
augment class A {
augment A.named({required int n1, required int n2});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n2 (nameOffset:51) (firstTokenOffset:38) (offset:51)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:73) (firstTokenOffset:59) (offset:73)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:89) (firstTokenOffset:79) (offset:89)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 87
periodOffset: 88
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:109) (firstTokenOffset:96) (offset:109)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F4
nextFragment: #F10
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:89)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F6
nextFragment: #F11
nextFragment: #F12
previousFragment: #F3
#F9 isAugmentation class A (nameOffset:131) (firstTokenOffset:117) (offset:131)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F12 isAugmentation isOriginDeclaration named (nameOffset:147) (firstTokenOffset:137) (offset:147)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 145
periodOffset: 146
formalParameters
#F10 requiredNamed isOriginDeclaration n1 (nameOffset:167) (firstTokenOffset:154) (offset:167)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F5
#F11 requiredNamed isOriginDeclaration n2 (nameOffset:184) (firstTokenOffset:171) (offset:184)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F4
type: int
#E1 requiredNamed n2
firstFragment: #F6
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rN2_rN1__rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
A.named({required int n2, required int n1});
}
augment class A {
augment A.named({required int n1, required int n2});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredNamed isOriginDeclaration n2 (nameOffset:34) (firstTokenOffset:21) (offset:34)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:51) (firstTokenOffset:38) (offset:51)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:73) (firstTokenOffset:59) (offset:73)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:89) (firstTokenOffset:79) (offset:89)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 87
periodOffset: 88
formalParameters
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:109) (firstTokenOffset:96) (offset:109)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
#F5 requiredNamed isOriginDeclaration n2 (nameOffset:126) (firstTokenOffset:113) (offset:126)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredNamed n2
firstFragment: #F4
type: int
#E1 requiredNamed n1
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rn__rn() async {
var library = await buildLibrary(r'''
import 'dart:core' as core;
class A {
A.named({core.int});
}
augment class A {
augment A.named({core.int});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
dart:core as core (nameOffset:22) (firstTokenOffset:<null>) (offset:22)
prefixes
<testLibraryFragment>::@prefix::core
fragments: @22
classes
#F1 class A (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:42) (firstTokenOffset:40) (offset:42)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 40
periodOffset: 41
formalParameters
#F4 optionalNamed isOriginDeclaration <null-name> (nameOffset:<null>) (firstTokenOffset:49) (offset:49)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::<null-name>
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:77) (firstTokenOffset:63) (offset:77)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:93) (firstTokenOffset:83) (offset:93)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 91
periodOffset: 92
formalParameters
#F5 optionalNamed isOriginDeclaration <null-name> (nameOffset:<null>) (firstTokenOffset:100) (offset:100)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::<null-name>
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalNamed <null-name>
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__fP1() async {
var library = await buildLibrary(r'''
class A {
final int p1;
A(int p1);
}
augment class A {
augment A(this.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration p1 (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::p1
inducedGetter: #F4
constructors
#F5 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 28
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
getters
#F4 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::p1
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:55) (firstTokenOffset:41) (offset:55)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:61) (offset:69)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 69
formalParameters
#F7 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:76) (firstTokenOffset:71) (offset:76)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::A::@field::p1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.p1
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::p1
getters
isOriginVariable p1
reference: <testLibrary>::@class::A::@getter::p1
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__fP1__rP1() async {
var library = await buildLibrary(r'''
class A {
final int p1;
A(int p1);
}
augment class A {
augment A(this.p1);
}
augment class A {
augment A(int p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration p1 (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::p1
inducedGetter: #F4
constructors
#F5 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 28
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
getters
#F4 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::p1
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:55) (firstTokenOffset:41) (offset:55)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
constructors
#F8 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:61) (offset:69)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 69
formalParameters
#F7 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:76) (firstTokenOffset:71) (offset:76)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F6
nextFragment: #F10
nextFragment: #F11
previousFragment: #F5
#F9 isAugmentation class A (nameOffset:97) (firstTokenOffset:83) (offset:97)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F11 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:103) (offset:111)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 111
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:117) (firstTokenOffset:113) (offset:117)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::A::@field::p1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.p1
firstFragment: #F6
type: int
field: <testLibrary>::@class::A::@field::p1
getters
isOriginVariable p1
reference: <testLibrary>::@class::A::@getter::p1
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__fP1_int_nothing_nothing() async {
var library = await buildLibrary(r'''
class A {
final int p1;
A(p1);
augment A(this.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration p1 (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::p1
inducedGetter: #F3
constructors
#F4 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 28
formalParameters
#F5 requiredPositional hasImplicitType isOriginDeclaration p1 (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
nextFragment: #F6
nextFragment: #F7
#F7 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:37) (offset:45)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 45
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:52) (firstTokenOffset:47) (offset:52)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F5
previousFragment: #F4
getters
#F3 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::p1
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::A::@field::p1
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.p1
firstFragment: #F5
type: dynamic
field: <testLibrary>::@class::A::@field::p1
getters
isOriginVariable p1
reference: <testLibrary>::@class::A::@getter::p1
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rN1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1);
}
augment class A {
augment A.named({required int n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:61) (firstTokenOffset:51) (offset:61)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 59
periodOffset: 60
formalParameters
#F5 requiredPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:81) (firstTokenOffset:68) (offset:81)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rn1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1);
}
augment class A {
augment A.named({int n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 optionalNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:61) (firstTokenOffset:51) (offset:61)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 59
periodOffset: 60
formalParameters
#F5 requiredPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 optionalNamed isOriginDeclaration n1 (nameOffset:72) (firstTokenOffset:68) (offset:72)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp1__rN1() async {
var library = await buildLibrary(r'''
class A {
A.named([int p1]);
}
augment class A {
augment A.named({required int n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 optionalPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:83) (firstTokenOffset:70) (offset:83)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp1__rn1() async {
var library = await buildLibrary(r'''
class A {
A.named([int p1]);
}
augment class A {
augment A.named({int n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 optionalNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 optionalPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 optionalNamed isOriginDeclaration n1 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rP1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1);
}
augment class A {
augment A.named(int p1);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:61) (firstTokenOffset:51) (offset:61)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 59
periodOffset: 60
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:71) (firstTokenOffset:67) (offset:71)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rp1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1);
}
augment class A {
augment A.named([int p1]);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:61) (firstTokenOffset:51) (offset:61)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 59
periodOffset: 60
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:72) (firstTokenOffset:68) (offset:72)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp1__rP1() async {
var library = await buildLibrary(r'''
class A {
A.named([int p1]);
}
augment class A {
augment A.named(int p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:73) (firstTokenOffset:69) (offset:73)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp1__rp1() async {
var library = await buildLibrary(r'''
class A {
A.named([int p1]);
}
augment class A {
augment A.named([int p1]);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rP1__rP1_rP2() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1);
}
augment class A {
augment A.named(int p1);
}
augment class A {
augment A.named(int p1, int p2);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:61) (firstTokenOffset:51) (offset:61)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 59
periodOffset: 60
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:71) (firstTokenOffset:67) (offset:71)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
nextFragment: #F10
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
nextFragment: #F11
nextFragment: #F12
previousFragment: #F3
#F9 isAugmentation class A (nameOffset:92) (firstTokenOffset:78) (offset:92)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F12 isAugmentation isOriginDeclaration named (nameOffset:108) (firstTokenOffset:98) (offset:108)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 106
periodOffset: 107
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:118) (firstTokenOffset:114) (offset:118)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F5
#F11 requiredPositional isOriginDeclaration p2 (nameOffset:126) (firstTokenOffset:122) (offset:126)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rP1_differentType() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1);
}
augment class A {
augment A.named(double p1);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:61) (firstTokenOffset:51) (offset:61)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 59
periodOffset: 60
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:74) (firstTokenOffset:67) (offset:74)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp1__rp1_differentType() async {
var library = await buildLibrary(r'''
class A {
A.named([int p1]);
}
augment class A {
augment A.named([double p1]);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:77) (firstTokenOffset:70) (offset:77)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rP1_rP2() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1);
}
augment class A {
augment A.named(int p1, int p2);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:61) (firstTokenOffset:51) (offset:61)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 59
periodOffset: 60
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:71) (firstTokenOffset:67) (offset:71)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredPositional isOriginDeclaration p2 (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp1__rp1_rp2() async {
var library = await buildLibrary(r'''
class A {
A.named([int p1]);
}
augment class A {
augment A.named([int p1, int p2]);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 optionalPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 61
periodOffset: 62
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 optionalPositional isOriginDeclaration p2 (nameOffset:82) (firstTokenOffset:78) (offset:82)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rP1ft() async {
var library = await buildLibrary(r'''
class A {
A.named(void Function(int) p1);
}
augment class A {
augment A.named(void p1(int a));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:39) (firstTokenOffset:20) (offset:39)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:60) (firstTokenOffset:46) (offset:60)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:76) (firstTokenOffset:66) (offset:76)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 74
periodOffset: 75
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:87) (firstTokenOffset:82) (offset:87)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: void Function(int)
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rP2() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1);
}
augment class A {
augment A.named(int p2);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:61) (firstTokenOffset:51) (offset:61)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 59
periodOffset: 60
formalParameters
#F5 requiredPositional isOriginDeclaration p2 (nameOffset:71) (firstTokenOffset:67) (offset:71)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__rPw__rP1() async {
var library = await buildLibrary(r'''
class A {
A(int x);
}
augment class A {
augment A(int _);
}
augment class A {
augment A(int x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F4 requiredPositional isOriginDeclaration x (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:38) (firstTokenOffset:24) (offset:38)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
constructors
#F6 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:44) (offset:52)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 52
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
previousFragment: #F4
nextFragment: #F8
nextFragment: #F9
previousFragment: #F3
#F7 isAugmentation class A (nameOffset:78) (firstTokenOffset:64) (offset:78)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F9 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:84) (offset:92)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 92
formalParameters
#F8 requiredPositional isOriginDeclaration x (nameOffset:98) (firstTokenOffset:94) (offset:98)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
previousFragment: #F5
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
formalParameters
#E0 requiredPositional x
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__sP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
B(int p1);
}
augment class B {
augment B(super.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F7 requiredPositional isOriginDeclaration p1 (nameOffset:53) (firstTokenOffset:49) (offset:53)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F8
nextFragment: #F9
#F5 isAugmentation class B (nameOffset:74) (firstTokenOffset:60) (offset:74)
element: <testLibrary>::@class::B
previousFragment: #F4
constructors
#F9 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:80) (offset:88)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 88
formalParameters
#F8 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:96) (firstTokenOffset:90) (offset:96)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F7
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 requiredPositional isFinal super.p1
firstFragment: #F7
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__sP1__rP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
B(int p1);
}
augment class B {
augment B(super.p1);
}
augment class B {
augment B(int p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F7 requiredPositional isOriginDeclaration p1 (nameOffset:53) (firstTokenOffset:49) (offset:53)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F8
nextFragment: #F9
#F5 isAugmentation class B (nameOffset:74) (firstTokenOffset:60) (offset:74)
element: <testLibrary>::@class::B
previousFragment: #F4
nextFragment: #F10
constructors
#F9 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:80) (offset:88)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 88
formalParameters
#F8 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:96) (firstTokenOffset:90) (offset:96)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F7
nextFragment: #F11
nextFragment: #F12
previousFragment: #F6
#F10 isAugmentation class B (nameOffset:117) (firstTokenOffset:103) (offset:117)
element: <testLibrary>::@class::B
previousFragment: #F5
constructors
#F12 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:123) (offset:131)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 131
formalParameters
#F11 requiredPositional isOriginDeclaration p1 (nameOffset:137) (firstTokenOffset:133) (offset:137)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F8
previousFragment: #F9
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 requiredPositional isFinal super.p1
firstFragment: #F7
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1__sP1_int_nothing_nothing() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
B(p1);
augment B(super.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
constructors
#F5 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F6 requiredPositional hasImplicitType isOriginDeclaration p1 (nameOffset:49) (firstTokenOffset:49) (offset:49)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
#F8 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:56) (offset:64)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 64
formalParameters
#F7 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:72) (firstTokenOffset:66) (offset:72)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.p1
firstFragment: #F6
type: dynamic
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp1__sp1_intQ_nothing_nothing() async {
var library = await buildLibrary(r'''
class A {
A([int? p1]);
}
class B extends A {
B([p1]);
augment B([super.p1]);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 optionalPositional isOriginDeclaration p1 (nameOffset:20) (firstTokenOffset:15) (offset:20)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::B
constructors
#F5 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:50) (offset:50)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 50
formalParameters
#F6 optionalPositional hasImplicitType isOriginDeclaration p1 (nameOffset:53) (firstTokenOffset:53) (offset:53)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
#F8 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:61) (offset:69)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 69
formalParameters
#F7 optionalPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:78) (firstTokenOffset:72) (offset:78)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 optionalPositional p1
firstFragment: #F3
type: int?
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 optionalPositional hasImplicitType isFinal super.p1
firstFragment: #F6
type: dynamic
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rN1__rP1__rP1_rN1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, {required int n1});
}
augment class A {
augment A.named(int p1);
}
augment class A {
augment A.named(int p1, {required int n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:42) (firstTokenOffset:29) (offset:42)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:64) (firstTokenOffset:50) (offset:64)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:80) (firstTokenOffset:70) (offset:80)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 78
periodOffset: 79
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:90) (firstTokenOffset:86) (offset:90)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
nextFragment: #F10
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:80)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
nextFragment: #F11
nextFragment: #F12
previousFragment: #F3
#F9 isAugmentation class A (nameOffset:111) (firstTokenOffset:97) (offset:111)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F12 isAugmentation isOriginDeclaration named (nameOffset:127) (firstTokenOffset:117) (offset:127)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 125
periodOffset: 126
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:137) (firstTokenOffset:133) (offset:137)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F5
#F11 requiredNamed isOriginDeclaration n1 (nameOffset:155) (firstTokenOffset:142) (offset:155)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredNamed n1
firstFragment: #F6
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rN1__rP1__rP1_rP2_rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, {required int n1});
}
augment class A {
augment A.named(int p1);
}
augment class A {
augment A.named(int p1, int p2, {required int n1, required int n2});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:42) (firstTokenOffset:29) (offset:42)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F9
#F10 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
nextFragment: #F11
nextFragment: #F12
#F2 isAugmentation class A (nameOffset:64) (firstTokenOffset:50) (offset:64)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F13
constructors
#F12 isAugmentation isOriginDeclaration named (nameOffset:80) (firstTokenOffset:70) (offset:80)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 78
periodOffset: 79
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:90) (firstTokenOffset:86) (offset:90)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
nextFragment: #F14
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:80)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
nextFragment: #F15
#F9 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:80)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F8
nextFragment: #F16
#F11 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:80)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F10
nextFragment: #F17
nextFragment: #F18
previousFragment: #F3
#F13 isAugmentation class A (nameOffset:111) (firstTokenOffset:97) (offset:111)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F18 isAugmentation isOriginDeclaration named (nameOffset:127) (firstTokenOffset:117) (offset:127)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 125
periodOffset: 126
formalParameters
#F14 requiredPositional isOriginDeclaration p1 (nameOffset:137) (firstTokenOffset:133) (offset:137)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F5
#F15 requiredPositional isOriginDeclaration p2 (nameOffset:145) (firstTokenOffset:141) (offset:145)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F7
#F16 requiredNamed isOriginDeclaration n1 (nameOffset:163) (firstTokenOffset:150) (offset:163)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F9
#F17 requiredNamed isOriginDeclaration n2 (nameOffset:180) (firstTokenOffset:167) (offset:180)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F11
previousFragment: #F12
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredNamed n1
firstFragment: #F8
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rN1__rP1_rN1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, {required int n1});
}
augment class A {
augment A.named(int p1, {required int n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:42) (firstTokenOffset:29) (offset:42)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:64) (firstTokenOffset:50) (offset:64)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:80) (firstTokenOffset:70) (offset:80)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 78
periodOffset: 79
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:90) (firstTokenOffset:86) (offset:90)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:108) (firstTokenOffset:95) (offset:108)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredNamed n1
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rN1__rP1_rN1_differentType() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, {required int n1});
}
augment class A {
augment A.named(double p1, {required double n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:42) (firstTokenOffset:29) (offset:42)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:64) (firstTokenOffset:50) (offset:64)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:80) (firstTokenOffset:70) (offset:80)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 78
periodOffset: 79
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:93) (firstTokenOffset:86) (offset:93)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:114) (firstTokenOffset:98) (offset:114)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredNamed n1
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rN1__rP1_rP2_rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, {required int n1});
}
augment class A {
augment A.named(int p1, int p2, {required int n1, required int n2});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:42) (firstTokenOffset:29) (offset:42)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F9
#F10 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
nextFragment: #F11
nextFragment: #F12
#F2 isAugmentation class A (nameOffset:64) (firstTokenOffset:50) (offset:64)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F12 isAugmentation isOriginDeclaration named (nameOffset:80) (firstTokenOffset:70) (offset:80)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 78
periodOffset: 79
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:90) (firstTokenOffset:86) (offset:90)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredPositional isOriginDeclaration p2 (nameOffset:98) (firstTokenOffset:94) (offset:98)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
#F9 requiredNamed isOriginDeclaration n1 (nameOffset:116) (firstTokenOffset:103) (offset:116)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F8
#F11 requiredNamed isOriginDeclaration n2 (nameOffset:133) (firstTokenOffset:120) (offset:133)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F10
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredNamed n1
firstFragment: #F8
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rP2__rP1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, int p2);
}
augment class A {
augment A.named(int p1);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredPositional isOriginDeclaration p2 (nameOffset:32) (firstTokenOffset:28) (offset:32)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 67
periodOffset: 68
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:69)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredPositional p2
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp1_rp2__rp1() async {
var library = await buildLibrary(r'''
class A {
A.named([int p1, int p2]);
}
augment class A {
augment A.named([int p1]);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 optionalPositional isOriginDeclaration p2 (nameOffset:33) (firstTokenOffset:29) (offset:33)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:55) (firstTokenOffset:41) (offset:55)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:71) (firstTokenOffset:61) (offset:71)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 69
periodOffset: 70
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:82) (firstTokenOffset:78) (offset:82)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 optionalPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F4
type: int
#E1 optionalPositional p2
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rP2__rP1__rP1_rP2() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, int p2);
}
augment class A {
augment A.named(int p1);
}
augment class A {
augment A.named(int p1, int p2);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredPositional isOriginDeclaration p2 (nameOffset:32) (firstTokenOffset:28) (offset:32)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 67
periodOffset: 68
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
nextFragment: #F10
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:69)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
nextFragment: #F11
nextFragment: #F12
previousFragment: #F3
#F9 isAugmentation class A (nameOffset:100) (firstTokenOffset:86) (offset:100)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F12 isAugmentation isOriginDeclaration named (nameOffset:116) (firstTokenOffset:106) (offset:116)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 114
periodOffset: 115
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:126) (firstTokenOffset:122) (offset:126)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F5
#F11 requiredPositional isOriginDeclaration p2 (nameOffset:134) (firstTokenOffset:130) (offset:134)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredPositional p2
firstFragment: #F6
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rP2__rP2_rP1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, int p2);
}
augment class A {
augment A.named(int p2, int p1);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredPositional isOriginDeclaration p2 (nameOffset:32) (firstTokenOffset:28) (offset:32)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 67
periodOffset: 68
formalParameters
#F5 requiredPositional isOriginDeclaration p2 (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredPositional isOriginDeclaration p1 (nameOffset:87) (firstTokenOffset:83) (offset:87)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredPositional p2
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1_rP2_rN1_rN2__rP1_rN1() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1, int p2, {required int n1, required int n2});
}
augment class A {
augment A.named(int p1, {required int n1});
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
#F6 requiredPositional isOriginDeclaration p2 (nameOffset:32) (firstTokenOffset:28) (offset:32)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F7
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:50) (firstTokenOffset:37) (offset:50)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
nextFragment: #F9
#F10 requiredNamed isOriginDeclaration n2 (nameOffset:67) (firstTokenOffset:54) (offset:67)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
nextFragment: #F11
nextFragment: #F12
#F2 isAugmentation class A (nameOffset:89) (firstTokenOffset:75) (offset:89)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F12 isAugmentation isOriginDeclaration named (nameOffset:105) (firstTokenOffset:95) (offset:105)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 103
periodOffset: 104
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:115) (firstTokenOffset:111) (offset:115)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:105)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F6
#F9 requiredNamed isOriginDeclaration n1 (nameOffset:133) (firstTokenOffset:120) (offset:133)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n1
previousFragment: #F8
#F11 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:105)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::n2
previousFragment: #F10
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int
#E1 requiredPositional p2
firstFragment: #F6
type: int
#E2 requiredNamed n1
firstFragment: #F8
type: int
#E3 requiredNamed n2
firstFragment: #F10
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1ft__fP1ft() async {
var library = await buildLibrary(r'''
class A {
final void Function(int) p1;
A(void p1(int a));
}
augment class A {
augment A(void this.p1(int a));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isFinal isOriginDeclaration p1 (nameOffset:37) (firstTokenOffset:37) (offset:37)
element: <testLibrary>::@class::A::@field::p1
inducedGetter: #F4
constructors
#F5 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:43) (offset:43)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 43
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:50) (firstTokenOffset:45) (offset:50)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
getters
#F4 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::A::@getter::p1
inducingVariable: #F3
#F2 isAugmentation class A (nameOffset:78) (firstTokenOffset:64) (offset:78)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:84) (offset:92)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 92
formalParameters
#F7 requiredPositional isFinal isOriginDeclaration this.p1 (nameOffset:104) (firstTokenOffset:94) (offset:104)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::A::@field::p1
firstFragment: #F3
type: void Function(int)
getter: <testLibrary>::@class::A::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.p1
firstFragment: #F6
type: void Function(int)
field: <testLibrary>::@class::A::@field::p1
getters
isOriginVariable p1
reference: <testLibrary>::@class::A::@getter::p1
firstFragment: #F4
returnType: void Function(int)
variable: <testLibrary>::@class::A::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1ft__rP1() async {
var library = await buildLibrary(r'''
class A {
A.named(void p1(int a));
}
augment class A {
augment A.named(void Function(int) p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:20) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 67
periodOffset: 68
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:94) (firstTokenOffset:75) (offset:94)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: void Function(int)
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1ft__rP1ft() async {
var library = await buildLibrary(r'''
class A {
A.named(void p1(int a));
}
augment class A {
augment A.named(void p1(int a));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:20) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 67
periodOffset: 68
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:80) (firstTokenOffset:75) (offset:80)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: void Function(int)
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1ft__rP1ft_differentType() async {
var library = await buildLibrary(r'''
class A {
A.named(void p1(int a));
}
augment class A {
augment A.named(void p1(double a));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:20) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 67
periodOffset: 68
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:80) (firstTokenOffset:75) (offset:80)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: void Function(int)
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1ft__sP1ft() async {
var library = await buildLibrary(r'''
class A {
A(void p1(int a));
}
class B extends A {
B(void p1(int a));
}
augment class B {
augment B(void super.p1(int a));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:19) (firstTokenOffset:14) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:55) (offset:55)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 55
formalParameters
#F7 requiredPositional isOriginDeclaration p1 (nameOffset:62) (firstTokenOffset:57) (offset:62)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F8
nextFragment: #F9
#F5 isAugmentation class B (nameOffset:90) (firstTokenOffset:76) (offset:90)
element: <testLibrary>::@class::B
previousFragment: #F4
constructors
#F9 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:96) (offset:104)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 104
formalParameters
#F8 requiredPositional isFinal isOriginDeclaration super.p1 (nameOffset:117) (firstTokenOffset:106) (offset:117)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F7
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: void Function(int)
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 requiredPositional isFinal super.p1
firstFragment: #F7
type: void Function(int)
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rP1ftt__rP1ftt() async {
var library = await buildLibrary(r'''
class A {
A.named(int p1<T>(T a));
}
augment class A {
augment A.named(int p1<T>(T a));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 requiredPositional isOriginDeclaration p1 (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 67
periodOffset: 68
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F4
type: int Function<T>(T)
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rp2_rp1__rp1_rp2() async {
var library = await buildLibrary(r'''
class A {
A.named([int p2, int p1]);
}
augment class A {
augment A.named([int p1, int p2]);
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
formalParameters
#F4 optionalPositional isOriginDeclaration p2 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
nextFragment: #F5
#F6 optionalPositional isOriginDeclaration p1 (nameOffset:33) (firstTokenOffset:29) (offset:33)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:55) (firstTokenOffset:41) (offset:55)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isOriginDeclaration named (nameOffset:71) (firstTokenOffset:61) (offset:71)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 69
periodOffset: 70
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:82) (firstTokenOffset:78) (offset:82)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p2
previousFragment: #F4
#F7 optionalPositional isOriginDeclaration p2 (nameOffset:90) (firstTokenOffset:86) (offset:90)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::p1
previousFragment: #F6
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E0 optionalPositional p2
firstFragment: #F4
type: int
#E1 optionalPositional p1
firstFragment: #F6
type: int
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rPw__rP1__rPw() async {
var library = await buildLibrary(r'''
class A {
A(int _);
}
augment class A {
augment A(int x);
}
augment class A {
augment A(int _);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F4 requiredPositional isOriginDeclaration _ (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:38) (firstTokenOffset:24) (offset:38)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
constructors
#F6 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:44) (offset:52)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 52
formalParameters
#F5 requiredPositional isOriginDeclaration x (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
previousFragment: #F4
nextFragment: #F8
nextFragment: #F9
previousFragment: #F3
#F7 isAugmentation class A (nameOffset:78) (firstTokenOffset:64) (offset:78)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F9 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:84) (offset:92)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 92
formalParameters
#F8 requiredPositional isOriginDeclaration _ (nameOffset:98) (firstTokenOffset:94) (offset:98)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
previousFragment: #F5
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
formalParameters
#E0 requiredPositional x
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_rPw__rPw() async {
var library = await buildLibrary(r'''
class A {
A(int _);
}
augment class A {
augment A(int _);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F4 requiredPositional isOriginDeclaration _ (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::_
nextFragment: #F5
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:38) (firstTokenOffset:24) (offset:38)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:44) (offset:52)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 52
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::_
previousFragment: #F4
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
formalParameters
#E0 requiredPositional _
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_sN1__rN1__sN1() async {
var library = await buildLibrary(r'''
class A {
A({required int n1});
}
class B extends A {
B({required super.n1});
}
augment class B {
augment B({required int n1});
}
augment class B {
augment B({required super.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration n1 (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
#F4 hasExtendsClause class B (nameOffset:42) (firstTokenOffset:36) (offset:42)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:58) (offset:58)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 58
formalParameters
#F7 requiredNamed hasImplicitType isFinal isOriginDeclaration super.n1 (nameOffset:76) (firstTokenOffset:61) (offset:76)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
nextFragment: #F8
nextFragment: #F9
#F5 isAugmentation class B (nameOffset:98) (firstTokenOffset:84) (offset:98)
element: <testLibrary>::@class::B
previousFragment: #F4
nextFragment: #F10
constructors
#F9 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:104) (offset:112)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 112
formalParameters
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:128) (firstTokenOffset:115) (offset:128)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
previousFragment: #F7
nextFragment: #F11
nextFragment: #F12
previousFragment: #F6
#F10 isAugmentation class B (nameOffset:150) (firstTokenOffset:136) (offset:150)
element: <testLibrary>::@class::B
previousFragment: #F5
constructors
#F12 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:156) (offset:164)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 164
formalParameters
#F11 requiredNamed hasImplicitType isFinal isOriginDeclaration super.n1 (nameOffset:182) (firstTokenOffset:167) (offset:182)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
previousFragment: #F8
previousFragment: #F9
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed n1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 requiredNamed hasImplicitType isFinal super.n1
firstFragment: #F7
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_sn1__rn1__sn1() async {
var library = await buildLibrary(r'''
class A {
A({int n1 = 0});
}
class B extends A {
B({super.n1});
}
augment class B {
augment B({int n1});
}
augment class B {
augment B({super.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 optionalNamed isOriginDeclaration n1 (nameOffset:19) (firstTokenOffset:15) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
initializer: expression_0
IntegerLiteral
literal: 0 @24
staticType: int
#F4 hasExtendsClause class B (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:53) (offset:53)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 53
formalParameters
#F7 optionalNamed hasImplicitType isFinal isOriginDeclaration super.n1 (nameOffset:62) (firstTokenOffset:56) (offset:62)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
nextFragment: #F8
nextFragment: #F9
#F5 isAugmentation class B (nameOffset:84) (firstTokenOffset:70) (offset:84)
element: <testLibrary>::@class::B
previousFragment: #F4
nextFragment: #F10
constructors
#F9 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:90) (offset:98)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 98
formalParameters
#F8 optionalNamed isOriginDeclaration n1 (nameOffset:105) (firstTokenOffset:101) (offset:105)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
previousFragment: #F7
nextFragment: #F11
nextFragment: #F12
previousFragment: #F6
#F10 isAugmentation class B (nameOffset:127) (firstTokenOffset:113) (offset:127)
element: <testLibrary>::@class::B
previousFragment: #F5
constructors
#F12 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:133) (offset:141)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 141
formalParameters
#F11 optionalNamed hasImplicitType isFinal isOriginDeclaration super.n1 (nameOffset:150) (firstTokenOffset:144) (offset:150)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
previousFragment: #F8
previousFragment: #F9
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 optionalNamed hasDefaultValue n1
firstFragment: #F3
type: int
constantInitializer
fragment: #F3
expression: expression_0
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 optionalNamed hasDefaultValue hasImplicitType isFinal super.n1
firstFragment: #F7
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_sN1__rN2__sN1() async {
var library = await buildLibrary(r'''
class A {
A({required int n1});
}
class B extends A {
B({required super.n1});
}
augment class B {
augment B({required int n2});
}
augment class B {
augment B({required super.n1});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration n1 (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
#F4 hasExtendsClause class B (nameOffset:42) (firstTokenOffset:36) (offset:42)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:58) (offset:58)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 58
formalParameters
#F7 requiredNamed hasImplicitType isFinal isOriginDeclaration super.n1 (nameOffset:76) (firstTokenOffset:61) (offset:76)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
nextFragment: #F8
#F9 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:58)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n2
nextFragment: #F10
nextFragment: #F11
#F5 isAugmentation class B (nameOffset:98) (firstTokenOffset:84) (offset:98)
element: <testLibrary>::@class::B
previousFragment: #F4
nextFragment: #F12
constructors
#F11 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:104) (offset:112)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 112
formalParameters
#F10 requiredNamed isOriginDeclaration n2 (nameOffset:128) (firstTokenOffset:115) (offset:128)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n2
previousFragment: #F9
nextFragment: #F13
#F8 requiredNamed isFinal isOriginOtherFragmentOfEnclosing super.n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:112)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
previousFragment: #F7
nextFragment: #F14
nextFragment: #F15
previousFragment: #F6
#F12 isAugmentation class B (nameOffset:150) (firstTokenOffset:136) (offset:150)
element: <testLibrary>::@class::B
previousFragment: #F5
constructors
#F15 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:156) (offset:164)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 164
formalParameters
#F14 requiredNamed hasImplicitType isFinal isOriginDeclaration super.n1 (nameOffset:182) (firstTokenOffset:167) (offset:182)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n1
previousFragment: #F8
#F13 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:164)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::n2
previousFragment: #F10
previousFragment: #F11
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed n1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 requiredNamed hasImplicitType isFinal super.n1
firstFragment: #F7
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::n1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_sP1__fP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
final int p1;
B(super.p1);
}
augment class B {
augment B(this.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
fields
#F6 isFinal isOriginDeclaration p1 (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: <testLibrary>::@class::B::@field::p1
inducedGetter: #F7
constructors
#F8 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:63) (offset:63)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 63
formalParameters
#F9 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:71) (firstTokenOffset:65) (offset:71)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F10
nextFragment: #F11
getters
#F7 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::B::@getter::p1
inducingVariable: #F6
#F5 isAugmentation class B (nameOffset:92) (firstTokenOffset:78) (offset:92)
element: <testLibrary>::@class::B
previousFragment: #F4
constructors
#F11 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:98) (offset:106)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 106
formalParameters
#F10 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:113) (firstTokenOffset:108) (offset:113)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F9
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::B::@field::p1
firstFragment: #F6
type: int
getter: <testLibrary>::@class::B::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.p1
firstFragment: #F9
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable p1
reference: <testLibrary>::@class::B::@getter::p1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::B::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_sP1__rP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
B(super.p1);
}
augment class B {
augment B(int p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F7 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:55) (firstTokenOffset:49) (offset:55)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F8
nextFragment: #F9
#F5 isAugmentation class B (nameOffset:76) (firstTokenOffset:62) (offset:76)
element: <testLibrary>::@class::B
previousFragment: #F4
constructors
#F9 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:82) (offset:90)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 90
formalParameters
#F8 requiredPositional isOriginDeclaration p1 (nameOffset:96) (firstTokenOffset:92) (offset:96)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F7
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.p1
firstFragment: #F7
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_sP1__rP1__fP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
final int p1;
B(super.p1);
}
augment class B {
augment B(int p1);
}
augment class B {
augment B(this.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
fields
#F6 isFinal isOriginDeclaration p1 (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: <testLibrary>::@class::B::@field::p1
inducedGetter: #F7
constructors
#F8 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:63) (offset:63)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 63
formalParameters
#F9 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:71) (firstTokenOffset:65) (offset:71)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F10
nextFragment: #F11
getters
#F7 isComplete isOriginVariable p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::B::@getter::p1
inducingVariable: #F6
#F5 isAugmentation class B (nameOffset:92) (firstTokenOffset:78) (offset:92)
element: <testLibrary>::@class::B
previousFragment: #F4
nextFragment: #F12
constructors
#F11 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:98) (offset:106)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 106
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:112) (firstTokenOffset:108) (offset:112)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F9
nextFragment: #F13
nextFragment: #F14
previousFragment: #F8
#F12 isAugmentation class B (nameOffset:133) (firstTokenOffset:119) (offset:133)
element: <testLibrary>::@class::B
previousFragment: #F5
constructors
#F14 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:139) (offset:147)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 147
formalParameters
#F13 requiredPositional hasImplicitType isFinal isOriginDeclaration this.p1 (nameOffset:154) (firstTokenOffset:149) (offset:154)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F10
previousFragment: #F11
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
fields
isFinal isOriginDeclaration p1
reference: <testLibrary>::@class::B::@field::p1
firstFragment: #F6
type: int
getter: <testLibrary>::@class::B::@getter::p1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.p1
firstFragment: #F9
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable p1
reference: <testLibrary>::@class::B::@getter::p1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::B::@field::p1
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_sP1__rP1__sP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
B(super.p1);
}
augment class B {
augment B(int p1);
}
augment class B {
augment B(super.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F7 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:55) (firstTokenOffset:49) (offset:55)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F8
nextFragment: #F9
#F5 isAugmentation class B (nameOffset:76) (firstTokenOffset:62) (offset:76)
element: <testLibrary>::@class::B
previousFragment: #F4
nextFragment: #F10
constructors
#F9 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:82) (offset:90)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 90
formalParameters
#F8 requiredPositional isOriginDeclaration p1 (nameOffset:96) (firstTokenOffset:92) (offset:96)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F7
nextFragment: #F11
nextFragment: #F12
previousFragment: #F6
#F10 isAugmentation class B (nameOffset:117) (firstTokenOffset:103) (offset:117)
element: <testLibrary>::@class::B
previousFragment: #F5
constructors
#F12 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:123) (offset:131)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 131
formalParameters
#F11 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:139) (firstTokenOffset:133) (offset:139)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F8
previousFragment: #F9
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.p1
firstFragment: #F7
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_formalParameters_sP1__sP1() async {
var library = await buildLibrary(r'''
class A {
A(int p1);
}
class B extends A {
B(super.p1);
}
augment class B {
augment B(super.p1);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration p1 (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
nextFragment: #F5
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F7 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:55) (firstTokenOffset:49) (offset:55)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
nextFragment: #F8
nextFragment: #F9
#F5 isAugmentation class B (nameOffset:76) (firstTokenOffset:62) (offset:76)
element: <testLibrary>::@class::B
previousFragment: #F4
constructors
#F9 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:82) (offset:90)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 90
formalParameters
#F8 requiredPositional hasImplicitType isFinal isOriginDeclaration super.p1 (nameOffset:98) (firstTokenOffset:92) (offset:98)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::p1
previousFragment: #F7
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p1
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.p1
firstFragment: #F7
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::p1
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_isComplete_factory() async {
var library = await buildLibrary(r'''
class A {
factory A();
}
augment class A {
augment factory A() => throw 0;
}
augment class A {
augment factory A();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isFactory isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@constructor::new
factoryKeywordOffset: 12
typeName: A
typeNameOffset: 20
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F5
constructors
#F4 isAugmentation isComplete isFactory isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:48) (offset:64)
element: <testLibrary>::@class::A::@constructor::new
factoryKeywordOffset: 56
typeName: A
typeNameOffset: 64
nextFragment: #F6
previousFragment: #F3
#F5 isAugmentation class A (nameOffset:97) (firstTokenOffset:83) (offset:97)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F6 isAugmentation isFactory isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:103) (offset:119)
element: <testLibrary>::@class::A::@constructor::new
factoryKeywordOffset: 111
typeName: A
typeNameOffset: 119
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isFactory isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_chain_isComplete_generative() async {
var library = await buildLibrary(r'''
class A {
A();
}
augment class A {
augment A() {}
}
augment class A {
augment A();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:34) (firstTokenOffset:20) (offset:34)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F5
constructors
#F4 isAugmentation isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:40) (offset:48)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 48
nextFragment: #F6
previousFragment: #F3
#F5 isAugmentation class A (nameOffset:72) (firstTokenOffset:58) (offset:72)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F6 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:78) (offset:86)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 86
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_chain_isExternal_factory() async {
var library = await buildLibrary(r'''
class A {
factory A();
}
augment class A {
augment external factory A();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isFactory isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@constructor::new
factoryKeywordOffset: 12
typeName: A
typeNameOffset: 20
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isComplete isExternal isFactory isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:48) (offset:73)
element: <testLibrary>::@class::A::@constructor::new
factoryKeywordOffset: 65
typeName: A
typeNameOffset: 73
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isExternal isFactory isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_chain_isExternal_generative() async {
var library = await buildLibrary(r'''
class A {
A();
}
augment class A {
augment external A();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:34) (firstTokenOffset:20) (offset:34)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isComplete isExternal isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:40) (offset:57)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 57
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isExternal isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_chain_named() async {
var library = await buildLibrary(r'''
class A {
A.named();
}
augment class A {
augment A.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isOriginDeclaration named (nameOffset:56) (firstTokenOffset:46) (offset:56)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 54
periodOffset: 55
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_chain_noIntroductoryDeclaration() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
augment A.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F3 isAugmentation isOriginDeclaration named (nameOffset:42) (firstTokenOffset:32) (offset:42)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 40
periodOffset: 41
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_chain_redirected_toPrimary() async {
var library = await buildLibrary(r'''
class A(int x) {
A.named(int x);
}
augment class A {
augment A.named(int x) : this(x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F4 requiredPositional isOriginDeclaration x (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x
#F5 isOriginDeclaration named (nameOffset:21) (firstTokenOffset:19) (offset:21)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 19
periodOffset: 20
formalParameters
#F6 requiredPositional isOriginDeclaration x (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::x
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:52) (firstTokenOffset:38) (offset:52)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F8 isAugmentation isComplete isOriginDeclaration isRedirecting named (nameOffset:68) (firstTokenOffset:58) (offset:68)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 66
periodOffset: 67
formalParameters
#F7 requiredPositional isOriginDeclaration x (nameOffset:78) (firstTokenOffset:74) (offset:78)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::x
previousFragment: #F6
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
formalParameters
#E0 requiredPositional x
firstFragment: #F4
type: int
isOriginDeclaration isRedirecting named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F5
formalParameters
#E1 requiredPositional x
firstFragment: #F6
type: int
redirectedConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_augmentation_chain_redirected_unresolvedTarget() async {
var library = await buildLibrary(r'''
class A {
A.named();
}
augment class A {
augment A.named() : this.missing();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isComplete isOriginDeclaration isRedirecting named (nameOffset:56) (firstTokenOffset:46) (offset:56)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 54
periodOffset: 55
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration isRedirecting named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_chain_twoDeclarations() async {
var library = await buildLibrary(r'''
class A {
A.named();
}
augment class A {
augment A.named();
}
augment class A {
augment A.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F5
constructors
#F4 isAugmentation isOriginDeclaration named (nameOffset:56) (firstTokenOffset:46) (offset:56)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 54
periodOffset: 55
nextFragment: #F6
previousFragment: #F3
#F5 isAugmentation class A (nameOffset:82) (firstTokenOffset:68) (offset:82)
element: <testLibrary>::@class::A
previousFragment: #F2
constructors
#F6 isAugmentation isOriginDeclaration named (nameOffset:98) (firstTokenOffset:88) (offset:98)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 96
periodOffset: 97
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_chain_unnamed() async {
var library = await buildLibrary(r'''
class A {
A();
}
augment class A {
augment A();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:34) (firstTokenOffset:20) (offset:34)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:40) (offset:48)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 48
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_sameName_external() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment external A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:38) (firstTokenOffset:24) (offset:38)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isComplete isExternal isOriginDeclaration foo (nameOffset:63) (firstTokenOffset:44) (offset:63)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 61
periodOffset: 62
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isExternal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
''');
}
test_constructor_secondary_augmentation_sameName_instanceField() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:41) (firstTokenOffset:27) (offset:41)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F7 isAugmentation isOriginDeclaration foo (nameOffset:57) (firstTokenOffset:47) (offset:57)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 55
periodOffset: 56
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F7
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_secondary_augmentation_sameName_instanceGetter() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F5 isAugmentation isOriginDeclaration foo (nameOffset:62) (firstTokenOffset:52) (offset:62)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 60
periodOffset: 61
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F5
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_secondary_augmentation_sameName_instanceMethod() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isOriginDeclaration foo (nameOffset:58) (firstTokenOffset:48) (offset:58)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 56
periodOffset: 57
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F4
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
returnType: void
''');
}
test_constructor_secondary_augmentation_sameName_instanceSetter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {}
}
augment class A {
augment A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
setters
#F4 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration foo (nameOffset:62) (firstTokenOffset:52) (offset:62)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 60
periodOffset: 61
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F6
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional _
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_secondary_augmentation_sameName_staticField() async {
var library = await buildLibrary(r'''
class A {
static int foo = 0;
}
augment class A {
augment A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F7 isAugmentation isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:54) (offset:64)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 62
periodOffset: 63
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F7
previousFragmentOfDifferentKind: #F3
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_secondary_augmentation_sameName_staticGetter() async {
var library = await buildLibrary(r'''
class A {
static int get foo => 0;
}
augment class A {
augment A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
getters
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F5 isAugmentation isOriginDeclaration foo (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 67
periodOffset: 68
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F5
previousFragmentOfDifferentKind: #F4
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_secondary_augmentation_sameName_staticMethod() async {
var library = await buildLibrary(r'''
class A {
static void foo() {}
}
augment class A {
augment A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F4 isAugmentation isOriginDeclaration foo (nameOffset:65) (firstTokenOffset:55) (offset:65)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 63
periodOffset: 64
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F4
previousFragmentOfDifferentKind: #F3
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
returnType: void
''');
}
test_constructor_secondary_augmentation_sameName_staticSetter() async {
var library = await buildLibrary(r'''
class A {
static set foo(int _) {}
}
augment class A {
augment A.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
setters
#F4 hasImplicitReturnType isComplete isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
constructors
#F6 isAugmentation isOriginDeclaration foo (nameOffset:69) (firstTokenOffset:59) (offset:69)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 67
periodOffset: 68
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F6
previousFragmentOfDifferentKind: #F4
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional _
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_constructor_secondary_const() async {
var library = await buildLibrary(r'''
class C {
const C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 18
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_const_external() async {
var library = await buildLibrary(r'''
class C {
external const C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isConst isExternal isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 27
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isExternal isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_documented() async {
var library = await buildLibrary(r'''
class C {
/**
* Docs
*/
C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:34)
element: <testLibrary>::@class::C::@constructor::new
documentationComment: /**\n * Docs\n */
typeName: C
typeNameOffset: 34
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
documentationComment: /**\n * Docs\n */
''');
}
test_constructor_secondary_explicit_named() async {
var library = await buildLibrary(r'''
class C {
C.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::C::@constructor::foo
typeName: C
typeNameOffset: 12
periodOffset: 13
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::C::@constructor::foo
firstFragment: #F2
''');
}
test_constructor_secondary_explicit_typeParameters() async {
var library = await buildLibrary(r'''
class C<T, U> {
C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
constructors
#F4 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 18
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
''');
}
test_constructor_secondary_explicit_unnamed() async {
var library = await buildLibrary(r'''
class C {
C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 12
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_external() async {
var library = await buildLibrary(r'''
class C {
external C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isExternal isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isExternal isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_factory() async {
var library = await buildLibrary(r'''
class C {
factory C() => throw 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 12
typeName: C
typeNameOffset: 20
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_factoryHead_named() async {
var library = await buildLibrary(r'''
class C {
factory named() => throw 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration named (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@constructor::named
factoryKeywordOffset: 12
typeName: null
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F2
''');
}
test_constructor_secondary_factoryHead_named_const() async {
var library = await buildLibrary(r'''
class C {
const factory named() = C;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isConst isFactory isOriginDeclaration isRedirecting named (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::C::@constructor::named
factoryKeywordOffset: 18
typeName: null
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isFactory isOriginDeclaration isRedirecting named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F2
''');
}
test_constructor_secondary_factoryHead_unnamed() async {
var library = await buildLibrary(r'''
class C {
factory() => throw 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 12
typeName: null
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_factoryHead_unnamed_const() async {
var library = await buildLibrary(r'''
class C {
const factory() = C;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isConst isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 18
typeName: null
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isFactory isInRedirectingConstructorCycle isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: <testLibrary>::@class::C::@constructor::new
''');
}
test_constructor_secondary_formalParameter_field_optionalNamed_noDefault() async {
var library = await buildLibrary(r'''
class C {
int x;
C({this.x});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:29) (firstTokenOffset:24) (offset:29)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 optionalNamed hasImplicitType isFinal this.x
firstFragment: #F6
type: int
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_optionalNamed_withDefault() async {
var library = await buildLibrary(r'''
class C {
int x;
C({this.x: 42});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:29) (firstTokenOffset:24) (offset:29)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
initializer: expression_0
IntegerLiteral
literal: 42 @32
staticType: int
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 optionalNamed hasDefaultValue hasImplicitType isFinal this.x
firstFragment: #F6
type: int
constantInitializer
fragment: #F6
expression: expression_0
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_optionalPositional_noDefault() async {
var library = await buildLibrary(r'''
class C {
int x;
C([this.x]);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 optionalPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:29) (firstTokenOffset:24) (offset:29)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 optionalPositional hasImplicitType isFinal this.x
firstFragment: #F6
type: int
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_optionalPositional_withDefault() async {
var library = await buildLibrary(r'''
class C {
int x;
C([this.x = 42]);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 optionalPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:29) (firstTokenOffset:24) (offset:29)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
initializer: expression_0
IntegerLiteral
literal: 42 @33
staticType: int
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 optionalPositional hasDefaultValue hasImplicitType isFinal this.x
firstFragment: #F6
type: int
constantInitializer
fragment: #F6
expression: expression_0
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldDynamic_formalDynamic() async {
var library = await buildLibrary(r'''
class C {
dynamic x;
C(dynamic this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:20) (firstTokenOffset:20) (offset:20)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 25
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.x (nameOffset:40) (firstTokenOffset:27) (offset:40)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.x
firstFragment: #F6
type: dynamic
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldDynamic_formalImplicitType() async {
var library = await buildLibrary(r'''
class C {
dynamic x;
C(this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:20) (firstTokenOffset:20) (offset:20)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 25
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:32) (firstTokenOffset:27) (offset:32)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.x
firstFragment: #F6
type: dynamic
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldDynamic_formalTyped() async {
var library = await buildLibrary(r'''
class C {
dynamic x;
C(int this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:20) (firstTokenOffset:20) (offset:20)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 25
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.x (nameOffset:36) (firstTokenOffset:27) (offset:36)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.x
firstFragment: #F6
type: int
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldImplicitType_formalDynamic() async {
var library = await buildLibrary(r'''
class C {
var x;
C(dynamic this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.x (nameOffset:36) (firstTokenOffset:23) (offset:36)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.x
firstFragment: #F6
type: dynamic
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldImplicitType_formalImplicitType() async {
var library = await buildLibrary(r'''
class C {
var x;
C(this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:28) (firstTokenOffset:23) (offset:28)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.x
firstFragment: #F6
type: dynamic
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldImplicitType_formalTyped() async {
var library = await buildLibrary(r'''
class C {
var x;
C(int this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.x (nameOffset:32) (firstTokenOffset:23) (offset:32)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.x
firstFragment: #F6
type: int
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldTyped_formalDynamic() async {
var library = await buildLibrary(r'''
class C {
num x;
C(dynamic this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.x (nameOffset:36) (firstTokenOffset:23) (offset:36)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: num
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.x
firstFragment: #F6
type: dynamic
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: num
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: num
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldTyped_formalImplicitType() async {
var library = await buildLibrary(r'''
class C {
num x;
C(this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:28) (firstTokenOffset:23) (offset:28)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: num
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.x
firstFragment: #F6
type: num
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: num
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: num
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_fieldTyped_formalTyped() async {
var library = await buildLibrary(r'''
class C {
num x;
C(int this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.x (nameOffset:32) (firstTokenOffset:23) (offset:32)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: num
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.x
firstFragment: #F6
type: int
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: num
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: num
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_functionTypedSuffix_noReturnType() async {
var library = await buildLibrary(r'''
class C {
var x;
C(this.x(double b));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.x (nameOffset:28) (firstTokenOffset:23) (offset:28)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.x
firstFragment: #F6
type: dynamic Function(double)
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_functionTypedSuffix_withReturnType() async {
var library = await buildLibrary(r'''
class C {
var x;
C(int this.x(double b));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.x (nameOffset:32) (firstTokenOffset:23) (offset:32)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.x
firstFragment: #F6
type: int Function(double)
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_functionTypedSuffix_withReturnType_generic() async {
var library = await buildLibrary(r'''
class C {
Function() f;
C(List<U> this.f<T, U>(T t));
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration f (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::C::@field::f
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 28
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration this.f (nameOffset:43) (firstTokenOffset:30) (offset:43)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::f
getters
#F3 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@getter::f
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@setter::f
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@setter::f::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration f
reference: <testLibrary>::@class::C::@field::f
firstFragment: #F2
type: dynamic Function()
getter: <testLibrary>::@class::C::@getter::f
setter: <testLibrary>::@class::C::@setter::f
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional isFinal this.f
firstFragment: #F6
type: List<U> Function<T, U>(T)
field: <testLibrary>::@class::C::@field::f
getters
isOriginVariable f
reference: <testLibrary>::@class::C::@getter::f
firstFragment: #F3
returnType: dynamic Function()
variable: <testLibrary>::@class::C::@field::f
setters
isOriginVariable f
reference: <testLibrary>::@class::C::@setter::f
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: dynamic Function()
returnType: void
variable: <testLibrary>::@class::C::@field::f
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_multipleMatchingFields() async {
// This is a compile-time error but it should still analyze consistently.
var library = await buildLibrary(r'''
class C {
C(this.x);
int x;
String x;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration x (nameOffset:29) (firstTokenOffset:29) (offset:29)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
#F5 isOriginDeclaration x (nameOffset:41) (firstTokenOffset:41) (offset:41)
element: <testLibrary>::@class::C::@field::x#1
inducedGetter: #F6
inducedSetter: #F7
constructors
#F8 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 12
formalParameters
#F9 requiredPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:19) (firstTokenOffset:14) (offset:19)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
#F6 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41)
element: <testLibrary>::@class::C::@getter::x#1
inducingVariable: #F5
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
#F7 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41)
element: <testLibrary>::@class::C::@setter::x#1
inducingVariable: #F5
formalParameters
#F11 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41)
element: <testLibrary>::@class::C::@setter::x#1::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x#1
firstFragment: #F5
type: String
getter: <testLibrary>::@class::C::@getter::x#1
setter: <testLibrary>::@class::C::@setter::x#1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F8
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.x
firstFragment: #F9
type: int
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x#1
firstFragment: #F6
returnType: String
variable: <testLibrary>::@class::C::@field::x#1
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F10
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x#1
firstFragment: #F7
formalParameters
#E2 requiredPositional value
firstFragment: #F11
type: String
returnType: void
variable: <testLibrary>::@class::C::@field::x#1
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_noMatchingField() async {
// This is a compile-time error but it should still analyze consistently.
var library = await buildLibrary(r'''
class C {
C(this.x);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 12
formalParameters
#F3 requiredPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:19) (firstTokenOffset:14) (offset:19)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.x
firstFragment: #F3
type: dynamic
field: <null>
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_private() async {
var library = await buildLibrary(r'''
class C {
int? _x;
C({this._x});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration _x (nameOffset:17) (firstTokenOffset:17) (offset:17)
element: <testLibrary>::@class::C::@field::_x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 23
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:31) (firstTokenOffset:26) (offset:31)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable _x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::C::@getter::_x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable _x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::C::@setter::_x
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::C::@setter::_x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration _x
reference: <testLibrary>::@class::C::@field::_x
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::C::@getter::_x
setter: <testLibrary>::@class::C::@setter::_x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 optionalNamed hasImplicitType isFinal this.x
firstFragment: #F6
type: int?
privateName: _x
field: <testLibrary>::@class::C::@field::_x
getters
isOriginVariable _x
reference: <testLibrary>::@class::C::@getter::_x
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::C::@field::_x
setters
isOriginVariable _x
reference: <testLibrary>::@class::C::@setter::_x
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int?
returnType: void
variable: <testLibrary>::@class::C::@field::_x
fieldNameNonPromotabilityInfo
_x
conflictingFields
<testLibrary>::@class::C::@field::_x
''');
}
test_constructor_secondary_formalParameter_field_requiredPositional_private_noCorrespondingPublic() async {
var library = await buildLibrary(r'''
class C {
int? _123;
C({this._123});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration _123 (nameOffset:17) (firstTokenOffset:17) (offset:17)
element: <testLibrary>::@class::C::@field::_123
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 25
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration this._123 (nameOffset:33) (firstTokenOffset:28) (offset:33)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::_123
getters
#F3 isComplete isOriginVariable _123 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::C::@getter::_123
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable _123 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::C::@setter::_123
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::C::@setter::_123::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration _123
reference: <testLibrary>::@class::C::@field::_123
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::C::@getter::_123
setter: <testLibrary>::@class::C::@setter::_123
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 optionalNamed hasImplicitType isFinal this._123
firstFragment: #F6
type: int?
field: <testLibrary>::@class::C::@field::_123
getters
isOriginVariable _123
reference: <testLibrary>::@class::C::@getter::_123
firstFragment: #F3
returnType: int?
variable: <testLibrary>::@class::C::@field::_123
setters
isOriginVariable _123
reference: <testLibrary>::@class::C::@setter::_123
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int?
returnType: void
variable: <testLibrary>::@class::C::@field::_123
fieldNameNonPromotabilityInfo
_123
conflictingFields
<testLibrary>::@class::C::@field::_123
''');
}
test_constructor_secondary_formalParameter_super_optionalNamed() async {
var library = await buildLibrary(r'''
class A {
A({required int a, required double b});
}
class B extends A {
B({String o1, super.a, String o2, super.b}) : super();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration a (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 requiredNamed isOriginDeclaration b (nameOffset:47) (firstTokenOffset:31) (offset:47)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:61) (firstTokenOffset:55) (offset:61)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:77) (offset:77)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 77
formalParameters
#F7 optionalNamed isOriginDeclaration o1 (nameOffset:87) (firstTokenOffset:80) (offset:87)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 optionalNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:97) (firstTokenOffset:91) (offset:97)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 optionalNamed isOriginDeclaration o2 (nameOffset:107) (firstTokenOffset:100) (offset:107)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 optionalNamed hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:117) (firstTokenOffset:111) (offset:117)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed a
firstFragment: #F3
type: int
#E1 requiredNamed b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 optionalNamed o1
firstFragment: #F7
type: String
#E3 optionalNamed hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#E4 optionalNamed o2
firstFragment: #F9
type: String
#E5 optionalNamed hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_optionalNamed_defaultValue() async {
var library = await buildLibrary(r'''
class A {
A({int a = 0});
}
class B extends A {
B({super.a});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 optionalNamed isOriginDeclaration a (nameOffset:19) (firstTokenOffset:15) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
initializer: expression_0
IntegerLiteral
literal: 0 @23
staticType: int
#F4 hasExtendsClause class B (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:53) (offset:53)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 53
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:62) (firstTokenOffset:56) (offset:62)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 optionalNamed hasDefaultValue a
firstFragment: #F3
type: int
constantInitializer
fragment: #F3
expression: expression_0
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 optionalNamed hasDefaultValue hasImplicitType isFinal super.a
firstFragment: #F6
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_optionalNamed_unresolved() async {
var library = await buildLibrary(r'''
class A {
A({required int a});
}
class B extends A {
B({super.b});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration a (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 hasExtendsClause class B (nameOffset:42) (firstTokenOffset:36) (offset:42)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:58) (offset:58)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 58
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:67) (firstTokenOffset:61) (offset:67)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed a
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 optionalNamed hasImplicitType isFinal super.b
firstFragment: #F6
type: dynamic
superConstructorParameter: <null>
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_optionalNamed_unresolved2() async {
var library = await buildLibrary(r'''
class A {
A(int a);
}
class B extends A {
B({super.a});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F6 optionalNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:56) (firstTokenOffset:50) (offset:56)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 optionalNamed hasImplicitType isFinal super.a
firstFragment: #F6
type: dynamic
superConstructorParameter: <null>
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_optionalPositional() async {
var library = await buildLibrary(r'''
class A {
A(int a, double b);
}
class B extends A {
B([String o1, super.a, String o2, super.b]) : super();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 requiredPositional isOriginDeclaration b (nameOffset:28) (firstTokenOffset:21) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:41) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:57) (offset:57)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 57
formalParameters
#F7 optionalPositional isOriginDeclaration o1 (nameOffset:67) (firstTokenOffset:60) (offset:67)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 optionalPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:77) (firstTokenOffset:71) (offset:77)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 optionalPositional isOriginDeclaration o2 (nameOffset:87) (firstTokenOffset:80) (offset:87)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 optionalPositional hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:97) (firstTokenOffset:91) (offset:97)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
#E1 requiredPositional b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 optionalPositional o1
firstFragment: #F7
type: String
#E3 optionalPositional hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#E4 optionalPositional o2
firstFragment: #F9
type: String
#E5 optionalPositional hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredNamed() async {
var library = await buildLibrary(r'''
class A {
A({required int a, required double b});
}
class B extends A {
B({
required String o1,
required super.a,
required String o2,
required super.b,
}) : super();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration a (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 requiredNamed isOriginDeclaration b (nameOffset:47) (firstTokenOffset:31) (offset:47)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:61) (firstTokenOffset:55) (offset:61)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:77) (offset:77)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 77
formalParameters
#F7 requiredNamed isOriginDeclaration o1 (nameOffset:101) (firstTokenOffset:85) (offset:101)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 requiredNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:124) (firstTokenOffset:109) (offset:124)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 requiredNamed isOriginDeclaration o2 (nameOffset:147) (firstTokenOffset:131) (offset:147)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 requiredNamed hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:170) (firstTokenOffset:155) (offset:170)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed a
firstFragment: #F3
type: int
#E1 requiredNamed b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 requiredNamed o1
firstFragment: #F7
type: String
#E3 requiredNamed hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#E4 requiredNamed o2
firstFragment: #F9
type: String
#E5 requiredNamed hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredNamed_defaultValue() async {
var library = await buildLibrary(r'''
class A {
A({int a = 0});
}
class B extends A {
B({required super.a});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 optionalNamed isOriginDeclaration a (nameOffset:19) (firstTokenOffset:15) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
initializer: expression_0
IntegerLiteral
literal: 0 @23
staticType: int
#F4 hasExtendsClause class B (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:53) (offset:53)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 53
formalParameters
#F6 requiredNamed hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:71) (firstTokenOffset:56) (offset:71)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 optionalNamed hasDefaultValue a
firstFragment: #F3
type: int
constantInitializer
fragment: #F3
expression: expression_0
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredNamed hasImplicitType isFinal super.a
firstFragment: #F6
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional() async {
var library = await buildLibrary(r'''
class A {
A(int a, double b);
}
class B extends A {
B(String o1, super.a, String o2, super.b) : super();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 requiredPositional isOriginDeclaration b (nameOffset:28) (firstTokenOffset:21) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
#F5 hasExtendsClause class B (nameOffset:41) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:57) (offset:57)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 57
formalParameters
#F7 requiredPositional isOriginDeclaration o1 (nameOffset:66) (firstTokenOffset:59) (offset:66)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1
#F8 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:76) (firstTokenOffset:70) (offset:76)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
#F9 requiredPositional isOriginDeclaration o2 (nameOffset:86) (firstTokenOffset:79) (offset:86)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2
#F10 requiredPositional hasImplicitType isFinal isOriginDeclaration super.b (nameOffset:96) (firstTokenOffset:90) (offset:96)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
#E1 requiredPositional b
firstFragment: #F4
type: double
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
formalParameters
#E2 requiredPositional o1
firstFragment: #F7
type: String
#E3 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F8
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#E4 requiredPositional o2
firstFragment: #F9
type: String
#E5 requiredPositional hasImplicitType isFinal super.b
firstFragment: #F10
type: double
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::b
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional_explicitType_functionTypedSuffix() async {
var library = await buildLibrary(r'''
class A {
A(Object? a);
}
class B extends A {
B(int super.a<T extends num>(T d)?);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:22) (firstTokenOffset:14) (offset:22)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 hasExtendsClause class B (nameOffset:35) (firstTokenOffset:29) (offset:35)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:51) (offset:51)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 51
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration super.a (nameOffset:63) (firstTokenOffset:53) (offset:63)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: Object?
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional isFinal super.a
firstFragment: #F6
type: int Function<T extends num>(T)?
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional_explicitType_interface() async {
var library = await buildLibrary(r'''
class A {
A(num a);
}
class B extends A {
B(int super.a);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 hasExtendsClause class B (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration super.a (nameOffset:59) (firstTokenOffset:49) (offset:59)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: num
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional isFinal super.a
firstFragment: #F6
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional_explicitType_interface_nullable() async {
var library = await buildLibrary(r'''
class A {
A(num? a);
}
class B extends A {
B(int? super.a);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:19) (firstTokenOffset:14) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 hasExtendsClause class B (nameOffset:32) (firstTokenOffset:26) (offset:32)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:48) (offset:48)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 48
formalParameters
#F6 requiredPositional isFinal isOriginDeclaration super.a (nameOffset:61) (firstTokenOffset:50) (offset:61)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: num?
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional isFinal super.a
firstFragment: #F6
type: int?
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional_inferenceOrder() async {
// It is important that `B` is declared after `C`, so that we check that
// inference happens in order - first `B`, then `C`.
var library = await buildLibrary(r'''
abstract class A {
A(int a);
}
class C extends B {
C(super.a);
}
class B extends A {
B(super.a);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class A (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 21
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:27) (firstTokenOffset:23) (offset:27)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 hasExtendsClause class C (nameOffset:40) (firstTokenOffset:34) (offset:40)
element: <testLibrary>::@class::C
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:56) (offset:56)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 56
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:64) (firstTokenOffset:58) (offset:64)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a
#F7 hasExtendsClause class B (nameOffset:77) (firstTokenOffset:71) (offset:77)
element: <testLibrary>::@class::B
constructors
#F8 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:93) (offset:93)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 93
formalParameters
#F9 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:101) (firstTokenOffset:95) (offset:101)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isAbstract isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional a
firstFragment: #F3
type: int
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F4
supertype: B
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F6
type: int
superConstructorParameter: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
superConstructor: <testLibrary>::@class::B::@constructor::new
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F7
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
formalParameters
#E2 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F9
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional_inferenceOrder_generic() async {
// It is important that `C` is declared before `B`, so that we check that
// inference happens in order - first `B`, then `C`.
var library = await buildLibrary(r'''
class A {
A(int a);
}
class C extends B<String> {
C(super.a);
}
class B<T> extends A {
B(super.a);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredPositional isOriginDeclaration a (nameOffset:18) (firstTokenOffset:14) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 hasExtendsClause class C (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::C
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:55) (offset:55)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 55
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:63) (firstTokenOffset:57) (offset:63)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a
#F7 hasExtendsClause class B (nameOffset:76) (firstTokenOffset:70) (offset:76)
element: <testLibrary>::@class::B
typeParameters
#F8 T (nameOffset:78) (firstTokenOffset:78) (offset:78)
element: #E0 T
constructors
#F9 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:95) (offset:95)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 95
formalParameters
#F10 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:103) (firstTokenOffset:97) (offset:103)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E1 requiredPositional a
firstFragment: #F3
type: int
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F4
supertype: B<String>
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E2 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F6
type: int
superConstructorParameter: SubstitutedSuperFormalParameterElementImpl
baseElement: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
substitution: {T: String}
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::B::@constructor::new
substitution: {T: String}
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F7
typeParameters
#E0 T
firstFragment: #F8
supertype: A
constructors
hasEnclosingTypeParameterReference isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F9
formalParameters
#E3 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F10
type: int
superConstructorParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional_invalid_topFunction() async {
var library = await buildLibrary(r'''
void f(super.a) {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
functions
#F1 isComplete isOriginDeclaration isStatic f (nameOffset:5) (firstTokenOffset:0) (offset:5)
element: <testLibrary>::@function::f
formalParameters
#F2 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:13) (firstTokenOffset:7) (offset:13)
element: <testLibrary>::@function::f::@formalParameter::a
functions
isOriginDeclaration isStatic f
reference: <testLibrary>::@function::f
firstFragment: #F1
formalParameters
#E0 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F2
type: dynamic
superConstructorParameter: <null>
returnType: void
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional_unresolved() async {
var library = await buildLibrary(r'''
class A {}
class B extends A {
B(super.a);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause class B (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::B
constructors
#F4 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:34) (offset:34)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 34
formalParameters
#F5 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:42) (firstTokenOffset:36) (offset:42)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F5
type: dynamic
superConstructorParameter: <null>
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameter_super_requiredPositional_unresolved2() async {
var library = await buildLibrary(r'''
class A {
A({required int a})
}
class B extends A {
B(super.a);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F3 requiredNamed isOriginDeclaration a (nameOffset:28) (firstTokenOffset:15) (offset:28)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a
#F4 hasExtendsClause class B (nameOffset:41) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:57) (offset:57)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 57
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration super.a (nameOffset:65) (firstTokenOffset:59) (offset:65)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredNamed a
firstFragment: #F3
type: int
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional hasImplicitType isFinal super.a
firstFragment: #F6
type: dynamic
superConstructorParameter: <null>
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_formalParameters() async {
var library = await buildLibrary(r'''
class C {
C(x, int y);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 12
formalParameters
#F3 requiredPositional hasImplicitType isOriginDeclaration x (nameOffset:14) (firstTokenOffset:14) (offset:14)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
#F4 requiredPositional isOriginDeclaration y (nameOffset:21) (firstTokenOffset:17) (offset:21)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::y
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional hasImplicitType x
firstFragment: #F3
type: dynamic
#E1 requiredPositional y
firstFragment: #F4
type: int
''');
}
test_constructor_secondary_implicit_typeParameters() async {
var library = await buildLibrary(r'''
class C<T, U> {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
''');
}
test_constructor_secondary_initializers_assertInvocation() async {
var library = await buildLibrary(r'''
class C {
const C(int x) : assert(x >= 42);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 18
formalParameters
#F3 requiredPositional isOriginDeclaration x (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional x
firstFragment: #F3
type: int
constantInitializers
AssertInitializer
assertKeyword: assert @29
leftParenthesis: ( @35
condition2: BinaryExpression
leftOperand2: SimpleIdentifier
token: x @36
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
staticType: int
operator: >= @38
rightOperand2: IntegerLiteral
literal: 42 @41
staticType: int
element: dart:core::@class::num::@method::>=
staticInvokeType: bool Function(num)
staticType: bool
rightParenthesis: ) @43
''');
}
test_constructor_secondary_initializers_assertInvocation_message() async {
var library = await buildLibrary(r'''
class C {
const C(int x) : assert(x >= 42, 'foo');
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 18
formalParameters
#F3 requiredPositional isOriginDeclaration x (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional x
firstFragment: #F3
type: int
constantInitializers
AssertInitializer
assertKeyword: assert @29
leftParenthesis: ( @35
condition2: BinaryExpression
leftOperand2: SimpleIdentifier
token: x @36
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
staticType: int
operator: >= @38
rightOperand2: IntegerLiteral
literal: 42 @41
staticType: int
element: dart:core::@class::num::@method::>=
staticInvokeType: bool Function(num)
staticType: bool
comma: , @43
message2: SimpleStringLiteral
literal: 'foo' @45
rightParenthesis: ) @50
''');
}
test_constructor_secondary_initializers_field() async {
var library = await buildLibrary(r'''
class C {
final x;
const C() : x = 42;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 29
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: x @35
element: <testLibrary>::@class::C::@field::x
staticType: null
equals: = @37
expression2: IntegerLiteral
literal: 42 @39
staticType: int
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_initializers_field_notConst() async {
var library = await buildLibrary(r'''
class C {
final x;
const C() : x = foo();
}
int foo() => 42;
''');
// It is OK to keep non-constant initializers.
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 29
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
functions
#F5 isComplete isOriginDeclaration isStatic foo (nameOffset:53) (firstTokenOffset:49) (offset:53)
element: <testLibrary>::@function::foo
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: x @35
element: <testLibrary>::@class::C::@field::x
staticType: null
equals: = @37
expression2: MethodInvocation
methodName: SimpleIdentifier
token: foo @39
element: <testLibrary>::@function::foo
staticType: int Function()
argumentList: ArgumentList
leftParenthesis: ( @42
rightParenthesis: ) @43
staticInvokeType: int Function()
staticType: int
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
functions
isOriginDeclaration isStatic foo
reference: <testLibrary>::@function::foo
firstFragment: #F5
returnType: int
''');
}
test_constructor_secondary_initializers_field_optionalPositionalFormalParameter() async {
var library = await buildLibrary(r'''
class A {
final int _f;
const A([int f = 0]) : _f = f;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration isPromotable _f (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::_f
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 34
formalParameters
#F5 optionalPositional isOriginDeclaration f (nameOffset:41) (firstTokenOffset:37) (offset:41)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::f
initializer: expression_0
IntegerLiteral
literal: 0 @45
staticType: int
getters
#F3 isComplete isOriginVariable _f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::_f
inducingVariable: #F2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration isPromotable _f
reference: <testLibrary>::@class::A::@field::_f
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::_f
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 optionalPositional hasDefaultValue f
firstFragment: #F5
type: int
constantInitializer
fragment: #F5
expression: expression_0
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: _f @51
element: <testLibrary>::@class::A::@field::_f
staticType: null
equals: = @54
expression2: SimpleIdentifier
token: f @56
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::f
staticType: int
getters
isOriginVariable _f
reference: <testLibrary>::@class::A::@getter::_f
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::_f
''');
}
test_constructor_secondary_initializers_field_recordLiteral() async {
var library = await buildLibrary(r'''
class C {
final Object x;
const C(int a) : x = (0, a);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isFinal isOriginDeclaration x (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:30) (offset:36)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 36
formalParameters
#F5 requiredPositional isOriginDeclaration a (nameOffset:42) (firstTokenOffset:38) (offset:42)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isFinal isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: Object
getter: <testLibrary>::@class::C::@getter::x
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional a
firstFragment: #F5
type: int
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: x @47
element: <testLibrary>::@class::C::@field::x
staticType: null
equals: = @49
expression2: RecordLiteral
leftParenthesis: ( @51
fields2
IntegerLiteral
literal: 0 @52
staticType: int
SimpleIdentifier
token: a @55
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a
staticType: int
rightParenthesis: ) @56
staticType: (int, int)
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: Object
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_initializers_field_stringInterpolation_expression() async {
var library = await buildLibrary(r'''
class C {
final f;
const C() : f = '${42}';
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isFinal isOriginDeclaration f (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::f
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 29
getters
#F3 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::f
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaration f
reference: <testLibrary>::@class::C::@field::f
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::f
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: f @35
element: <testLibrary>::@class::C::@field::f
staticType: null
equals: = @37
expression2: StringInterpolation
elements
InterpolationString
contents: ' @39
InterpolationExpression
leftBracket: ${ @40
expression2: IntegerLiteral
literal: 42 @42
staticType: int
rightBracket: } @44
InterpolationString
contents: ' @45
staticType: String
stringValue: null
getters
isOriginVariable f
reference: <testLibrary>::@class::C::@getter::f
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::f
''');
}
test_constructor_secondary_initializers_field_stringInterpolation_identifier() async {
var library = await buildLibrary(r'''
class C {
final f;
const C(int x) : f = '$x';
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isFinal isOriginDeclaration f (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::f
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 29
formalParameters
#F5 requiredPositional isOriginDeclaration x (nameOffset:35) (firstTokenOffset:31) (offset:35)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
getters
#F3 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::f
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaration f
reference: <testLibrary>::@class::C::@field::f
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::f
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional x
firstFragment: #F5
type: int
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: f @40
element: <testLibrary>::@class::C::@field::f
staticType: null
equals: = @42
expression2: StringInterpolation
elements
InterpolationString
contents: ' @44
InterpolationExpression
leftBracket: $ @45
expression2: SimpleIdentifier
token: x @46
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x
staticType: int
InterpolationString
contents: ' @47
staticType: String
stringValue: null
getters
isOriginVariable f
reference: <testLibrary>::@class::C::@getter::f
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::f
''');
}
test_constructor_secondary_initializers_field_withFormalParameter() async {
var library = await buildLibrary(r'''
class C {
final x;
const C(int p) : x = 1 + p;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 29
formalParameters
#F5 requiredPositional isOriginDeclaration p (nameOffset:35) (firstTokenOffset:31) (offset:35)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::p
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional p
firstFragment: #F5
type: int
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: x @40
element: <testLibrary>::@class::C::@field::x
staticType: null
equals: = @42
expression2: BinaryExpression
leftOperand2: IntegerLiteral
literal: 1 @44
staticType: int
operator: + @46
rightOperand2: SimpleIdentifier
token: p @48
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::p
staticType: int
element: dart:core::@class::num::@method::+
staticInvokeType: num Function(num)
staticType: int
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
''');
}
test_constructor_secondary_initializers_genericFunctionType() async {
var library = await buildLibrary(r'''
class A<T> {
const A();
}
class B {
const B(dynamic x);
const B.f() : this(A<Function()>());
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 21
#F4 class B (nameOffset:35) (firstTokenOffset:29) (offset:35)
element: <testLibrary>::@class::B
constructors
#F5 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:41) (offset:47)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 47
formalParameters
#F6 requiredPositional isOriginDeclaration x (nameOffset:57) (firstTokenOffset:49) (offset:57)
element: <testLibrary>::@class::B::@constructor::new::@formalParameter::x
#F7 isComplete isConst isOriginDeclaration isRedirecting f (nameOffset:71) (firstTokenOffset:63) (offset:71)
element: <testLibrary>::@class::B::@constructor::f
typeName: B
typeNameOffset: 69
periodOffset: 70
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
formalParameters
#E1 requiredPositional x
firstFragment: #F6
type: dynamic
isConst isOriginDeclaration isRedirecting f
reference: <testLibrary>::@class::B::@constructor::f
firstFragment: #F7
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @77
argumentList: ArgumentList
leftParenthesis: ( @81
arguments2
InstanceCreationExpression
constructorName: ConstructorName
type: NamedType
name: A @82
typeArguments: TypeArgumentList
leftBracket: < @83
arguments
GenericFunctionType
functionKeyword: Function @84
parameters: FormalParameterList
leftParenthesis: ( @92
rightParenthesis: ) @93
declaredFragment: GenericFunctionTypeElement
parameters
returnType: dynamic
type: dynamic Function()
type: dynamic Function()
rightBracket: > @94
element: <testLibrary>::@class::A
type: A<dynamic Function()>
element: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: dynamic Function()}
argumentList: ArgumentList
leftParenthesis: ( @95
rightParenthesis: ) @96
staticType: A<dynamic Function()>
rightParenthesis: ) @97
element: <testLibrary>::@class::B::@constructor::new
redirectedConstructor: <testLibrary>::@class::B::@constructor::new
''');
}
test_constructor_secondary_initializers_superInvocation_argumentContextType() async {
var library = await buildLibrary(r'''
class A {
const A(List<String> values);
}
class B extends A {
const B() : super(const []);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 18
formalParameters
#F3 requiredPositional isOriginDeclaration values (nameOffset:33) (firstTokenOffset:20) (offset:33)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::values
#F4 hasExtendsClause class B (nameOffset:51) (firstTokenOffset:45) (offset:51)
element: <testLibrary>::@class::B
constructors
#F5 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:67) (offset:73)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 73
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional values
firstFragment: #F3
type: List<String>
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F5
constantInitializers
SuperConstructorInvocation
superKeyword: super @79
argumentList: ArgumentList
leftParenthesis: ( @84
arguments2
ListLiteral
constKeyword: const @85
leftBracket: [ @91
rightBracket: ] @92
staticType: List<String>
rightParenthesis: ) @93
element: <testLibrary>::@class::A::@constructor::new
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_initializers_superInvocation_named() async {
var library = await buildLibrary(r'''
class A {
const A.aaa(int p);
}
class C extends A {
const C() : super.aaa(42);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginDeclaration aaa (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@constructor::aaa
typeName: A
typeNameOffset: 18
periodOffset: 19
formalParameters
#F3 requiredPositional isOriginDeclaration p (nameOffset:28) (firstTokenOffset:24) (offset:28)
element: <testLibrary>::@class::A::@constructor::aaa::@formalParameter::p
#F4 hasExtendsClause class C (nameOffset:41) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::C
constructors
#F5 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:57) (offset:63)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 63
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isConst isOriginDeclaration aaa
reference: <testLibrary>::@class::A::@constructor::aaa
firstFragment: #F2
formalParameters
#E0 requiredPositional p
firstFragment: #F3
type: int
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F4
supertype: A
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
constantInitializers
SuperConstructorInvocation
superKeyword: super @69
constructorSelector: ConstructorSelector
period: . @74
name2: aaa @75
argumentList: ArgumentList
leftParenthesis: ( @78
arguments2
IntegerLiteral
literal: 42 @79
staticType: int
rightParenthesis: ) @81
period: . @74
constructorName: SimpleIdentifier
token: aaa @75
element: <testLibrary>::@class::A::@constructor::aaa
staticType: null
element: <testLibrary>::@class::A::@constructor::aaa
superConstructor: <testLibrary>::@class::A::@constructor::aaa
''');
}
test_constructor_secondary_initializers_superInvocation_named_underscore() async {
var library = await buildLibrary(r'''
class A {
const A._();
}
class B extends A {
const B() : super._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginDeclaration _ (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@constructor::_
typeName: A
typeNameOffset: 18
periodOffset: 19
#F3 hasExtendsClause class B (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::B
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:50) (offset:56)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 56
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isConst isOriginDeclaration _
reference: <testLibrary>::@class::A::@constructor::_
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
constantInitializers
SuperConstructorInvocation
superKeyword: super @62
constructorSelector: ConstructorSelector
period: . @67
name2: _ @68
argumentList: ArgumentList
leftParenthesis: ( @69
rightParenthesis: ) @70
period: . @67
constructorName: SimpleIdentifier
token: _ @68
element: <testLibrary>::@class::A::@constructor::_
staticType: null
element: <testLibrary>::@class::A::@constructor::_
superConstructor: <testLibrary>::@class::A::@constructor::_
''');
}
test_constructor_secondary_initializers_superInvocation_namedExpression() async {
var library = await buildLibrary(r'''
class A {
const A.aaa(a, {int b});
}
class C extends A {
const C() : super.aaa(1, b: 2);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginDeclaration aaa (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@constructor::aaa
typeName: A
typeNameOffset: 18
periodOffset: 19
formalParameters
#F3 requiredPositional hasImplicitType isOriginDeclaration a (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: <testLibrary>::@class::A::@constructor::aaa::@formalParameter::a
#F4 optionalNamed isOriginDeclaration b (nameOffset:32) (firstTokenOffset:28) (offset:32)
element: <testLibrary>::@class::A::@constructor::aaa::@formalParameter::b
#F5 hasExtendsClause class C (nameOffset:46) (firstTokenOffset:40) (offset:46)
element: <testLibrary>::@class::C
constructors
#F6 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:62) (offset:68)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 68
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isConst isOriginDeclaration aaa
reference: <testLibrary>::@class::A::@constructor::aaa
firstFragment: #F2
formalParameters
#E0 requiredPositional hasImplicitType a
firstFragment: #F3
type: dynamic
#E1 optionalNamed b
firstFragment: #F4
type: int
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F5
supertype: A
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F6
constantInitializers
SuperConstructorInvocation
superKeyword: super @74
constructorSelector: ConstructorSelector
period: . @79
name2: aaa @80
argumentList: ArgumentList
leftParenthesis: ( @83
arguments2
IntegerLiteral
literal: 1 @84
staticType: int
NamedArgument
name: b @87
colon: : @88
argumentExpression2: IntegerLiteral
literal: 2 @90
staticType: int
rightParenthesis: ) @91
period: . @79
constructorName: SimpleIdentifier
token: aaa @80
element: <testLibrary>::@class::A::@constructor::aaa
staticType: null
element: <testLibrary>::@class::A::@constructor::aaa
superConstructor: <testLibrary>::@class::A::@constructor::aaa
''');
}
test_constructor_secondary_initializers_superInvocation_unnamed() async {
var library = await buildLibrary(r'''
class A {
const A(int p);
}
class C extends A {
const C.ccc() : super(42);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 18
formalParameters
#F3 requiredPositional isOriginDeclaration p (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p
#F4 hasExtendsClause class C (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::C
constructors
#F5 isComplete isConst isOriginDeclaration ccc (nameOffset:61) (firstTokenOffset:53) (offset:61)
element: <testLibrary>::@class::C::@constructor::ccc
typeName: C
typeNameOffset: 59
periodOffset: 60
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional p
firstFragment: #F3
type: int
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F4
supertype: A
constructors
isConst isOriginDeclaration ccc
reference: <testLibrary>::@class::C::@constructor::ccc
firstFragment: #F5
constantInitializers
SuperConstructorInvocation
superKeyword: super @69
argumentList: ArgumentList
leftParenthesis: ( @74
arguments2
IntegerLiteral
literal: 42 @75
staticType: int
rightParenthesis: ) @77
element: <testLibrary>::@class::A::@constructor::new
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_initializers_thisInvocation_argumentContextType() async {
var library = await buildLibrary(r'''
class A {
const A(List<String> values);
const A.empty() : this(const []);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 18
formalParameters
#F3 requiredPositional isOriginDeclaration values (nameOffset:33) (firstTokenOffset:20) (offset:33)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::values
#F4 isComplete isConst isOriginDeclaration isRedirecting empty (nameOffset:52) (firstTokenOffset:44) (offset:52)
element: <testLibrary>::@class::A::@constructor::empty
typeName: A
typeNameOffset: 50
periodOffset: 51
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
formalParameters
#E0 requiredPositional values
firstFragment: #F3
type: List<String>
isConst isOriginDeclaration isRedirecting empty
reference: <testLibrary>::@class::A::@constructor::empty
firstFragment: #F4
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @62
argumentList: ArgumentList
leftParenthesis: ( @66
arguments2
ListLiteral
constKeyword: const @67
leftBracket: [ @73
rightBracket: ] @74
staticType: List<String>
rightParenthesis: ) @75
element: <testLibrary>::@class::A::@constructor::new
redirectedConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_initializers_thisInvocation_named() async {
var library = await buildLibrary(r'''
class C {
const C() : this.named(1, 'bbb');
const C.named(int a, String b);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isConst isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 18
#F3 isConst isOriginDeclaration named (nameOffset:56) (firstTokenOffset:48) (offset:56)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 54
periodOffset: 55
formalParameters
#F4 requiredPositional isOriginDeclaration a (nameOffset:66) (firstTokenOffset:62) (offset:66)
element: <testLibrary>::@class::C::@constructor::named::@formalParameter::a
#F5 requiredPositional isOriginDeclaration b (nameOffset:76) (firstTokenOffset:69) (offset:76)
element: <testLibrary>::@class::C::@constructor::named::@formalParameter::b
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @24
constructorSelector: ConstructorSelector
period: . @28
name2: named @29
argumentList: ArgumentList
leftParenthesis: ( @34
arguments2
IntegerLiteral
literal: 1 @35
staticType: int
SimpleStringLiteral
literal: 'bbb' @38
rightParenthesis: ) @43
period: . @28
constructorName: SimpleIdentifier
token: named @29
element: <testLibrary>::@class::C::@constructor::named
staticType: null
element: <testLibrary>::@class::C::@constructor::named
redirectedConstructor: <testLibrary>::@class::C::@constructor::named
isConst isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional a
firstFragment: #F4
type: int
#E1 requiredPositional b
firstFragment: #F5
type: String
''');
}
test_constructor_secondary_initializers_thisInvocation_namedExpression() async {
var library = await buildLibrary(r'''
class C {
const C() : this.named(1, b: 2);
const C.named(a, {int b});
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isConst isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 18
#F3 isConst isOriginDeclaration named (nameOffset:55) (firstTokenOffset:47) (offset:55)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 53
periodOffset: 54
formalParameters
#F4 requiredPositional hasImplicitType isOriginDeclaration a (nameOffset:61) (firstTokenOffset:61) (offset:61)
element: <testLibrary>::@class::C::@constructor::named::@formalParameter::a
#F5 optionalNamed isOriginDeclaration b (nameOffset:69) (firstTokenOffset:65) (offset:69)
element: <testLibrary>::@class::C::@constructor::named::@formalParameter::b
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @24
constructorSelector: ConstructorSelector
period: . @28
name2: named @29
argumentList: ArgumentList
leftParenthesis: ( @34
arguments2
IntegerLiteral
literal: 1 @35
staticType: int
NamedArgument
name: b @38
colon: : @39
argumentExpression2: IntegerLiteral
literal: 2 @41
staticType: int
rightParenthesis: ) @42
period: . @28
constructorName: SimpleIdentifier
token: named @29
element: <testLibrary>::@class::C::@constructor::named
staticType: null
element: <testLibrary>::@class::C::@constructor::named
redirectedConstructor: <testLibrary>::@class::C::@constructor::named
isConst isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F3
formalParameters
#E0 requiredPositional hasImplicitType a
firstFragment: #F4
type: dynamic
#E1 optionalNamed b
firstFragment: #F5
type: int
''');
}
test_constructor_secondary_initializers_thisInvocation_unnamed() async {
var library = await buildLibrary(r'''
class C {
const C.named() : this(1, 'bbb');
const C(int a, String b);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isConst isOriginDeclaration isRedirecting named (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 18
periodOffset: 19
#F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:48) (offset:54)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 54
formalParameters
#F4 requiredPositional isOriginDeclaration a (nameOffset:60) (firstTokenOffset:56) (offset:60)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a
#F5 requiredPositional isOriginDeclaration b (nameOffset:70) (firstTokenOffset:63) (offset:70)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::b
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration isRedirecting named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F2
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @30
argumentList: ArgumentList
leftParenthesis: ( @34
arguments2
IntegerLiteral
literal: 1 @35
staticType: int
SimpleStringLiteral
literal: 'bbb' @38
rightParenthesis: ) @43
element: <testLibrary>::@class::C::@constructor::new
redirectedConstructor: <testLibrary>::@class::C::@constructor::new
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
formalParameters
#E0 requiredPositional a
firstFragment: #F4
type: int
#E1 requiredPositional b
firstFragment: #F5
type: String
''');
}
test_constructor_secondary_named() async {
var library = await buildLibrary(r'''
class C {
C.foo();
}
''');
configuration.withDisplayName = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::C::@constructor::foo
typeName: C
typeNameOffset: 12
periodOffset: 13
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::C::@constructor::foo
firstFragment: #F2
''');
}
test_constructor_secondary_newHead_named() async {
var library = await buildLibrary(r'''
class C {
new named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration named (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::C::@constructor::named
newKeywordOffset: 12
typeName: null
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F2
''');
}
test_constructor_secondary_newHead_named_const() async {
var library = await buildLibrary(r'''
class C {
const new named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginDeclaration named (nameOffset:22) (firstTokenOffset:12) (offset:22)
element: <testLibrary>::@class::C::@constructor::named
newKeywordOffset: 18
typeName: null
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F2
''');
}
test_constructor_secondary_newHead_unnamed() async {
var library = await buildLibrary(r'''
class C {
new();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
newKeywordOffset: 12
typeName: null
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_newHead_unnamed_const() async {
var library = await buildLibrary(r'''
class C {
const new();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
newKeywordOffset: 18
typeName: null
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_redirected_factory_named() async {
var library = await buildLibrary(r'''
class C {
factory C() = D.named;
C._();
}
class D extends C {
D.named() : super._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 12
typeName: C
typeNameOffset: 20
#F3 isOriginDeclaration _ (nameOffset:39) (firstTokenOffset:37) (offset:39)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 37
periodOffset: 38
#F4 hasExtendsClause class D (nameOffset:53) (firstTokenOffset:47) (offset:53)
element: <testLibrary>::@class::D
constructors
#F5 isComplete isOriginDeclaration named (nameOffset:71) (firstTokenOffset:69) (offset:71)
element: <testLibrary>::@class::D::@constructor::named
typeName: D
typeNameOffset: 69
periodOffset: 70
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: <testLibrary>::@class::D::@constructor::named
isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F3
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F4
supertype: C
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::D::@constructor::named
firstFragment: #F5
superConstructor: <testLibrary>::@class::C::@constructor::_
''');
}
test_constructor_secondary_redirected_factory_named_cycle() async {
var library = await buildLibrary(r'''
class C {
factory C.a() = C.b;
factory C.b() = C.a;
}
''');
configuration.forClassConstructors(classNames: {'C'});
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting a (nameOffset:22) (firstTokenOffset:12) (offset:22)
element: <testLibrary>::@class::C::@constructor::a
factoryKeywordOffset: 12
typeName: C
typeNameOffset: 20
periodOffset: 21
#F3 isComplete isFactory isOriginDeclaration isRedirecting b (nameOffset:45) (firstTokenOffset:35) (offset:45)
element: <testLibrary>::@class::C::@constructor::b
factoryKeywordOffset: 35
typeName: C
typeNameOffset: 43
periodOffset: 44
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isInRedirectingConstructorCycle isOriginDeclaration isRedirecting a
reference: <testLibrary>::@class::C::@constructor::a
firstFragment: #F2
redirectedConstructor: <testLibrary>::@class::C::@constructor::b
isFactory isInRedirectingConstructorCycle isOriginDeclaration isRedirecting b
reference: <testLibrary>::@class::C::@constructor::b
firstFragment: #F3
redirectedConstructor: <testLibrary>::@class::C::@constructor::a
''');
}
test_constructor_secondary_redirected_factory_named_generic() async {
var library = await buildLibrary(r'''
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
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
constructors
#F4 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:18) (offset:26)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 18
typeName: C
typeNameOffset: 26
#F5 isOriginDeclaration _ (nameOffset:51) (firstTokenOffset:49) (offset:51)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 49
periodOffset: 50
#F6 hasExtendsClause class D (nameOffset:65) (firstTokenOffset:59) (offset:65)
element: <testLibrary>::@class::D
typeParameters
#F7 T (nameOffset:67) (firstTokenOffset:67) (offset:67)
element: #E2 T
#F8 U (nameOffset:70) (firstTokenOffset:70) (offset:70)
element: #E3 U
constructors
#F9 isComplete isOriginDeclaration named (nameOffset:95) (firstTokenOffset:93) (offset:95)
element: <testLibrary>::@class::D::@constructor::named
typeName: D
typeNameOffset: 93
periodOffset: 94
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::D::@constructor::named
substitution: {T: U, U: T}
hasEnclosingTypeParameterReference isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F5
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F6
typeParameters
#E2 T
firstFragment: #F7
#E3 U
firstFragment: #F8
supertype: C<U, T>
constructors
hasEnclosingTypeParameterReference isOriginDeclaration named
reference: <testLibrary>::@class::D::@constructor::named
firstFragment: #F9
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::C::@constructor::_
substitution: {T: U, U: T}
''');
}
test_constructor_secondary_redirected_factory_named_generic_inference() async {
var library = await buildLibrary(r'''
class A<T, U> implements B<T, U> {
A.named();
}
class B<T2, U2> {
factory B() = A.named;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
constructors
#F4 isOriginDeclaration named (nameOffset:39) (firstTokenOffset:37) (offset:39)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 37
periodOffset: 38
#F5 class B (nameOffset:57) (firstTokenOffset:51) (offset:57)
element: <testLibrary>::@class::B
typeParameters
#F6 T2 (nameOffset:59) (firstTokenOffset:59) (offset:59)
element: #E2 T2
#F7 U2 (nameOffset:63) (firstTokenOffset:63) (offset:63)
element: #E3 U2
constructors
#F8 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:71) (offset:79)
element: <testLibrary>::@class::B::@constructor::new
factoryKeywordOffset: 71
typeName: B
typeNameOffset: 79
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
interfaces
B<T, U>
constructors
hasEnclosingTypeParameterReference isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F4
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
typeParameters
#E2 T2
firstFragment: #F6
#E3 U2
firstFragment: #F7
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::named
substitution: {T: T2, U: U2}
''');
}
test_constructor_secondary_redirected_factory_named_generic_viaTypeAlias() async {
var library = await buildLibrary(r'''
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
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class B (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::B
typeParameters
#F2 T (nameOffset:36) (firstTokenOffset:36) (offset:36)
element: #E0 T
#F3 U (nameOffset:39) (firstTokenOffset:39) (offset:39)
element: #E1 U
constructors
#F4 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:46) (offset:54)
element: <testLibrary>::@class::B::@constructor::new
factoryKeywordOffset: 46
typeName: B
typeNameOffset: 54
#F5 isOriginDeclaration _ (nameOffset:79) (firstTokenOffset:77) (offset:79)
element: <testLibrary>::@class::B::@constructor::_
typeName: B
typeNameOffset: 77
periodOffset: 78
#F6 hasExtendsClause class C (nameOffset:93) (firstTokenOffset:87) (offset:93)
element: <testLibrary>::@class::C
typeParameters
#F7 T (nameOffset:95) (firstTokenOffset:95) (offset:95)
element: #E2 T
#F8 U (nameOffset:98) (firstTokenOffset:98) (offset:98)
element: #E3 U
constructors
#F9 isComplete isOriginDeclaration named (nameOffset:123) (firstTokenOffset:121) (offset:123)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 121
periodOffset: 122
typeAliases
#F10 A (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::A
typeParameters
#F11 T (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E4 T
#F12 U (nameOffset:13) (firstTokenOffset:13) (offset:13)
element: #E5 U
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::C::@constructor::named
substitution: {T: U, U: T}
hasEnclosingTypeParameterReference isOriginDeclaration _
reference: <testLibrary>::@class::B::@constructor::_
firstFragment: #F5
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F6
typeParameters
#E2 T
firstFragment: #F7
#E3 U
firstFragment: #F8
constructors
hasEnclosingTypeParameterReference isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F9
typeAliases
isSimplyBounded A
reference: <testLibrary>::@typeAlias::A
firstFragment: #F10
typeParameters
#E4 T
firstFragment: #F11
#E5 U
firstFragment: #F12
aliasedType: C<T, U>
''');
}
test_constructor_secondary_redirected_factory_named_imported() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
class D extends C {
D.named() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart';
class C {
factory C() = D.named;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart
classes
#F1 class C (nameOffset:26) (firstTokenOffset:20) (offset:26)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:32) (offset:40)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 32
typeName: C
typeNameOffset: 40
#F3 isOriginDeclaration _ (nameOffset:59) (firstTokenOffset:57) (offset:59)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 57
periodOffset: 58
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: package:test/foo.dart::@class::D::@constructor::named
isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F3
''');
}
test_constructor_secondary_redirected_factory_named_imported_generic() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
class D<T, U> extends C<U, T> {
D.named() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart';
class C<T, U> {
factory C() = D<U, T>.named;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart
classes
#F1 class C (nameOffset:26) (firstTokenOffset:20) (offset:26)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:28) (firstTokenOffset:28) (offset:28)
element: #E0 T
#F3 U (nameOffset:31) (firstTokenOffset:31) (offset:31)
element: #E1 U
constructors
#F4 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:38) (offset:46)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 38
typeName: C
typeNameOffset: 46
#F5 isOriginDeclaration _ (nameOffset:71) (firstTokenOffset:69) (offset:71)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 69
periodOffset: 70
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: package:test/foo.dart::@class::D::@constructor::named
substitution: {T: U, U: T}
hasEnclosingTypeParameterReference isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F5
''');
}
test_constructor_secondary_redirected_factory_named_prefixed() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
class D extends C {
D.named() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart' as foo;
class C {
factory C() = foo.D.named;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart as foo (nameOffset:21) (firstTokenOffset:<null>) (offset:21)
prefixes
<testLibraryFragment>::@prefix::foo
fragments: @21
classes
#F1 class C (nameOffset:33) (firstTokenOffset:27) (offset:33)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:39) (offset:47)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 39
typeName: C
typeNameOffset: 47
#F3 isOriginDeclaration _ (nameOffset:70) (firstTokenOffset:68) (offset:70)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 68
periodOffset: 69
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: package:test/foo.dart::@class::D::@constructor::named
isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F3
''');
}
test_constructor_secondary_redirected_factory_named_prefixed_generic() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
class D<T, U> extends C<U, T> {
D.named() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart' as foo;
class C<T, U> {
factory C() = foo.D<U, T>.named;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart as foo (nameOffset:21) (firstTokenOffset:<null>) (offset:21)
prefixes
<testLibraryFragment>::@prefix::foo
fragments: @21
classes
#F1 class C (nameOffset:33) (firstTokenOffset:27) (offset:33)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:35) (firstTokenOffset:35) (offset:35)
element: #E0 T
#F3 U (nameOffset:38) (firstTokenOffset:38) (offset:38)
element: #E1 U
constructors
#F4 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:45) (offset:53)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 45
typeName: C
typeNameOffset: 53
#F5 isOriginDeclaration _ (nameOffset:82) (firstTokenOffset:80) (offset:82)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 80
periodOffset: 81
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: package:test/foo.dart::@class::D::@constructor::named
substitution: {T: U, U: T}
hasEnclosingTypeParameterReference isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F5
''');
}
test_constructor_secondary_redirected_factory_named_redirectsIntoCycle() async {
var library = await buildLibrary(r'''
class C {
factory C.a() = C.b;
factory C.b() = C.a;
factory C.c() = C.a;
}
''');
configuration.forClassConstructors(classNames: {'C'});
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting a (nameOffset:22) (firstTokenOffset:12) (offset:22)
element: <testLibrary>::@class::C::@constructor::a
factoryKeywordOffset: 12
typeName: C
typeNameOffset: 20
periodOffset: 21
#F3 isComplete isFactory isOriginDeclaration isRedirecting b (nameOffset:45) (firstTokenOffset:35) (offset:45)
element: <testLibrary>::@class::C::@constructor::b
factoryKeywordOffset: 35
typeName: C
typeNameOffset: 43
periodOffset: 44
#F4 isComplete isFactory isOriginDeclaration isRedirecting c (nameOffset:68) (firstTokenOffset:58) (offset:68)
element: <testLibrary>::@class::C::@constructor::c
factoryKeywordOffset: 58
typeName: C
typeNameOffset: 66
periodOffset: 67
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isInRedirectingConstructorCycle isOriginDeclaration isRedirecting a
reference: <testLibrary>::@class::C::@constructor::a
firstFragment: #F2
redirectedConstructor: <testLibrary>::@class::C::@constructor::b
isFactory isInRedirectingConstructorCycle isOriginDeclaration isRedirecting b
reference: <testLibrary>::@class::C::@constructor::b
firstFragment: #F3
redirectedConstructor: <testLibrary>::@class::C::@constructor::a
isFactory isOriginDeclaration isRedirecting c
reference: <testLibrary>::@class::C::@constructor::c
firstFragment: #F4
redirectedConstructor: <testLibrary>::@class::C::@constructor::a
''');
}
test_constructor_secondary_redirected_factory_named_unresolved_class() async {
var library = await buildLibrary(r'''
class C<E> {
factory C() = D.named<E>;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 E (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 E
constructors
#F3 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:15) (offset:23)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 15
typeName: C
typeNameOffset: 23
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 E
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_constructor_secondary_redirected_factory_named_unresolved_constructor() async {
var library = await buildLibrary(r'''
class D {}
class C<E> {
factory C() = D.named<E>;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class D (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::D
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
#F3 class C (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::C
typeParameters
#F4 E (nameOffset:20) (firstTokenOffset:20) (offset:20)
element: #E0 E
constructors
#F5 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:27) (offset:35)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 27
typeName: C
typeNameOffset: 35
classes
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F2
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F3
typeParameters
#E0 E
firstFragment: #F4
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
''');
}
test_constructor_secondary_redirected_factory_unnamed() async {
var library = await buildLibrary(r'''
class C {
factory C() = D;
C._();
}
class D extends C {
D() : super._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 12
typeName: C
typeNameOffset: 20
#F3 isOriginDeclaration _ (nameOffset:33) (firstTokenOffset:31) (offset:33)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 31
periodOffset: 32
#F4 hasExtendsClause class D (nameOffset:47) (firstTokenOffset:41) (offset:47)
element: <testLibrary>::@class::D
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:63) (offset:63)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
typeNameOffset: 63
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: <testLibrary>::@class::D::@constructor::new
isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F3
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F4
supertype: C
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F5
superConstructor: <testLibrary>::@class::C::@constructor::_
''');
}
test_constructor_secondary_redirected_factory_unnamed_generic() async {
var library = await buildLibrary(r'''
class C<T, U> {
factory C() = D<U, T>;
C._();
}
class D<T, U> extends C<U, T> {
D() : super._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
constructors
#F4 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:18) (offset:26)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 18
typeName: C
typeNameOffset: 26
#F5 isOriginDeclaration _ (nameOffset:45) (firstTokenOffset:43) (offset:45)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 43
periodOffset: 44
#F6 hasExtendsClause class D (nameOffset:59) (firstTokenOffset:53) (offset:59)
element: <testLibrary>::@class::D
typeParameters
#F7 T (nameOffset:61) (firstTokenOffset:61) (offset:61)
element: #E2 T
#F8 U (nameOffset:64) (firstTokenOffset:64) (offset:64)
element: #E3 U
constructors
#F9 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:87) (offset:87)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
typeNameOffset: 87
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::D::@constructor::new
substitution: {T: U, U: T}
hasEnclosingTypeParameterReference isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F5
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F6
typeParameters
#E2 T
firstFragment: #F7
#E3 U
firstFragment: #F8
supertype: C<U, T>
constructors
hasEnclosingTypeParameterReference isOriginDeclaration new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F9
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::C::@constructor::_
substitution: {T: U, U: T}
''');
}
test_constructor_secondary_redirected_factory_unnamed_generic_inference() async {
var library = await buildLibrary(r'''
class A<T, U> implements B<T, U> {
A();
}
class B<T2, U2> {
factory B() = A;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
constructors
#F4 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:37) (offset:37)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 37
#F5 class B (nameOffset:51) (firstTokenOffset:45) (offset:51)
element: <testLibrary>::@class::B
typeParameters
#F6 T2 (nameOffset:53) (firstTokenOffset:53) (offset:53)
element: #E2 T2
#F7 U2 (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: #E3 U2
constructors
#F8 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:65) (offset:73)
element: <testLibrary>::@class::B::@constructor::new
factoryKeywordOffset: 65
typeName: B
typeNameOffset: 73
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
interfaces
B<T, U>
constructors
hasEnclosingTypeParameterReference isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
typeParameters
#E2 T2
firstFragment: #F6
#E3 U2
firstFragment: #F7
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: T2, U: U2}
''');
}
test_constructor_secondary_redirected_factory_unnamed_generic_inference_self() async {
var library = await buildLibrary(r'''
class A<T> {
A();
factory A.redirected() = A;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:15) (offset:15)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 15
#F4 isComplete isFactory isOriginDeclaration isRedirecting redirected (nameOffset:32) (firstTokenOffset:22) (offset:32)
element: <testLibrary>::@class::A::@constructor::redirected
factoryKeywordOffset: 22
typeName: A
typeNameOffset: 30
periodOffset: 31
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting redirected
reference: <testLibrary>::@class::A::@constructor::redirected
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: T}
''');
}
test_constructor_secondary_redirected_factory_unnamed_generic_viaTypeAlias() async {
var library = await buildLibrary(r'''
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
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class B (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::B
typeParameters
#F2 T (nameOffset:36) (firstTokenOffset:36) (offset:36)
element: #E0 T
#F3 U (nameOffset:39) (firstTokenOffset:39) (offset:39)
element: #E1 U
constructors
#F4 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:46) (offset:54)
element: <testLibrary>::@class::B::@constructor::new
factoryKeywordOffset: 46
typeName: B
typeNameOffset: 54
methods
#F5 hasImplicitReturnType isAbstract isOriginDeclaration B_ (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: <testLibrary>::@class::B::@method::B_
#F6 hasExtendsClause class C (nameOffset:86) (firstTokenOffset:80) (offset:86)
element: <testLibrary>::@class::C
typeParameters
#F7 T (nameOffset:88) (firstTokenOffset:88) (offset:88)
element: #E2 T
#F8 U (nameOffset:91) (firstTokenOffset:91) (offset:91)
element: #E3 U
constructors
#F9 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:114) (offset:114)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 114
typeAliases
#F10 A (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::A
typeParameters
#F11 T (nameOffset:10) (firstTokenOffset:10) (offset:10)
element: #E4 T
#F12 U (nameOffset:13) (firstTokenOffset:13) (offset:13)
element: #E5 U
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::C::@constructor::new
substitution: {T: U, U: T}
methods
isOriginDeclaration B_
reference: <testLibrary>::@class::B::@method::B_
firstFragment: #F5
returnType: dynamic
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F6
typeParameters
#E2 T
firstFragment: #F7
#E3 U
firstFragment: #F8
supertype: B<U, T>
constructors
hasEnclosingTypeParameterReference isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F9
typeAliases
isSimplyBounded A
reference: <testLibrary>::@typeAlias::A
firstFragment: #F10
typeParameters
#E4 T
firstFragment: #F11
#E5 U
firstFragment: #F12
aliasedType: C<T, U>
''');
}
test_constructor_secondary_redirected_factory_unnamed_imported() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
class D extends C {
D() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart';
class C {
factory C() = D;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart
classes
#F1 class C (nameOffset:26) (firstTokenOffset:20) (offset:26)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:32) (offset:40)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 32
typeName: C
typeNameOffset: 40
#F3 isOriginDeclaration _ (nameOffset:53) (firstTokenOffset:51) (offset:53)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 51
periodOffset: 52
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: package:test/foo.dart::@class::D::@constructor::new
isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F3
''');
}
test_constructor_secondary_redirected_factory_unnamed_imported_generic() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
class D<T, U> extends C<U, T> {
D() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart';
class C<T, U> {
factory C() = D<U, T>;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart
classes
#F1 class C (nameOffset:26) (firstTokenOffset:20) (offset:26)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:28) (firstTokenOffset:28) (offset:28)
element: #E0 T
#F3 U (nameOffset:31) (firstTokenOffset:31) (offset:31)
element: #E1 U
constructors
#F4 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:38) (offset:46)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 38
typeName: C
typeNameOffset: 46
#F5 isOriginDeclaration _ (nameOffset:65) (firstTokenOffset:63) (offset:65)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 63
periodOffset: 64
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: package:test/foo.dart::@class::D::@constructor::new
substitution: {T: U, U: T}
hasEnclosingTypeParameterReference isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F5
''');
}
test_constructor_secondary_redirected_factory_unnamed_imported_viaTypeAlias() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
typedef A = B;
class B extends C {
B() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart';
class C {
factory C() = A;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart
classes
#F1 class C (nameOffset:26) (firstTokenOffset:20) (offset:26)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:32) (offset:40)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 32
typeName: C
typeNameOffset: 40
#F3 isOriginDeclaration _ (nameOffset:53) (firstTokenOffset:51) (offset:53)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 51
periodOffset: 52
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: package:test/foo.dart::@class::B::@constructor::new
isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F3
''');
}
test_constructor_secondary_redirected_factory_unnamed_prefixed() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
class D extends C {
D() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart' as foo;
class C {
factory C() = foo.D;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart as foo (nameOffset:21) (firstTokenOffset:<null>) (offset:21)
prefixes
<testLibraryFragment>::@prefix::foo
fragments: @21
classes
#F1 class C (nameOffset:33) (firstTokenOffset:27) (offset:33)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:39) (offset:47)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 39
typeName: C
typeNameOffset: 47
#F3 isOriginDeclaration _ (nameOffset:64) (firstTokenOffset:62) (offset:64)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 62
periodOffset: 63
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: package:test/foo.dart::@class::D::@constructor::new
isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F3
''');
}
test_constructor_secondary_redirected_factory_unnamed_prefixed_generic() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
class D<T, U> extends C<U, T> {
D() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart' as foo;
class C<T, U> {
factory C() = foo.D<U, T>;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart as foo (nameOffset:21) (firstTokenOffset:<null>) (offset:21)
prefixes
<testLibraryFragment>::@prefix::foo
fragments: @21
classes
#F1 class C (nameOffset:33) (firstTokenOffset:27) (offset:33)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:35) (firstTokenOffset:35) (offset:35)
element: #E0 T
#F3 U (nameOffset:38) (firstTokenOffset:38) (offset:38)
element: #E1 U
constructors
#F4 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:45) (offset:53)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 45
typeName: C
typeNameOffset: 53
#F5 isOriginDeclaration _ (nameOffset:76) (firstTokenOffset:74) (offset:76)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 74
periodOffset: 75
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: package:test/foo.dart::@class::D::@constructor::new
substitution: {T: U, U: T}
hasEnclosingTypeParameterReference isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F5
''');
}
test_constructor_secondary_redirected_factory_unnamed_prefixed_viaTypeAlias() async {
newFile('$testPackageLibPath/foo.dart', r'''
import 'test.dart';
typedef A = B;
class B extends C {
B() : super._();
}
''');
var library = await buildLibrary(r'''
import 'foo.dart' as foo;
class C {
factory C() = foo.A;
C._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/foo.dart as foo (nameOffset:21) (firstTokenOffset:<null>) (offset:21)
prefixes
<testLibraryFragment>::@prefix::foo
fragments: @21
classes
#F1 class C (nameOffset:33) (firstTokenOffset:27) (offset:33)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:39) (offset:47)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 39
typeName: C
typeNameOffset: 47
#F3 isOriginDeclaration _ (nameOffset:64) (firstTokenOffset:62) (offset:64)
element: <testLibrary>::@class::C::@constructor::_
typeName: C
typeNameOffset: 62
periodOffset: 63
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: package:test/foo.dart::@class::B::@constructor::new
isOriginDeclaration _
reference: <testLibrary>::@class::C::@constructor::_
firstFragment: #F3
''');
}
test_constructor_secondary_redirected_factory_unnamed_unresolved() async {
var library = await buildLibrary(r'''
class C<E> {
factory C() = D<E>;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 E (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 E
constructors
#F3 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:15) (offset:23)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 15
typeName: C
typeNameOffset: 23
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 E
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
''');
}
test_constructor_secondary_redirected_factory_unnamed_viaTypeAlias() async {
var library = await buildLibrary(r'''
typedef A = C;
class B {
factory B() = A;
B._();
}
class C extends B {
C() : super._();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class B (nameOffset:22) (firstTokenOffset:16) (offset:22)
element: <testLibrary>::@class::B
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:28) (offset:36)
element: <testLibrary>::@class::B::@constructor::new
factoryKeywordOffset: 28
typeName: B
typeNameOffset: 36
#F3 isOriginDeclaration _ (nameOffset:49) (firstTokenOffset:47) (offset:49)
element: <testLibrary>::@class::B::@constructor::_
typeName: B
typeNameOffset: 47
periodOffset: 48
#F4 hasExtendsClause class C (nameOffset:63) (firstTokenOffset:57) (offset:63)
element: <testLibrary>::@class::C
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:79) (offset:79)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 79
typeAliases
#F6 A (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::A
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
constructors
isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F2
redirectedConstructor: <testLibrary>::@class::C::@constructor::new
isOriginDeclaration _
reference: <testLibrary>::@class::B::@constructor::_
firstFragment: #F3
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F4
supertype: B
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
superConstructor: <testLibrary>::@class::B::@constructor::_
typeAliases
isSimplyBounded A
reference: <testLibrary>::@typeAlias::A
firstFragment: #F6
aliasedType: C
''');
}
test_constructor_secondary_redirected_thisInvocation_cycle() async {
var library = await buildLibrary(r'''
class C {
C.a() : this.b();
C.b() : this.a();
}
''');
configuration.forClassConstructors(classNames: {'C'});
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isOriginDeclaration isRedirecting a (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::C::@constructor::a
typeName: C
typeNameOffset: 12
periodOffset: 13
#F3 isComplete isOriginDeclaration isRedirecting b (nameOffset:34) (firstTokenOffset:32) (offset:34)
element: <testLibrary>::@class::C::@constructor::b
typeName: C
typeNameOffset: 32
periodOffset: 33
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isInRedirectingConstructorCycle isOriginDeclaration isRedirecting a
reference: <testLibrary>::@class::C::@constructor::a
firstFragment: #F2
redirectedConstructor: <testLibrary>::@class::C::@constructor::b
isInRedirectingConstructorCycle isOriginDeclaration isRedirecting b
reference: <testLibrary>::@class::C::@constructor::b
firstFragment: #F3
redirectedConstructor: <testLibrary>::@class::C::@constructor::a
''');
}
test_constructor_secondary_redirected_thisInvocation_named() async {
var library = await buildLibrary(r'''
class C {
const C.named();
const C() : this.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginDeclaration named (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 18
periodOffset: 19
#F3 isComplete isConst isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 37
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F2
isConst isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @43
constructorSelector: ConstructorSelector
period: . @47
name2: named @48
argumentList: ArgumentList
leftParenthesis: ( @53
rightParenthesis: ) @54
period: . @47
constructorName: SimpleIdentifier
token: named @48
element: <testLibrary>::@class::C::@constructor::named
staticType: null
element: <testLibrary>::@class::C::@constructor::named
redirectedConstructor: <testLibrary>::@class::C::@constructor::named
''');
}
test_constructor_secondary_redirected_thisInvocation_named_generic() async {
var library = await buildLibrary(r'''
class C<T> {
const C.named();
const C() : this.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isConst isOriginDeclaration named (nameOffset:23) (firstTokenOffset:15) (offset:23)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 21
periodOffset: 22
#F4 isComplete isConst isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:34) (offset:40)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 40
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isConst isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F3
hasEnclosingTypeParameterReference isConst isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @46
constructorSelector: ConstructorSelector
period: . @50
name2: named @51
argumentList: ArgumentList
leftParenthesis: ( @56
rightParenthesis: ) @57
period: . @50
constructorName: SimpleIdentifier
token: named @51
element: <testLibrary>::@class::C::@constructor::named
staticType: null
element: <testLibrary>::@class::C::@constructor::named
redirectedConstructor: <testLibrary>::@class::C::@constructor::named
''');
}
test_constructor_secondary_redirected_thisInvocation_named_notConst() async {
var library = await buildLibrary(r'''
class C {
C.named();
C() : this.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 12
periodOffset: 13
#F3 isComplete isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 25
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F2
isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
redirectedConstructor: <testLibrary>::@class::C::@constructor::named
''');
}
test_constructor_secondary_redirected_thisInvocation_redirectsIntoCycle() async {
var library = await buildLibrary(r'''
class C {
C.a() : this.b();
C.b() : this.a();
C.c() : this.a();
}
''');
configuration.forClassConstructors(classNames: {'C'});
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isOriginDeclaration isRedirecting a (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::C::@constructor::a
typeName: C
typeNameOffset: 12
periodOffset: 13
#F3 isComplete isOriginDeclaration isRedirecting b (nameOffset:34) (firstTokenOffset:32) (offset:34)
element: <testLibrary>::@class::C::@constructor::b
typeName: C
typeNameOffset: 32
periodOffset: 33
#F4 isComplete isOriginDeclaration isRedirecting c (nameOffset:54) (firstTokenOffset:52) (offset:54)
element: <testLibrary>::@class::C::@constructor::c
typeName: C
typeNameOffset: 52
periodOffset: 53
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isInRedirectingConstructorCycle isOriginDeclaration isRedirecting a
reference: <testLibrary>::@class::C::@constructor::a
firstFragment: #F2
redirectedConstructor: <testLibrary>::@class::C::@constructor::b
isInRedirectingConstructorCycle isOriginDeclaration isRedirecting b
reference: <testLibrary>::@class::C::@constructor::b
firstFragment: #F3
redirectedConstructor: <testLibrary>::@class::C::@constructor::a
isOriginDeclaration isRedirecting c
reference: <testLibrary>::@class::C::@constructor::c
firstFragment: #F4
redirectedConstructor: <testLibrary>::@class::C::@constructor::a
''');
}
test_constructor_secondary_redirected_thisInvocation_unnamed() async {
var library = await buildLibrary(r'''
class C {
const C();
const C.named() : this();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 18
#F3 isComplete isConst isOriginDeclaration isRedirecting named (nameOffset:33) (firstTokenOffset:25) (offset:33)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 31
periodOffset: 32
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
isConst isOriginDeclaration isRedirecting named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F3
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @43
argumentList: ArgumentList
leftParenthesis: ( @47
rightParenthesis: ) @48
element: <testLibrary>::@class::C::@constructor::new
redirectedConstructor: <testLibrary>::@class::C::@constructor::new
''');
}
test_constructor_secondary_redirected_thisInvocation_unnamed_generic() async {
var library = await buildLibrary(r'''
class C<T> {
const C();
const C.named() : this();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 21
#F4 isComplete isConst isOriginDeclaration isRedirecting named (nameOffset:36) (firstTokenOffset:28) (offset:36)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 34
periodOffset: 35
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
hasEnclosingTypeParameterReference isConst isOriginDeclaration isRedirecting named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F4
constantInitializers
RedirectingConstructorInvocation
thisKeyword: this @46
argumentList: ArgumentList
leftParenthesis: ( @50
rightParenthesis: ) @51
element: <testLibrary>::@class::C::@constructor::new
redirectedConstructor: <testLibrary>::@class::C::@constructor::new
''');
}
test_constructor_secondary_redirected_thisInvocation_unnamed_notConst() async {
var library = await buildLibrary(r'''
class C {
C();
C.named() : this();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 12
#F3 isComplete isOriginDeclaration isRedirecting named (nameOffset:21) (firstTokenOffset:19) (offset:21)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 19
periodOffset: 20
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
isOriginDeclaration isRedirecting named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F3
redirectedConstructor: <testLibrary>::@class::C::@constructor::new
''');
}
test_constructor_secondary_redirectedConstructor_generic01() async {
// Note, this code has compile-time errors.
// `A` returned by the redirected constructor is not `B<U>`.
// But we still have some element model.
var library = await buildLibrary(r'''
class A implements B<int> {}
class B<U> implements C<U> {
factory B() = A;
}
class C<V> {
factory C() = B<V>;
}
''');
configuration
..forClassConstructors(classNames: {'C'})
..elementPrinterConfiguration.withRedirectedConstructors = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:87) (firstTokenOffset:81) (offset:87)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:96) (offset:104)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 96
typeName: C
typeNameOffset: 104
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::B::@constructor::new
substitution: {U: V}
redirectedConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_redirectedConstructor_generic11() async {
var library = await buildLibrary(r'''
class A<T> implements B<T> {}
class B<U> implements C<U> {
factory B() = A<U>;
}
class C<V> {
factory C() = B<V>;
}
''');
configuration
..forClassConstructors(classNames: {'C'})
..elementPrinterConfiguration.withRedirectedConstructors = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:91) (firstTokenOffset:85) (offset:91)
element: <testLibrary>::@class::C
constructors
#F2 isComplete isFactory isOriginDeclaration isRedirecting new (nameOffset:<null>) (firstTokenOffset:100) (offset:108)
element: <testLibrary>::@class::C::@constructor::new
factoryKeywordOffset: 100
typeName: C
typeNameOffset: 108
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
hasEnclosingTypeParameterReference isFactory isOriginDeclaration isRedirecting new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::B::@constructor::new
substitution: {U: V}
redirectedConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: V}
redirectedConstructor: <null>
''');
}
test_constructor_secondary_superConstructor_generic01() async {
var library = await buildLibrary(r'''
class A {}
class B<U> extends A {}
class C extends B<int> {}
''');
configuration
..forClassConstructors(classNames: {'C'})
..elementPrinterConfiguration.withSuperConstructors = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:43) (firstTokenOffset:37) (offset:43)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:43)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: B<int>
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::B::@constructor::new
substitution: {U: int}
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_superConstructor_generic11() async {
var library = await buildLibrary(r'''
class A<T> {}
class B<U> extends A<String> {}
class C extends B<int> {}
''');
configuration
..forClassConstructors(classNames: {'C'})
..elementPrinterConfiguration.withSuperConstructors = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:54) (firstTokenOffset:48) (offset:54)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:54)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: B<int>
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::B::@constructor::new
substitution: {U: int}
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: String}
superConstructor: dart:core::@class::Object::@constructor::new
''');
}
test_constructor_secondary_superConstructor_generic_named() async {
var library = await buildLibrary(r'''
class A<T> {
A.named(T a);
}
class B extends A<int> {
B() : super.named(0);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginDeclaration named (nameOffset:17) (firstTokenOffset:15) (offset:17)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 15
periodOffset: 16
formalParameters
#F4 requiredPositional isOriginDeclaration a (nameOffset:25) (firstTokenOffset:23) (offset:25)
element: <testLibrary>::@class::A::@constructor::named::@formalParameter::a
#F5 hasExtendsClause class B (nameOffset:38) (firstTokenOffset:32) (offset:38)
element: <testLibrary>::@class::B
constructors
#F6 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:59) (offset:59)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 59
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F3
formalParameters
#E1 requiredPositional a
firstFragment: #F4
type: T
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A<int>
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F6
superConstructor: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::named
substitution: {T: int}
''');
}
test_constructor_secondary_superConstructor_notGeneric_named() async {
var library = await buildLibrary(r'''
class A {
A.named();
}
class B extends A {
B() : super.named();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::named
typeName: A
typeNameOffset: 12
periodOffset: 13
#F3 hasExtendsClause class B (nameOffset:32) (firstTokenOffset:26) (offset:32)
element: <testLibrary>::@class::B
constructors
#F4 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:48) (offset:48)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 48
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration named
reference: <testLibrary>::@class::A::@constructor::named
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::A::@constructor::named
''');
}
test_constructor_secondary_superConstructor_notGeneric_unnamed_explicit() async {
var library = await buildLibrary(r'''
class A {}
class B extends A {
B() : super();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause class B (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::B
constructors
#F4 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:34) (offset:34)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 34
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_superConstructor_notGeneric_unnamed_implicit() async {
var library = await buildLibrary(r'''
class A {}
class B extends A {
B();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause class B (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::B
constructors
#F4 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:34) (offset:34)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 34
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_superConstructor_notGeneric_unnamed_implicit2() async {
var library = await buildLibrary(r'''
class A {}
class B extends A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause class B (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::A::@constructor::new
''');
}
test_constructor_secondary_unnamed() async {
var library = await buildLibrary(r'''
class C {
C();
}
''');
configuration.withDisplayName = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 12
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_unnamed_implicit() async {
var library = await buildLibrary(r'''
class C {}
''');
configuration.withDisplayName = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_unnamed_new() async {
var library = await buildLibrary(r'''
class C {
C.new();
}
''');
configuration.withDisplayName = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginDeclaration new (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 12
periodOffset: 13
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
''');
}
test_constructor_secondary_withCycles_const() async {
var library = await buildLibrary(r'''
class C {
final x;
const C() : x = const D();
}
class D {
final x;
const D() : x = const C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 29
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
#F5 class D (nameOffset:59) (firstTokenOffset:53) (offset:59)
element: <testLibrary>::@class::D
fields
#F6 hasImplicitType isFinal isOriginDeclaration x (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: <testLibrary>::@class::D::@field::x
inducedGetter: #F7
constructors
#F8 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:76) (offset:82)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
typeNameOffset: 82
getters
#F7 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::D::@getter::x
inducingVariable: #F6
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: x @35
element: <testLibrary>::@class::C::@field::x
staticType: null
equals: = @37
expression2: InstanceCreationExpression
keyword: const @39
constructorName: ConstructorName
type: NamedType
name: D @45
element: <testLibrary>::@class::D
type: D
element: <testLibrary>::@class::D::@constructor::new
argumentList: ArgumentList
leftParenthesis: ( @46
rightParenthesis: ) @47
staticType: D
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F5
fields
hasImplicitType isFinal isOriginDeclaration x
reference: <testLibrary>::@class::D::@field::x
firstFragment: #F6
type: dynamic
getter: <testLibrary>::@class::D::@getter::x
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F8
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: x @88
element: <testLibrary>::@class::D::@field::x
staticType: null
equals: = @90
expression2: InstanceCreationExpression
keyword: const @92
constructorName: ConstructorName
type: NamedType
name: C @98
element: <testLibrary>::@class::C
type: C
element: <testLibrary>::@class::C::@constructor::new
argumentList: ArgumentList
leftParenthesis: ( @99
rightParenthesis: ) @100
staticType: C
getters
isOriginVariable x
reference: <testLibrary>::@class::D::@getter::x
firstFragment: #F7
returnType: dynamic
variable: <testLibrary>::@class::D::@field::x
''');
}
test_constructor_secondary_withCycles_nonConst() async {
var library = await buildLibrary(r'''
class C {
final x;
C() : x = new D();
}
class D {
final x;
D() : x = new C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 23
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
#F5 class D (nameOffset:51) (firstTokenOffset:45) (offset:51)
element: <testLibrary>::@class::D
fields
#F6 hasImplicitType isFinal isOriginDeclaration x (nameOffset:63) (firstTokenOffset:63) (offset:63)
element: <testLibrary>::@class::D::@field::x
inducedGetter: #F7
constructors
#F8 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:68) (offset:68)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
typeNameOffset: 68
getters
#F7 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::D::@getter::x
inducingVariable: #F6
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isFinal isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F5
fields
hasImplicitType isFinal isOriginDeclaration x
reference: <testLibrary>::@class::D::@field::x
firstFragment: #F6
type: dynamic
getter: <testLibrary>::@class::D::@getter::x
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F8
getters
isOriginVariable x
reference: <testLibrary>::@class::D::@getter::x
firstFragment: #F7
returnType: dynamic
variable: <testLibrary>::@class::D::@field::x
''');
}
test_field_abstract() async {
var library = await buildLibrary(r'''
abstract class C {
abstract int i;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class C (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::C
fields
#F2 isAbstract isOriginDeclaration i (nameOffset:34) (firstTokenOffset:34) (offset:34)
element: <testLibrary>::@class::C::@field::i
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isAbstract isOriginVariable i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::C::@getter::i
inducingVariable: #F2
setters
#F4 isAbstract isOriginVariable i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::C::@setter::i
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::C::@setter::i::@formalParameter::value
classes
isAbstract isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isAbstract isOriginDeclaration i
reference: <testLibrary>::@class::C::@field::i
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::i
setter: <testLibrary>::@class::C::@setter::i
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable i
reference: <testLibrary>::@class::C::@getter::i
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::i
setters
isOriginVariable i
reference: <testLibrary>::@class::C::@setter::i
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::i
''');
}
test_field_augmentation_add() async {
var library = await buildLibrary(r'''
class A {
int foo1 = 0;
}
augment class A {
int foo2 = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo1 (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo1
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo1
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo1
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo1::@formalParameter::value
#F2 isAugmentation class A (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F8 hasInitializer isOriginDeclaration foo2 (nameOffset:53) (firstTokenOffset:53) (offset:53)
element: <testLibrary>::@class::A::@field::foo2
inducedGetter: #F9
inducedSetter: #F10
getters
#F9 isComplete isOriginVariable foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::A::@getter::foo2
inducingVariable: #F8
setters
#F10 isComplete isOriginVariable foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::A::@setter::foo2
inducingVariable: #F8
formalParameters
#F11 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::A::@setter::foo2::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@field::foo1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo1
setter: <testLibrary>::@class::A::@setter::foo1
hasInitializer isOriginDeclaration foo2
reference: <testLibrary>::@class::A::@field::foo2
firstFragment: #F8
type: int
getter: <testLibrary>::@class::A::@getter::foo2
setter: <testLibrary>::@class::A::@setter::foo2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo1
reference: <testLibrary>::@class::A::@getter::foo1
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo1
isOriginVariable foo2
reference: <testLibrary>::@class::A::@getter::foo2
firstFragment: #F9
returnType: int
variable: <testLibrary>::@class::A::@field::foo2
setters
isOriginVariable foo1
reference: <testLibrary>::@class::A::@setter::foo1
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo1
isOriginVariable foo2
reference: <testLibrary>::@class::A::@setter::foo2
firstFragment: #F10
formalParameters
#E1 requiredPositional value
firstFragment: #F11
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo2
''');
}
test_field_augmentation_add_generic() async {
var library = await buildLibrary(r'''
class A<T> {
T foo1;
}
augment class A<T> {
T foo2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
fields
#F5 isOriginDeclaration foo1 (nameOffset:17) (firstTokenOffset:17) (offset:17)
element: <testLibrary>::@class::A::@field::foo1
inducedGetter: #F6
inducedSetter: #F7
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F6 isComplete isOriginVariable foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@getter::foo1
inducingVariable: #F5
setters
#F7 isComplete isOriginVariable foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@setter::foo1
inducingVariable: #F5
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@setter::foo1::@formalParameter::value
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:42) (firstTokenOffset:42) (offset:42)
element: #E0 T
previousFragment: #F3
fields
#F10 isOriginDeclaration foo2 (nameOffset:51) (firstTokenOffset:51) (offset:51)
element: <testLibrary>::@class::A::@field::foo2
inducedGetter: #F11
inducedSetter: #F12
getters
#F11 isComplete isOriginVariable foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:51)
element: <testLibrary>::@class::A::@getter::foo2
inducingVariable: #F10
setters
#F12 isComplete isOriginVariable foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:51)
element: <testLibrary>::@class::A::@setter::foo2
inducingVariable: #F10
formalParameters
#F13 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:51)
element: <testLibrary>::@class::A::@setter::foo2::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
fields
hasEnclosingTypeParameterReference isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@field::foo1
firstFragment: #F5
type: T
getter: <testLibrary>::@class::A::@getter::foo1
setter: <testLibrary>::@class::A::@setter::foo1
hasEnclosingTypeParameterReference isOriginDeclaration foo2
reference: <testLibrary>::@class::A::@field::foo2
firstFragment: #F10
type: T
getter: <testLibrary>::@class::A::@getter::foo2
setter: <testLibrary>::@class::A::@setter::foo2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F8
getters
hasEnclosingTypeParameterReference isOriginVariable foo1
reference: <testLibrary>::@class::A::@getter::foo1
firstFragment: #F6
returnType: T
variable: <testLibrary>::@class::A::@field::foo1
hasEnclosingTypeParameterReference isOriginVariable foo2
reference: <testLibrary>::@class::A::@getter::foo2
firstFragment: #F11
returnType: T
variable: <testLibrary>::@class::A::@field::foo2
setters
hasEnclosingTypeParameterReference isOriginVariable foo1
reference: <testLibrary>::@class::A::@setter::foo1
firstFragment: #F7
formalParameters
#E1 requiredPositional value
firstFragment: #F9
type: T
returnType: void
variable: <testLibrary>::@class::A::@field::foo1
hasEnclosingTypeParameterReference isOriginVariable foo2
reference: <testLibrary>::@class::A::@setter::foo2
firstFragment: #F12
formalParameters
#E2 requiredPositional value
firstFragment: #F13
type: T
returnType: void
variable: <testLibrary>::@class::A::@field::foo2
''');
}
test_field_augmentation_add_staticConst_hasConstConstructor() async {
var library = await buildLibrary(r'''
class A {
const A();
}
augment class A {
static const int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 18
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isConst isOriginDeclaration isStatic foo (nameOffset:63) (firstTokenOffset:63) (offset:63)
element: <testLibrary>::@class::A::@field::foo
initializer: expression_0
IntegerLiteral
literal: 0 @69
staticType: int
inducedGetter: #F5
getters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isConst isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
constantInitializer
fragment: #F4
expression: expression_0
getter: <testLibrary>::@class::A::@getter::foo
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_add_staticConst_noConstConstructor() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
static const int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isConst isOriginDeclaration isStatic foo (nameOffset:49) (firstTokenOffset:49) (offset:49)
element: <testLibrary>::@class::A::@field::foo
initializer: expression_0
IntegerLiteral
literal: 0 @55
staticType: int
inducedGetter: #F5
getters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isConst isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
constantInitializer
fragment: #F4
expression: expression_0
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_add_staticFinal_hasConstConstructor() async {
var library = await buildLibrary(r'''
class A {
const A();
}
augment class A {
final int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 18
#F2 isAugmentation class A (nameOffset:40) (firstTokenOffset:26) (offset:40)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isFinal isOriginDeclaration foo (nameOffset:56) (firstTokenOffset:56) (offset:56)
element: <testLibrary>::@class::A::@field::foo
initializer: expression_0
IntegerLiteral
literal: 0 @62
staticType: int
inducedGetter: #F5
getters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:56)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
constantInitializer
fragment: #F4
expression: expression_0
getter: <testLibrary>::@class::A::@getter::foo
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_add_staticFinal_noConstConstructor() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
final int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isFinal isOriginDeclaration foo (nameOffset:42) (firstTokenOffset:42) (offset:42)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F5
getters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:42)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_add_usedByConstructorFieldInitializer() async {
var library = await buildLibrary(r'''
class A {
const A() : foo = 0;
}
augment class A {
final int foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 18
#F2 isAugmentation class A (nameOffset:50) (firstTokenOffset:36) (offset:50)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 isFinal isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:66) (offset:66)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F5
getters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
constantInitializers
ConstructorFieldInitializer
fieldName: SimpleIdentifier
token: foo @24
element: <testLibrary>::@class::A::@field::foo
staticType: null
equals: = @28
expression2: IntegerLiteral
literal: 0 @30
staticType: int
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_add_usedByFieldFormalParameter() async {
var library = await buildLibrary(r'''
class A {
A(this.foo);
}
augment class A {
final int foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 12
formalParameters
#F4 requiredPositional hasImplicitType isFinal isOriginDeclaration this.foo (nameOffset:19) (firstTokenOffset:14) (offset:19)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isFinal isOriginDeclaration foo (nameOffset:58) (firstTokenOffset:58) (offset:58)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F6
getters
#F6 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:58)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.foo
firstFragment: #F4
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment int foo = 1;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
nextFragment: #F6
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F8
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F10
nextFragment: #F11
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:60) (firstTokenOffset:60) (offset:60)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F8
inducedSetter: #F11
previousFragment: #F3
getters
#F8 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F6
previousFragment: #F4
setters
#F11 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F6
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F9
previousFragment: #F5
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F7
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain_afterGetter() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment int get foo => 1;
}
augment class A {
augment int foo = 2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
nextFragment: #F6
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F8
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F10
nextFragment: #F11
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F12
getters
#F8 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:48) (offset:64)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F4
nextFragment: #F13
#F12 isAugmentation class A (nameOffset:91) (firstTokenOffset:77) (offset:91)
element: <testLibrary>::@class::A
previousFragment: #F2
fields
#F6 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:109) (firstTokenOffset:109) (offset:109)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F13
inducedSetter: #F11
previousFragment: #F3
getters
#F13 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:109)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F6
previousFragment: #F8
setters
#F11 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:109)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F6
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:109)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F9
previousFragment: #F5
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F7
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain_afterSetter() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment set foo(int _) {}
}
augment class A {
augment int foo = 2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
nextFragment: #F6
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F8
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F10
nextFragment: #F11
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F12
setters
#F11 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:60) (firstTokenOffset:48) (offset:60)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F10 requiredPositional isOriginDeclaration _ (nameOffset:68) (firstTokenOffset:64) (offset:68)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F9
nextFragment: #F13
previousFragment: #F5
nextFragment: #F14
#F12 isAugmentation class A (nameOffset:91) (firstTokenOffset:77) (offset:91)
element: <testLibrary>::@class::A
previousFragment: #F2
fields
#F6 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:109) (firstTokenOffset:109) (offset:109)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F8
inducedSetter: #F14
previousFragment: #F3
getters
#F8 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:109)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F6
previousFragment: #F4
setters
#F14 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:109)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F6
formalParameters
#F13 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:109)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F10
previousFragment: #F11
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F7
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain_augmentedInvocation() async {
// This is invalid code, but it should not crash.
var library = await buildLibrary(r'''
class A {
static const int foo = 0;
}
augment class A {;
augment static const int foo = augmented();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isConst isOriginDeclaration isStatic foo (nameOffset:29) (firstTokenOffset:29) (offset:29)
element: <testLibrary>::@class::A::@field::foo
initializer: expression_0
IntegerLiteral
literal: 0 @35
staticType: null
inducedGetter: #F4
nextFragment: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F7
#F2 isAugmentation class A (nameOffset:55) (firstTokenOffset:41) (offset:55)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 hasInitializer isAugmentation isConst isOriginDeclaration isStatic foo (nameOffset:87) (firstTokenOffset:87) (offset:87)
element: <testLibrary>::@class::A::@field::foo
initializer: expression_1
MethodInvocation
methodName: SimpleIdentifier
token: augmented @93
element: <null>
staticType: InvalidType
argumentList: ArgumentList
leftParenthesis: ( @102
rightParenthesis: ) @103
staticInvokeType: InvalidType
staticType: InvalidType
inducedGetter: #F7
previousFragment: #F3
getters
#F7 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:87)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F5
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isConst isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
constantInitializer
fragment: #F5
expression: expression_1
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain_augmentedPlus() async {
var library = await buildLibrary(r'''
class A {
final int foo = 0;
const A();
}
augment class A {
augment final int foo = augmented + 1;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isFinal isOriginDeclaration foo (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::foo
initializer: expression_0
IntegerLiteral
literal: 0 @28
staticType: null
inducedGetter: #F4
nextFragment: #F5
constructors
#F6 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 39
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F7
#F2 isAugmentation class A (nameOffset:61) (firstTokenOffset:47) (offset:61)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 hasInitializer isAugmentation isFinal isOriginDeclaration foo (nameOffset:85) (firstTokenOffset:85) (offset:85)
element: <testLibrary>::@class::A::@field::foo
initializer: expression_1
BinaryExpression
leftOperand2: SimpleIdentifier
token: augmented @91
element: <null>
staticType: InvalidType
operator: + @101
rightOperand2: IntegerLiteral
literal: 1 @103
staticType: int
element: <null>
staticInvokeType: null
staticType: InvalidType
inducedGetter: #F7
previousFragment: #F3
getters
#F7 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:85)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F5
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
constantInitializer
fragment: #F5
expression: expression_1
getter: <testLibrary>::@class::A::@getter::foo
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain_differentType() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment double foo = 1.2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
nextFragment: #F6
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F8
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F10
nextFragment: #F11
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:63) (firstTokenOffset:63) (offset:63)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F8
inducedSetter: #F11
previousFragment: #F3
getters
#F8 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F6
previousFragment: #F4
setters
#F11 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F6
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F9
previousFragment: #F5
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F7
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain_finalThenNonFinal() async {
var library = await buildLibrary(r'''
class A {
final int foo = 0;
}
augment class A {
augment int foo = 1;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isFinal isOriginDeclaration foo (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
nextFragment: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F7
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:66) (offset:66)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F7
inducedSetter: #F8
previousFragment: #F3
getters
#F7 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F5
previousFragment: #F4
setters
#F8 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F5
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F8
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain_noIntroductoryDeclaration() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
augment int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:44) (firstTokenOffset:44) (offset:44)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F5
inducedSetter: #F6
getters
#F5 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
setters
#F6 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F4
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_chain_twoDeclarations() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment int foo = 1;
}
augment class A {
augment int foo = 2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
nextFragment: #F6
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F8
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F10
nextFragment: #F11
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F12
fields
#F6 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:60) (firstTokenOffset:60) (offset:60)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F8
inducedSetter: #F11
previousFragment: #F3
nextFragment: #F13
getters
#F8 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F6
previousFragment: #F4
nextFragment: #F14
setters
#F11 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F6
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F9
nextFragment: #F15
previousFragment: #F5
nextFragment: #F16
#F12 isAugmentation class A (nameOffset:86) (firstTokenOffset:72) (offset:86)
element: <testLibrary>::@class::A
previousFragment: #F2
fields
#F13 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:104) (firstTokenOffset:104) (offset:104)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F14
inducedSetter: #F16
previousFragment: #F6
getters
#F14 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:104)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F13
previousFragment: #F8
setters
#F16 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:104)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F13
formalParameters
#F15 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:104)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F10
previousFragment: #F11
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F7
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_sameName_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:55) (offset:55)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F5
inducedSetter: #F6
getters
#F5 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:55)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
setters
#F6 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:55)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F4
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:55)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
/// This is not allowed by the specification, but allowed syntactically,
/// so we need a way to handle it.
test_field_augmentation_sameName_instanceGetter() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment int foo = 1;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F6 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
nextFragment: #F7
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:65) (firstTokenOffset:65) (offset:65)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F7
inducedSetter: #F8
previousFragment: #F3
getters
#F7 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:65)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
previousFragment: #F6
setters
#F8 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:65)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F4
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:65)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F8
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_sameName_instanceMethod() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment int foo = 1;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:61) (firstTokenOffset:61) (offset:61)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F6
inducedSetter: #F7
getters
#F6 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F5
setters
#F7 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F5
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
previousFragmentOfDifferentKind: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F7
formalParameters
#E0 requiredPositional value
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
/// This is not allowed by the specification, but allowed syntactically,
/// so we need a way to handle it.
test_field_augmentation_sameName_instanceSetter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {}
}
augment class A {
augment int foo = 1;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F6 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F8
nextFragment: #F9
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:65) (firstTokenOffset:65) (offset:65)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F10
inducedSetter: #F9
previousFragment: #F3
getters
#F10 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:65)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
setters
#F9 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:65)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F4
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:65)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F7
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: InvalidType
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F10
returnType: InvalidType
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_augmentation_sameName_staticField() async {
var library = await buildLibrary(r'''
class A {
static int foo = 0;
}
augment class A {
augment int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F8 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:66) (offset:66)
element: <testLibrary>::@class::A::@field::foo#1
inducedGetter: #F9
inducedSetter: #F10
getters
#F9 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@getter::foo#1
inducingVariable: #F8
setters
#F10 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@setter::foo#1
inducingVariable: #F8
formalParameters
#F11 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@setter::foo#1::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F8
type: int
getter: <testLibrary>::@class::A::@getter::foo#1
setter: <testLibrary>::@class::A::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo#1
firstFragment: #F9
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo#1
firstFragment: #F10
formalParameters
#E1 requiredPositional value
firstFragment: #F11
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_field_augmentation_sameName_staticGetter() async {
var library = await buildLibrary(r'''
class A {
static int get foo => 0;
}
augment class A {
augment int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration isStatic foo (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: <testLibrary>::@class::A::@field::foo#1
inducedGetter: #F7
inducedSetter: #F8
getters
#F7 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@getter::foo#1
inducingVariable: #F6
setters
#F8 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F6
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F6
type: int
getter: <testLibrary>::@class::A::@getter::foo#1
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo#1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F8
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_field_augmentation_sameName_staticMethod() async {
var library = await buildLibrary(r'''
class A {
static void foo() {}
}
augment class A {
augment int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:67) (firstTokenOffset:67) (offset:67)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F6
inducedSetter: #F7
getters
#F6 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F5
setters
#F7 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F5
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F7
formalParameters
#E0 requiredPositional value
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_field_augmentation_sameName_staticSetter() async {
var library = await buildLibrary(r'''
class A {
static set foo(int _) {}
}
augment class A {
augment int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F7 hasInitializer isAugmentation isOriginDeclaration foo (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: <testLibrary>::@class::A::@field::foo#1
inducedGetter: #F8
inducedSetter: #F9
getters
#F8 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F7
setters
#F9 isAugmentation isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@setter::foo#1
inducingVariable: #F7
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@setter::foo#1::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F7
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F8
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo#1
firstFragment: #F9
formalParameters
#E1 requiredPositional value
firstFragment: #F10
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_field_const() async {
var library = await buildLibrary(r'''
class C {
static const int i = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasInitializer isConst isOriginDeclaration isStatic i (nameOffset:29) (firstTokenOffset:29) (offset:29)
element: <testLibrary>::@class::C::@field::i
initializer: expression_0
IntegerLiteral
literal: 0 @33
staticType: int
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable isStatic i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29)
element: <testLibrary>::@class::C::@getter::i
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasInitializer isConst isOriginDeclaration isStatic i
reference: <testLibrary>::@class::C::@field::i
firstFragment: #F2
type: int
constantInitializer
fragment: #F2
expression: expression_0
getter: <testLibrary>::@class::C::@getter::i
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable isStatic i
reference: <testLibrary>::@class::C::@getter::i
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::i
''');
}
test_field_const_late() async {
var library = await buildLibrary(r'''
class C {
static late const int i = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasInitializer isConst isLate isOriginDeclaration isStatic i (nameOffset:34) (firstTokenOffset:34) (offset:34)
element: <testLibrary>::@class::C::@field::i
initializer: expression_0
IntegerLiteral
literal: 0 @38
staticType: int
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable isStatic i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::C::@getter::i
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasInitializer isConst isLate isOriginDeclaration isStatic i
reference: <testLibrary>::@class::C::@field::i
firstFragment: #F2
type: int
constantInitializer
fragment: #F2
expression: expression_0
getter: <testLibrary>::@class::C::@getter::i
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable isStatic i
reference: <testLibrary>::@class::C::@getter::i
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::i
''');
}
test_field_covariant() async {
var library = await buildLibrary(r'''
class C {
covariant int x;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isExplicitlyCovariant isOriginDeclaration x (nameOffset:26) (firstTokenOffset:26) (offset:26)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F6 requiredPositional isExplicitlyCovariant value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isCovariant isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional isCovariant value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_documented() async {
var library = await buildLibrary(r'''
class C {
/**
* Docs
*/
var x;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration x (nameOffset:38) (firstTokenOffset:38) (offset:38)
element: <testLibrary>::@class::C::@field::x
documentationComment: /**\n * Docs\n */
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:38)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:38)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:38)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
documentationComment: /**\n * Docs\n */
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_duplicate_getter() async {
var library = await buildLibrary(r'''
class C {
int foo = 0;
int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F3
inducedSetter: #F4
#F5 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::foo#1
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F2
#F7 isComplete isOriginDeclaration foo (nameOffset:35) (firstTokenOffset:27) (offset:35)
element: <testLibrary>::@class::C::@getter::foo#1
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::foo
inducingVariable: #F2
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::foo
setter: <testLibrary>::@class::C::@setter::foo
isOriginGetterSetter foo
reference: <testLibrary>::@class::C::@field::foo#1
firstFragment: #F5
type: int
getter: <testLibrary>::@class::C::@getter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::foo
isOriginDeclaration foo
reference: <testLibrary>::@class::C::@getter::foo#1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::C::@field::foo#1
setters
isOriginVariable foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_field_duplicate_setter() async {
var library = await buildLibrary(r'''
class C {
int foo = 0;
set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F3
inducedSetter: #F4
#F5 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::foo#1
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::foo
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::value
#F8 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::C::@setter::foo#1
formalParameters
#F9 requiredPositional isOriginDeclaration _ (nameOffset:39) (firstTokenOffset:35) (offset:39)
element: <testLibrary>::@class::C::@setter::foo#1::@formalParameter::_
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::foo
setter: <testLibrary>::@class::C::@setter::foo
isOriginGetterSetter foo
reference: <testLibrary>::@class::C::@field::foo#1
firstFragment: #F5
type: int
setter: <testLibrary>::@class::C::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo
isOriginDeclaration foo
reference: <testLibrary>::@class::C::@setter::foo#1
firstFragment: #F8
formalParameters
#E1 requiredPositional _
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo#1
''');
}
test_field_external() async {
var library = await buildLibrary(r'''
abstract class C {
external int i;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class C (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::C
fields
#F2 isExternal isOriginDeclaration i (nameOffset:34) (firstTokenOffset:34) (offset:34)
element: <testLibrary>::@class::C::@field::i
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::C::@getter::i
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::C::@setter::i
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::C::@setter::i::@formalParameter::value
classes
hasNonFinalField isAbstract isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isExternal isOriginDeclaration i
reference: <testLibrary>::@class::C::@field::i
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::i
setter: <testLibrary>::@class::C::@setter::i
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable i
reference: <testLibrary>::@class::C::@getter::i
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::i
setters
isOriginVariable i
reference: <testLibrary>::@class::C::@setter::i
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::i
''');
}
test_field_final_hasInitializer_hasConstConstructor() async {
var library = await buildLibrary(r'''
class C {
final x = 42;
const C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::x
initializer: expression_0
IntegerLiteral
literal: 42 @22
staticType: int
inducedGetter: #F3
constructors
#F4 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 34
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
constantInitializer
fragment: #F2
expression: expression_0
getter: <testLibrary>::@class::C::@getter::x
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_final_hasInitializer_hasConstConstructor_genericFunctionType() async {
var library = await buildLibrary(r'''
class A<T> {
const A();
}
class B {
final f = const A<int Function(double a)>();
const B();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 21
#F4 class B (nameOffset:35) (firstTokenOffset:29) (offset:35)
element: <testLibrary>::@class::B
fields
#F5 hasImplicitType hasInitializer isFinal isOriginDeclaration f (nameOffset:47) (firstTokenOffset:47) (offset:47)
element: <testLibrary>::@class::B::@field::f
initializer: expression_0
InstanceCreationExpression
keyword: const @51
constructorName: ConstructorName
type: NamedType
name: A @57
typeArguments: TypeArgumentList
leftBracket: < @58
arguments
GenericFunctionType
returnType: NamedType
name: int @59
element: dart:core::@class::int
type: int
functionKeyword: Function @63
parameters: FormalParameterList
leftParenthesis: ( @71
requiredPositionalFormalParameters
RegularFormalParameter
type: NamedType
name: double @72
element: dart:core::@class::double
type: double
name: a @79
declaredFragment: <testLibraryFragment> a@79
element: isPublic
type: double
rightParenthesis: ) @80
parameters(v1): FormalParameterList
leftParenthesis: ( @71
parameter: RegularFormalParameter
type: NamedType
name: double @72
element: dart:core::@class::double
type: double
name: a @79
declaredFragment: <testLibraryFragment> a@79
element: isPublic
type: double
rightParenthesis: ) @80
declaredFragment: GenericFunctionTypeElement
parameters
a
kind: required positional
element:
type: double
returnType: int
type: int Function(double)
type: int Function(double)
rightBracket: > @81
element: <testLibrary>::@class::A
type: A<int Function(double)>
element: SubstitutedConstructorElementImpl
baseElement: <testLibrary>::@class::A::@constructor::new
substitution: {T: int Function(double)}
argumentList: ArgumentList
leftParenthesis: ( @82
rightParenthesis: ) @83
staticType: A<int Function(double)>
inducedGetter: #F6
constructors
#F7 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:88) (offset:94)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 94
getters
#F6 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47)
element: <testLibrary>::@class::B::@getter::f
inducingVariable: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer f
reference: <testLibrary>::@class::B::@field::f
firstFragment: #F5
type: A<int Function(double)>
constantInitializer
fragment: #F5
expression: expression_0
getter: <testLibrary>::@class::B::@getter::f
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F7
getters
isOriginVariable f
reference: <testLibrary>::@class::B::@getter::f
firstFragment: #F6
returnType: A<int Function(double)>
variable: <testLibrary>::@class::B::@field::f
''');
}
test_field_final_hasInitializer_noConstConstructor() async {
var library = await buildLibrary(r'''
class C {
final x = 42;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_final_withSetter() async {
var library = await buildLibrary(r'''
class A {
final int foo;
A(this.foo);
set foo(int newValue) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaration foo (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
constructors
#F4 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:29) (offset:29)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 29
formalParameters
#F5 requiredPositional hasImplicitType isFinal isOriginDeclaration this.foo (nameOffset:36) (firstTokenOffset:31) (offset:36)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
setters
#F6 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:48) (firstTokenOffset:44) (offset:48)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration newValue (nameOffset:56) (firstTokenOffset:52) (offset:56)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::newValue
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.foo
firstFragment: #F5
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
formalParameters
#E1 requiredPositional newValue
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_formalParameter_inferredType_implicit() async {
var library = await buildLibrary(r'''
class C extends D {
var v;
C(this.v);
}
abstract class D {
int get v;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration v (nameOffset:26) (firstTokenOffset:26) (offset:26)
element: <testLibrary>::@class::C::@field::v
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isComplete isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:31) (offset:31)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 31
formalParameters
#F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.v (nameOffset:38) (firstTokenOffset:33) (offset:38)
element: <testLibrary>::@class::C::@constructor::new::@formalParameter::v
getters
#F3 isComplete isOriginVariable v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@getter::v
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@setter::v
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@setter::v::@formalParameter::value
#F8 isAbstract class D (nameOffset:60) (firstTokenOffset:45) (offset:60)
element: <testLibrary>::@class::D
fields
#F9 isOriginGetterSetter v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::D::@field::v
constructors
#F10 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
getters
#F11 isAbstract isOriginDeclaration v (nameOffset:74) (firstTokenOffset:66) (offset:74)
element: <testLibrary>::@class::D::@getter::v
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
fields
hasImplicitType isOriginDeclaration v
reference: <testLibrary>::@class::C::@field::v
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::v
setter: <testLibrary>::@class::C::@setter::v
constructors
isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.v
firstFragment: #F6
type: int
field: <testLibrary>::@class::C::@field::v
superConstructor: <testLibrary>::@class::D::@constructor::new
getters
isOriginVariable v
reference: <testLibrary>::@class::C::@getter::v
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::v
setters
isOriginVariable v
reference: <testLibrary>::@class::C::@setter::v
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::v
isAbstract isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F8
fields
isOriginGetterSetter v
reference: <testLibrary>::@class::D::@field::v
firstFragment: #F9
type: int
getter: <testLibrary>::@class::D::@getter::v
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F10
getters
isOriginDeclaration v
reference: <testLibrary>::@class::D::@getter::v
firstFragment: #F11
returnType: int
variable: <testLibrary>::@class::D::@field::v
''');
}
test_field_implicit_type() async {
var library = await buildLibrary(r'''
class C {
var x;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_implicit_type_late() async {
var library = await buildLibrary(r'''
class C {
late var x;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isLate isOriginDeclaration x (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType isLate isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_inferred_type_nonStatic_explicit_initialized() async {
var library = await buildLibrary(r'''
class C {
num v = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasInitializer isOriginDeclaration v (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::v
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::v
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::v
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::v::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasInitializer isOriginDeclaration v
reference: <testLibrary>::@class::C::@field::v
firstFragment: #F2
type: num
getter: <testLibrary>::@class::C::@getter::v
setter: <testLibrary>::@class::C::@setter::v
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable v
reference: <testLibrary>::@class::C::@getter::v
firstFragment: #F3
returnType: num
variable: <testLibrary>::@class::C::@field::v
setters
isOriginVariable v
reference: <testLibrary>::@class::C::@setter::v
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: num
returnType: void
variable: <testLibrary>::@class::C::@field::v
''');
}
test_field_inferred_type_nonStatic_implicit_initialized() async {
var library = await buildLibrary(r'''
class C {
var v = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isOriginDeclaration v (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::v
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::v
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::v
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::v::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isOriginDeclaration isTypeInferredFromInitializer v
reference: <testLibrary>::@class::C::@field::v
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::v
setter: <testLibrary>::@class::C::@setter::v
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable v
reference: <testLibrary>::@class::C::@getter::v
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::v
setters
isOriginVariable v
reference: <testLibrary>::@class::C::@setter::v
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::v
''');
}
test_field_inferred_type_nonStatic_implicit_uninitialized() async {
var library = await buildLibrary(r'''
class C extends D {
var v;
}
abstract class D {
int get v;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType isOriginDeclaration v (nameOffset:26) (firstTokenOffset:26) (offset:26)
element: <testLibrary>::@class::C::@field::v
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@getter::v
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@setter::v
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::C::@setter::v::@formalParameter::value
#F7 isAbstract class D (nameOffset:47) (firstTokenOffset:32) (offset:47)
element: <testLibrary>::@class::D
fields
#F8 isOriginGetterSetter v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47)
element: <testLibrary>::@class::D::@field::v
constructors
#F9 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
getters
#F10 isAbstract isOriginDeclaration v (nameOffset:61) (firstTokenOffset:53) (offset:61)
element: <testLibrary>::@class::D::@getter::v
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
fields
hasImplicitType isOriginDeclaration v
reference: <testLibrary>::@class::C::@field::v
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::v
setter: <testLibrary>::@class::C::@setter::v
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
superConstructor: <testLibrary>::@class::D::@constructor::new
getters
isOriginVariable v
reference: <testLibrary>::@class::C::@getter::v
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::v
setters
isOriginVariable v
reference: <testLibrary>::@class::C::@setter::v
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::v
isAbstract isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F7
fields
isOriginGetterSetter v
reference: <testLibrary>::@class::D::@field::v
firstFragment: #F8
type: int
getter: <testLibrary>::@class::D::@getter::v
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F9
getters
isOriginDeclaration v
reference: <testLibrary>::@class::D::@getter::v
firstFragment: #F10
returnType: int
variable: <testLibrary>::@class::D::@field::v
''');
}
test_field_inferred_type_nonStatic_inherited_resolveInitializer() async {
var library = await buildLibrary(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
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class A (nameOffset:29) (firstTokenOffset:14) (offset:29)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29)
element: <testLibrary>::@class::A::@field::f
constructors
#F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:35) (offset:41)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 41
getters
#F4 isAbstract isOriginDeclaration f (nameOffset:62) (firstTokenOffset:48) (offset:62)
element: <testLibrary>::@class::A::@getter::f
#F5 hasExtendsClause class B (nameOffset:74) (firstTokenOffset:68) (offset:74)
element: <testLibrary>::@class::B
fields
#F6 hasImplicitType hasInitializer isFinal isOriginDeclaration f (nameOffset:109) (firstTokenOffset:109) (offset:109)
element: <testLibrary>::@class::B::@field::f
initializer: expression_0
ListLiteral
leftBracket: [ @113
elements2
SimpleIdentifier
token: a @114
element: <testLibrary>::@getter::a
staticType: int
rightBracket: ] @115
staticType: List<int>
inducedGetter: #F7
constructors
#F8 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:90) (offset:96)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 96
getters
#F7 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:109)
element: <testLibrary>::@class::B::@getter::f
inducingVariable: #F6
topLevelVariables
#F9 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@topLevelVariable::a
initializer: expression_1
IntegerLiteral
literal: 0 @10
staticType: int
inducedGetter: #F10
getters
#F10 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@getter::a
inducingVariable: #F9
classes
isAbstract isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter f
reference: <testLibrary>::@class::A::@field::f
firstFragment: #F2
type: List<int>
getter: <testLibrary>::@class::A::@getter::f
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration f
reference: <testLibrary>::@class::A::@getter::f
firstFragment: #F4
returnType: List<int>
variable: <testLibrary>::@class::A::@field::f
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration f
reference: <testLibrary>::@class::B::@field::f
firstFragment: #F6
type: List<int>
constantInitializer
fragment: #F6
expression: expression_0
getter: <testLibrary>::@class::B::@getter::f
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable f
reference: <testLibrary>::@class::B::@getter::f
firstFragment: #F7
returnType: List<int>
variable: <testLibrary>::@class::B::@field::f
topLevelVariables
hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a
reference: <testLibrary>::@topLevelVariable::a
firstFragment: #F9
type: int
constantInitializer
fragment: #F9
expression: expression_1
getter: <testLibrary>::@getter::a
getters
isOriginVariable isStatic a
reference: <testLibrary>::@getter::a
firstFragment: #F10
returnType: int
variable: <testLibrary>::@topLevelVariable::a
''');
}
test_field_inferred_type_static_implicit_initialized() async {
var library = await buildLibrary(r'''
class C {
static var v = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isOriginDeclaration isStatic v (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::C::@field::v
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@getter::v
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@setter::v
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@setter::v::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isOriginDeclaration isStatic isTypeInferredFromInitializer v
reference: <testLibrary>::@class::C::@field::v
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::v
setter: <testLibrary>::@class::C::@setter::v
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable isStatic v
reference: <testLibrary>::@class::C::@getter::v
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::v
setters
isOriginVariable isStatic v
reference: <testLibrary>::@class::C::@setter::v
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::v
''');
}
test_field_inheritedContextType_double() async {
var library = await buildLibrary(r'''
abstract class A {
const A();
double get foo;
}
class B extends A {
const B();
final foo = 2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class A (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:21) (offset:27)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 27
getters
#F4 isAbstract isOriginDeclaration foo (nameOffset:45) (firstTokenOffset:34) (offset:45)
element: <testLibrary>::@class::A::@getter::foo
#F5 hasExtendsClause class B (nameOffset:59) (firstTokenOffset:53) (offset:59)
element: <testLibrary>::@class::B
fields
#F6 hasImplicitType hasInitializer isFinal isOriginDeclaration foo (nameOffset:94) (firstTokenOffset:94) (offset:94)
element: <testLibrary>::@class::B::@field::foo
initializer: expression_0
IntegerLiteral
literal: 2 @100
staticType: double
inducedGetter: #F7
constructors
#F8 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:75) (offset:81)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
typeNameOffset: 81
getters
#F7 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:94)
element: <testLibrary>::@class::B::@getter::foo
inducingVariable: #F6
classes
isAbstract isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: double
getter: <testLibrary>::@class::A::@getter::foo
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: double
variable: <testLibrary>::@class::A::@field::foo
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::B::@field::foo
firstFragment: #F6
type: double
constantInitializer
fragment: #F6
expression: expression_0
getter: <testLibrary>::@class::B::@getter::foo
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable foo
reference: <testLibrary>::@class::B::@getter::foo
firstFragment: #F7
returnType: double
variable: <testLibrary>::@class::B::@field::foo
''');
}
test_field_isPromotable_abstractGetter() async {
var library = await buildLibrary(r'''
abstract class A {
int? get _foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class A (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter isPromotable _foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::A::@field::_foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isAbstract isOriginDeclaration _foo (nameOffset:30) (firstTokenOffset:21) (offset:30)
element: <testLibrary>::@class::A::@getter::_foo
classes
isAbstract isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F2
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@getter::_foo
firstFragment: #F4
returnType: int?
variable: <testLibrary>::@class::A::@field::_foo
''');
}
test_field_isPromotable_hasGetter() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
int? get _foo => 0;
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingGetters
<testLibrary>::@class::B::@getter::_foo
''');
}
test_field_isPromotable_hasGetter_abstract() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
abstract class B {
int? get _foo;
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
''');
}
test_field_isPromotable_hasGetter_inPart() async {
newFile('$testPackageLibPath/a.dart', r'''
part of 'test.dart';
class B {
int? get _foo => 0;
}
''');
var library = await buildLibrary(r'''
part 'a.dart';
class A {
final int? _foo;
A(this._foo);
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingGetters
<testLibrary>::@class::B::@getter::_foo
''');
}
test_field_isPromotable_hasGetter_static() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
static int? get _foo => 0;
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
''');
}
test_field_isPromotable_hasNotFinalField() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
int? _foo;
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingFields
<testLibrary>::@class::B::@field::_foo
''');
}
test_field_isPromotable_hasNotFinalField_static() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
static int? _foo;
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
''');
}
test_field_isPromotable_hasSetter() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
set _field(int? _) {}
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
''');
}
test_field_isPromotable_language217() async {
var library = await buildLibrary(r'''
// @dart = 2.19
class A {
final int? _foo;
A(this._foo);
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
''');
}
test_field_isPromotable_noSuchMethodForwarder_field() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
final int? _foo = 0;
}
/// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod].
class C implements B {
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingNsmClasses
<testLibrary>::@class::C
''');
}
test_field_isPromotable_noSuchMethodForwarder_field_implementedInMixin() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
mixin M {
final int? _foo = 0;
}
class B {
final int? _foo = 0;
}
/// `_foo` is implemented in [M].
class C with M implements B {
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(
classNames: {'A', 'B'},
mixinNames: {'M'},
);
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F2
fields
hasInitializer isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::B::@field::_foo
firstFragment: #F3
type: int?
getter: <testLibrary>::@class::B::@getter::_foo
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F4
superclassConstraints
Object
fields
hasInitializer isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@mixin::M::@field::_foo
firstFragment: #F5
type: int?
getter: <testLibrary>::@mixin::M::@getter::_foo
''');
}
test_field_isPromotable_noSuchMethodForwarder_field_implementedInSuperclass() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
final int? _foo = 0;
}
class C {
final int? _foo = 0;
}
/// `_foo` is implemented in [B].
class D extends B implements C {
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(classNames: {'A', 'B'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F2
fields
hasInitializer isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::B::@field::_foo
firstFragment: #F3
type: int?
getter: <testLibrary>::@class::B::@getter::_foo
''');
}
test_field_isPromotable_noSuchMethodForwarder_field_inClassTypeAlias() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
final int? _foo = 0;
}
mixin M {
dynamic noSuchMethod(Invocation invocation) {}
}
/// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod].
class E = Object with M implements B;
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingNsmClasses
<testLibrary>::@class::E
''');
}
test_field_isPromotable_noSuchMethodForwarder_field_inEnum() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B {
final int? _foo = 0;
}
/// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod].
enum E implements B {
v;
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(classNames: {'A', 'B'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F2
fields
hasInitializer isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::B::@field::_foo
firstFragment: #F3
type: int?
getter: <testLibrary>::@class::B::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingNsmClasses
<testLibrary>::@enum::E
''');
}
test_field_isPromotable_noSuchMethodForwarder_getter() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
abstract class B {
int? get _foo;
}
/// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod].
class C implements B {
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingNsmClasses
<testLibrary>::@class::C
''');
}
test_field_isPromotable_noSuchMethodForwarder_inDifferentLibrary() async {
newFile('$testPackageLibPath/a.dart', r'''
class B {
int? get _foo => 0;
}
''');
var library = await buildLibrary(r'''
import 'a.dart';
class A {
final int? _foo;
A(this._foo);
}
/// Has a noSuchMethod thrower for B._field, but since private names in
/// different libraries are distinct, this has no effect on promotion of
/// C._field.
class C implements B {
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
''');
}
test_field_isPromotable_noSuchMethodForwarder_inheritedInterface() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
class B extends A {
A(super.value);
}
/// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod].
class C implements B {
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingNsmClasses
<testLibrary>::@class::C
''');
}
test_field_isPromotable_noSuchMethodForwarder_mixedInterface() async {
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
mixin M {
final int? _foo = 0;
}
class B with M {}
/// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod].
class C implements B {
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(classNames: {'A'}, mixinNames: {'M'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
mixins
isSimplyBounded mixin M
reference: <testLibrary>::@mixin::M
firstFragment: #F2
superclassConstraints
Object
fields
hasInitializer isFinal isOriginDeclaration _foo
reference: <testLibrary>::@mixin::M::@field::_foo
firstFragment: #F3
type: int?
getter: <testLibrary>::@mixin::M::@getter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingNsmClasses
<testLibrary>::@class::C
''');
}
test_field_isPromotable_noSuchMethodForwarder_unusedMixin() async {
// Mixins are implicitly abstract so the presence of a mixin that inherits
// a field into its interface, and doesn't implement it, doesn't mean that
// a noSuchMethod forwarder created for it. So, this does not block that
// field from promoting.
var library = await buildLibrary(r'''
class A {
final int? _foo;
A(this._foo);
}
mixin M implements A {
dynamic noSuchMethod(Invocation invocation) {}
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
''');
}
test_field_isPromotable_notFinal() async {
var library = await buildLibrary(r'''
class A {
int? _foo;
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isOriginDeclaration _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
setter: <testLibrary>::@class::A::@setter::_foo
fieldNameNonPromotabilityInfo
_foo
conflictingFields
<testLibrary>::@class::A::@field::_foo
''');
}
test_field_isPromotable_notPrivate() async {
var library = await buildLibrary(r'''
class A {
int? field;
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isOriginDeclaration field
reference: <testLibrary>::@class::A::@field::field
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::field
setter: <testLibrary>::@class::A::@setter::field
''');
}
test_field_isPromotable_typeInference() async {
// We decide that `_foo` is promotable before inferring the type of `bar`.
var library = await buildLibrary(r'''
class A {
final int? _foo;
final bar = _foo != null ? _foo : 0;
A(this._foo);
}
''');
configuration.forPromotableFields(classNames: {'A'});
checkElementText(library, r'''
library
reference: <testLibrary>
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F0
fields
isFinal isOriginDeclaration isPromotable _foo
reference: <testLibrary>::@class::A::@field::_foo
firstFragment: #F1
type: int?
getter: <testLibrary>::@class::A::@getter::_foo
hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer bar
reference: <testLibrary>::@class::A::@field::bar
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::bar
''');
}
test_field_missingName() async {
var library = await buildLibrary(r'''
abstract class C {
Object a,;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class C (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration a (nameOffset:28) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::C::@field::a
inducedGetter: #F3
inducedSetter: #F4
#F5 isOriginDeclaration <null-name> (nameOffset:<null>) (firstTokenOffset:30) (offset:30)
element: <testLibrary>::@class::C::@field::#0
inducedGetter: #F6
inducedSetter: #F7
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@getter::a
inducingVariable: #F2
#F6 isComplete isOriginVariable <null-name> (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::C::@getter::#1
inducingVariable: #F5
setters
#F4 isComplete isOriginVariable a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@setter::a
inducingVariable: #F2
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@setter::a::@formalParameter::value
#F7 isComplete isOriginVariable <null-name> (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::C::@setter::#2
inducingVariable: #F5
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::C::@setter::#2::@formalParameter::value
classes
hasNonFinalField isAbstract isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration a
reference: <testLibrary>::@class::C::@field::a
firstFragment: #F2
type: Object
getter: <testLibrary>::@class::C::@getter::a
setter: <testLibrary>::@class::C::@setter::a
isOriginDeclaration <null-name>
reference: <testLibrary>::@class::C::@field::#0
firstFragment: #F5
type: Object
getter: <testLibrary>::@class::C::@getter::#1
setter: <testLibrary>::@class::C::@setter::#2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F8
getters
isOriginVariable a
reference: <testLibrary>::@class::C::@getter::a
firstFragment: #F3
returnType: Object
variable: <testLibrary>::@class::C::@field::a
isOriginVariable <null-name>
reference: <testLibrary>::@class::C::@getter::#1
firstFragment: #F6
returnType: Object
variable: <testLibrary>::@class::C::@field::#0
setters
isOriginVariable a
reference: <testLibrary>::@class::C::@setter::a
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: Object
returnType: void
variable: <testLibrary>::@class::C::@field::a
isOriginVariable <null-name>
reference: <testLibrary>::@class::C::@setter::#2
firstFragment: #F7
formalParameters
#E1 requiredPositional value
firstFragment: #F10
type: Object
returnType: void
variable: <testLibrary>::@class::C::@field::#0
''');
}
test_field_ofGeneric_refEnclosingTypeParameter_false() async {
var library = await buildLibrary(r'''
class C<T> {
late int foo;
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
fields
#F3 isLate isOriginDeclaration foo (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F4
inducedSetter: #F5
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@class::C::@setter::foo
inducingVariable: #F3
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
fields
isLate isOriginDeclaration foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::C::@getter::foo
setter: <testLibrary>::@class::C::@setter::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::C::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F5
formalParameters
#E1 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_field_ofGeneric_refEnclosingTypeParameter_true() async {
var library = await buildLibrary(r'''
class C<T> {
late T foo;
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
fields
#F3 isLate isOriginDeclaration foo (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F4
inducedSetter: #F5
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::C::@setter::foo
inducingVariable: #F3
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
fields
hasEnclosingTypeParameterReference isLate isOriginDeclaration foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F3
type: T
getter: <testLibrary>::@class::C::@getter::foo
setter: <testLibrary>::@class::C::@setter::foo
getters
hasEnclosingTypeParameterReference isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F4
returnType: T
variable: <testLibrary>::@class::C::@field::foo
setters
hasEnclosingTypeParameterReference isOriginVariable foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F5
formalParameters
#E1 requiredPositional value
firstFragment: #F6
type: T
returnType: void
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_field_propagatedType_const_noDep() async {
var library = await buildLibrary(r'''
class C {
static const x = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@field::x
initializer: expression_0
IntegerLiteral
literal: 0 @29
staticType: int
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
constantInitializer
fragment: #F2
expression: expression_0
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable isStatic x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_propagatedType_final_dep_inLib() async {
newFile('$testPackageLibPath/a.dart', r'''
final a = 1;
''');
var library = await buildLibrary(r'''
import "a.dart";
class C {
final b = a / 2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
package:test/a.dart
classes
#F1 class C (nameOffset:24) (firstTokenOffset:18) (offset:24)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isFinal isOriginDeclaration b (nameOffset:36) (firstTokenOffset:36) (offset:36)
element: <testLibrary>::@class::C::@field::b
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::C::@getter::b
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer b
reference: <testLibrary>::@class::C::@field::b
firstFragment: #F2
type: double
getter: <testLibrary>::@class::C::@getter::b
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable b
reference: <testLibrary>::@class::C::@getter::b
firstFragment: #F3
returnType: double
variable: <testLibrary>::@class::C::@field::b
''');
}
test_field_propagatedType_final_dep_inPart() async {
newFile('$testPackageLibPath/a.dart', r'''
part of lib;
final a = 1;
''');
var library = await buildLibrary(r'''
library lib;
part "a.dart";
class C {
final b = a / 2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
name: lib
fragments
#F0 <testLibraryFragment> (nameOffset:<null>) (firstTokenOffset:0) (offset:8)
element: <testLibrary>
nextFragment: #F1
parts
part_0
uri: package:test/a.dart
partKeywordOffset: 14
unit: #F1
classes
#F2 class C (nameOffset:36) (firstTokenOffset:30) (offset:36)
element: <testLibrary>::@class::C
fields
#F3 hasImplicitType hasInitializer isFinal isOriginDeclaration b (nameOffset:48) (firstTokenOffset:48) (offset:48)
element: <testLibrary>::@class::C::@field::b
inducedGetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F4 isComplete isOriginVariable b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48)
element: <testLibrary>::@class::C::@getter::b
inducingVariable: #F3
#F1 package:test/a.dart
element: <testLibrary>
enclosingFragment: #F0
previousFragment: #F0
topLevelVariables
#F6 hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic a (nameOffset:19) (firstTokenOffset:19) (offset:19)
element: <testLibrary>::@topLevelVariable::a
inducedGetter: #F7
getters
#F7 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19)
element: <testLibrary>::@getter::a
inducingVariable: #F6
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F2
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer b
reference: <testLibrary>::@class::C::@field::b
firstFragment: #F3
type: double
getter: <testLibrary>::@class::C::@getter::b
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable b
reference: <testLibrary>::@class::C::@getter::b
firstFragment: #F4
returnType: double
variable: <testLibrary>::@class::C::@field::b
topLevelVariables
hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic isTypeInferredFromInitializer a
reference: <testLibrary>::@topLevelVariable::a
firstFragment: #F6
type: int
getter: <testLibrary>::@getter::a
getters
isOriginVariable isStatic a
reference: <testLibrary>::@getter::a
firstFragment: #F7
returnType: int
variable: <testLibrary>::@topLevelVariable::a
''');
}
test_field_propagatedType_final_noDep_instance() async {
var library = await buildLibrary(r'''
class C {
final x = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_propagatedType_final_noDep_static() async {
var library = await buildLibrary(r'''
class C {
static final x = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic x (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic isTypeInferredFromInitializer x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable isStatic x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_static() async {
var library = await buildLibrary(r'''
class C {
static int i;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration isStatic i (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::C::@field::i
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable isStatic i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@getter::i
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable isStatic i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@setter::i
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::C::@setter::i::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration isStatic i
reference: <testLibrary>::@class::C::@field::i
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::i
setter: <testLibrary>::@class::C::@setter::i
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable isStatic i
reference: <testLibrary>::@class::C::@getter::i
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::i
setters
isOriginVariable isStatic i
reference: <testLibrary>::@class::C::@setter::i
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::i
''');
}
test_field_static_augmentation_sameName_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment static int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isAugmentation isOriginDeclaration isStatic foo (nameOffset:62) (firstTokenOffset:62) (offset:62)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F5
inducedSetter: #F6
getters
#F5 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:62)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
setters
#F6 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:62)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F4
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:62)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
previousFragmentOfDifferentKind: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_static_augmentation_sameName_instanceField() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment static int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:41) (firstTokenOffset:27) (offset:41)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F8 hasInitializer isAugmentation isOriginDeclaration isStatic foo (nameOffset:66) (firstTokenOffset:66) (offset:66)
element: <testLibrary>::@class::A::@field::foo#1
inducedGetter: #F9
inducedSetter: #F10
getters
#F9 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@getter::foo#1
inducingVariable: #F8
setters
#F10 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@setter::foo#1
inducingVariable: #F8
formalParameters
#F11 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:66)
element: <testLibrary>::@class::A::@setter::foo#1::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F8
type: int
getter: <testLibrary>::@class::A::@getter::foo#1
setter: <testLibrary>::@class::A::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo#1
firstFragment: #F9
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo#1
firstFragment: #F10
formalParameters
#E1 requiredPositional value
firstFragment: #F11
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_field_static_augmentation_sameName_instanceGetter() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment static int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 hasInitializer isAugmentation isOriginDeclaration isStatic foo (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: <testLibrary>::@class::A::@field::foo#1
inducedGetter: #F7
inducedSetter: #F8
getters
#F7 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@getter::foo#1
inducingVariable: #F6
setters
#F8 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F6
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F6
type: int
getter: <testLibrary>::@class::A::@getter::foo#1
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo#1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F8
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_field_static_augmentation_sameName_instanceMethod() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment static int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 hasInitializer isAugmentation isOriginDeclaration isStatic foo (nameOffset:67) (firstTokenOffset:67) (offset:67)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F6
inducedSetter: #F7
getters
#F6 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F5
setters
#F7 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F5
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F7
formalParameters
#E0 requiredPositional value
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_field_static_augmentation_sameName_instanceSetter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {}
}
augment class A {
augment static int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F7 hasInitializer isAugmentation isOriginDeclaration isStatic foo (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: <testLibrary>::@class::A::@field::foo#1
inducedGetter: #F8
inducedSetter: #F9
getters
#F8 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F7
setters
#F9 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@setter::foo#1
inducingVariable: #F7
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:71)
element: <testLibrary>::@class::A::@setter::foo#1::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F7
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F8
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo#1
firstFragment: #F9
formalParameters
#E1 requiredPositional value
firstFragment: #F10
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_field_static_augmentation_sameName_staticGetter() async {
var library = await buildLibrary(r'''
class A {
static int get foo => 0;
}
augment class A {
augment static int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F6 isComplete isOriginDeclaration isStatic foo (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::A::@getter::foo
nextFragment: #F7
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isAugmentation isOriginDeclaration isStatic foo (nameOffset:78) (firstTokenOffset:78) (offset:78)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F7
inducedSetter: #F8
previousFragment: #F3
getters
#F7 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:78)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
previousFragment: #F6
setters
#F8 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:78)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F4
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:78)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F8
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_static_augmentation_sameName_staticMethod() async {
var library = await buildLibrary(r'''
class A {
static void foo() {}
}
augment class A {
augment static int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 hasInitializer isAugmentation isOriginDeclaration isStatic foo (nameOffset:74) (firstTokenOffset:74) (offset:74)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F6
inducedSetter: #F7
getters
#F6 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:74)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F5
setters
#F7 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:74)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F5
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:74)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
previousFragmentOfDifferentKind: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F7
formalParameters
#E0 requiredPositional value
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_field_static_augmentation_sameName_staticSetter() async {
var library = await buildLibrary(r'''
class A {
static set foo(int _) {}
}
augment class A {
augment static int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F6 hasImplicitReturnType isComplete isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F8
nextFragment: #F9
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 hasInitializer isAugmentation isOriginDeclaration isStatic foo (nameOffset:78) (firstTokenOffset:78) (offset:78)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F10
inducedSetter: #F9
previousFragment: #F3
getters
#F10 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:78)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F4
setters
#F9 isAugmentation isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:78)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F4
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:78)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F7
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: InvalidType
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F10
returnType: InvalidType
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_static_final_hasConstConstructor() async {
var library = await buildLibrary(r'''
class C {
static final f = 0;
const C();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic f (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@field::f
inducedGetter: #F3
constructors
#F4 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:34) (offset:40)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
typeNameOffset: 40
getters
#F3 isComplete isOriginVariable isStatic f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@getter::f
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic isTypeInferredFromInitializer f
reference: <testLibrary>::@class::C::@field::f
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::f
constructors
isConst isOriginDeclaration new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable isStatic f
reference: <testLibrary>::@class::C::@getter::f
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::f
''');
}
test_field_static_final_untyped() async {
var library = await buildLibrary(r'''
class C {
static final x = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic x (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic isTypeInferredFromInitializer x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable isStatic x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_static_late() async {
var library = await buildLibrary(r'''
class C {
static late int i;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isLate isOriginDeclaration isStatic i (nameOffset:28) (firstTokenOffset:28) (offset:28)
element: <testLibrary>::@class::C::@field::i
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable isStatic i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@getter::i
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable isStatic i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@setter::i
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@setter::i::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isLate isOriginDeclaration isStatic i
reference: <testLibrary>::@class::C::@field::i
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::i
setter: <testLibrary>::@class::C::@setter::i
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable isStatic i
reference: <testLibrary>::@class::C::@getter::i
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::i
setters
isOriginVariable isStatic i
reference: <testLibrary>::@class::C::@setter::i
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::i
''');
}
test_field_static_typeParameter() async {
var library = await buildLibrary(r'''
class A<T> {
static T? foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
fields
#F3 isOriginDeclaration isStatic foo (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
fields
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: InvalidType
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: InvalidType
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: InvalidType
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_field_type_explicit() async {
var library = await buildLibrary(r'''
class C {
int a = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasInitializer isOriginDeclaration a (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::a
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::a
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::a
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::a::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasInitializer isOriginDeclaration a
reference: <testLibrary>::@class::C::@field::a
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::a
setter: <testLibrary>::@class::C::@setter::a
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable a
reference: <testLibrary>::@class::C::@getter::a
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::a
setters
isOriginVariable a
reference: <testLibrary>::@class::C::@setter::a
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::a
''');
}
test_field_type_inferred_fromInitializer() async {
var library = await buildLibrary(r'''
class C {
var foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::foo
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isOriginDeclaration isTypeInferredFromInitializer foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::foo
setter: <testLibrary>::@class::C::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_field_type_inferred_fromSuper() async {
var library = await buildLibrary(r'''
abstract class A {
int get foo;
}
class B extends A {
final foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class A (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isAbstract isOriginDeclaration foo (nameOffset:29) (firstTokenOffset:21) (offset:29)
element: <testLibrary>::@class::A::@getter::foo
#F5 hasExtendsClause class B (nameOffset:43) (firstTokenOffset:37) (offset:43)
element: <testLibrary>::@class::B
fields
#F6 hasImplicitType hasInitializer isFinal isOriginDeclaration foo (nameOffset:65) (firstTokenOffset:65) (offset:65)
element: <testLibrary>::@class::B::@field::foo
inducedGetter: #F7
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:43)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
getters
#F7 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:65)
element: <testLibrary>::@class::B::@getter::foo
inducingVariable: #F6
classes
isAbstract isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
fields
hasImplicitType hasInitializer isFinal isOriginDeclaration foo
reference: <testLibrary>::@class::B::@field::foo
firstFragment: #F6
type: int
getter: <testLibrary>::@class::B::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable foo
reference: <testLibrary>::@class::B::@getter::foo
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::B::@field::foo
''');
}
test_field_type_inferred_Never() async {
var library = await buildLibrary(r'''
class C {
var a = throw 42;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isOriginDeclaration a (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::a
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::a
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::a
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::a::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isOriginDeclaration isTypeInferredFromInitializer a
reference: <testLibrary>::@class::C::@field::a
firstFragment: #F2
type: Never
getter: <testLibrary>::@class::C::@getter::a
setter: <testLibrary>::@class::C::@setter::a
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable a
reference: <testLibrary>::@class::C::@getter::a
firstFragment: #F3
returnType: Never
variable: <testLibrary>::@class::C::@field::a
setters
isOriginVariable a
reference: <testLibrary>::@class::C::@setter::a
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: Never
returnType: void
variable: <testLibrary>::@class::C::@field::a
''');
}
test_field_typed() async {
var library = await buildLibrary(r'''
class C {
int x = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasInitializer isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasInitializer isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_field_untyped() async {
var library = await buildLibrary(r'''
class C {
var x = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasImplicitType hasInitializer isOriginDeclaration x (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasImplicitType hasInitializer isOriginDeclaration isTypeInferredFromInitializer x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginVariable x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_fields() async {
var library = await buildLibrary(r'''
class C {
int i;
int j;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration i (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::i
inducedGetter: #F3
inducedSetter: #F4
#F5 isOriginDeclaration j (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@field::j
inducedGetter: #F6
inducedSetter: #F7
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::i
inducingVariable: #F2
#F6 isComplete isOriginVariable j (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@getter::j
inducingVariable: #F5
setters
#F4 isComplete isOriginVariable i (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::i
inducingVariable: #F2
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::i::@formalParameter::value
#F7 isComplete isOriginVariable j (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@setter::j
inducingVariable: #F5
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@setter::j::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration i
reference: <testLibrary>::@class::C::@field::i
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::i
setter: <testLibrary>::@class::C::@setter::i
isOriginDeclaration j
reference: <testLibrary>::@class::C::@field::j
firstFragment: #F5
type: int
getter: <testLibrary>::@class::C::@getter::j
setter: <testLibrary>::@class::C::@setter::j
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F8
getters
isOriginVariable i
reference: <testLibrary>::@class::C::@getter::i
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::i
isOriginVariable j
reference: <testLibrary>::@class::C::@getter::j
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::C::@field::j
setters
isOriginVariable i
reference: <testLibrary>::@class::C::@setter::i
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::i
isOriginVariable j
reference: <testLibrary>::@class::C::@setter::j
firstFragment: #F7
formalParameters
#E1 requiredPositional value
firstFragment: #F10
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::j
''');
}
test_fields_late() async {
var library = await buildLibrary(r'''
class C {
late int foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isLate isOriginDeclaration foo (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::C::@setter::foo
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isLate isOriginDeclaration foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::foo
setter: <testLibrary>::@class::C::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_fields_late_final() async {
var library = await buildLibrary(r'''
class C {
late final int foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isFinal isLate isOriginDeclaration foo (nameOffset:27) (firstTokenOffset:27) (offset:27)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@class::C::@setter::foo
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isFinal isLate isOriginDeclaration foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::foo
setter: <testLibrary>::@class::C::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F5
getters
isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_fields_late_final_initialized() async {
var library = await buildLibrary(r'''
class C {
late final int foo = 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 hasInitializer isFinal isLate isOriginDeclaration foo (nameOffset:27) (firstTokenOffset:27) (offset:27)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F3
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F2
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
hasInitializer isFinal isLate isOriginDeclaration foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_fields_late_inference_usingSuper_methodInvocation() async {
var library = await buildLibrary(r'''
class A {
int foo() => 0;
}
class B extends A {
late var f = super.foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@method::foo
#F4 hasExtendsClause class B (nameOffset:37) (firstTokenOffset:31) (offset:37)
element: <testLibrary>::@class::B
fields
#F5 hasImplicitType hasInitializer isLate isOriginDeclaration f (nameOffset:62) (firstTokenOffset:62) (offset:62)
element: <testLibrary>::@class::B::@field::f
inducedGetter: #F6
inducedSetter: #F7
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
getters
#F6 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:62)
element: <testLibrary>::@class::B::@getter::f
inducingVariable: #F5
setters
#F7 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:62)
element: <testLibrary>::@class::B::@setter::f
inducingVariable: #F5
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:62)
element: <testLibrary>::@class::B::@setter::f::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
returnType: int
hasNonFinalField isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
supertype: A
fields
hasImplicitType hasInitializer isLate isOriginDeclaration isTypeInferredFromInitializer f
reference: <testLibrary>::@class::B::@field::f
firstFragment: #F5
type: int
getter: <testLibrary>::@class::B::@getter::f
setter: <testLibrary>::@class::B::@setter::f
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F8
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable f
reference: <testLibrary>::@class::B::@getter::f
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::B::@field::f
setters
isOriginVariable f
reference: <testLibrary>::@class::B::@setter::f
firstFragment: #F7
formalParameters
#E0 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::B::@field::f
''');
}
test_fields_late_inference_usingSuper_propertyAccess() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
class B extends A {
late var f = super.foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F5 hasExtendsClause class B (nameOffset:39) (firstTokenOffset:33) (offset:39)
element: <testLibrary>::@class::B
fields
#F6 hasImplicitType hasInitializer isLate isOriginDeclaration f (nameOffset:64) (firstTokenOffset:64) (offset:64)
element: <testLibrary>::@class::B::@field::f
inducedGetter: #F7
inducedSetter: #F8
constructors
#F9 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
getters
#F7 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:64)
element: <testLibrary>::@class::B::@getter::f
inducingVariable: #F6
setters
#F8 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:64)
element: <testLibrary>::@class::B::@setter::f
inducingVariable: #F6
formalParameters
#F10 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:64)
element: <testLibrary>::@class::B::@setter::f::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
hasNonFinalField isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F5
supertype: A
fields
hasImplicitType hasInitializer isLate isOriginDeclaration isTypeInferredFromInitializer f
reference: <testLibrary>::@class::B::@field::f
firstFragment: #F6
type: int
getter: <testLibrary>::@class::B::@getter::f
setter: <testLibrary>::@class::B::@setter::f
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F9
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable f
reference: <testLibrary>::@class::B::@getter::f
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::B::@field::f
setters
isOriginVariable f
reference: <testLibrary>::@class::B::@setter::f
firstFragment: #F8
formalParameters
#E0 requiredPositional value
firstFragment: #F10
type: int
returnType: void
variable: <testLibrary>::@class::B::@field::f
''');
}
test_getter_abstract() async {
var library = await buildLibrary(r'''
abstract class C {
int get x;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class C (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F4 isAbstract isOriginDeclaration x (nameOffset:29) (firstTokenOffset:21) (offset:29)
element: <testLibrary>::@class::C::@getter::x
classes
isAbstract isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_getter_augmentation_add() async {
var library = await buildLibrary(r'''
class A {
int get foo1 => 0;
}
augment class A {
int get foo2 => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo1
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration foo1 (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo1
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 isOriginGetterSetter foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48)
element: <testLibrary>::@class::A::@field::foo2
getters
#F7 isComplete isOriginDeclaration foo2 (nameOffset:62) (firstTokenOffset:54) (offset:62)
element: <testLibrary>::@class::A::@getter::foo2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo1
reference: <testLibrary>::@class::A::@field::foo1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo1
isOriginGetterSetter foo2
reference: <testLibrary>::@class::A::@field::foo2
firstFragment: #F6
type: int
getter: <testLibrary>::@class::A::@getter::foo2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@getter::foo1
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo1
isOriginDeclaration foo2
reference: <testLibrary>::@class::A::@getter::foo2
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::A::@field::foo2
''');
}
test_getter_augmentation_add_generic() async {
var library = await buildLibrary(r'''
class A<T> {
T get foo1;
}
augment class A<T> {
T get foo2;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
fields
#F5 isOriginGetterSetter foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo1
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F7 isAbstract isOriginDeclaration foo1 (nameOffset:21) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::A::@getter::foo1
#F2 isAugmentation class A (nameOffset:44) (firstTokenOffset:30) (offset:44)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:46) (firstTokenOffset:46) (offset:46)
element: #E0 T
previousFragment: #F3
fields
#F8 isOriginGetterSetter foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@class::A::@field::foo2
getters
#F9 isAbstract isOriginDeclaration foo2 (nameOffset:59) (firstTokenOffset:53) (offset:59)
element: <testLibrary>::@class::A::@getter::foo2
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
fields
hasEnclosingTypeParameterReference isOriginGetterSetter foo1
reference: <testLibrary>::@class::A::@field::foo1
firstFragment: #F5
type: T
getter: <testLibrary>::@class::A::@getter::foo1
hasEnclosingTypeParameterReference isOriginGetterSetter foo2
reference: <testLibrary>::@class::A::@field::foo2
firstFragment: #F8
type: T
getter: <testLibrary>::@class::A::@getter::foo2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
hasEnclosingTypeParameterReference isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@getter::foo1
firstFragment: #F7
returnType: T
variable: <testLibrary>::@class::A::@field::foo1
hasEnclosingTypeParameterReference isOriginDeclaration foo2
reference: <testLibrary>::@class::A::@getter::foo2
firstFragment: #F9
returnType: T
variable: <testLibrary>::@class::A::@field::foo2
''');
}
test_getter_augmentation_chain() async {
var library = await buildLibrary(r'''
class A {
int get foo1 => 0;
int get foo2 => 0;
}
augment class A {
augment int get foo1 => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo1
#F4 isOriginGetterSetter foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo2
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F6 isComplete isOriginDeclaration foo1 (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo1
nextFragment: #F7
#F8 isComplete isOriginDeclaration foo2 (nameOffset:41) (firstTokenOffset:33) (offset:41)
element: <testLibrary>::@class::A::@getter::foo2
#F2 isAugmentation class A (nameOffset:69) (firstTokenOffset:55) (offset:69)
element: <testLibrary>::@class::A
previousFragment: #F1
getters
#F7 isAugmentation isComplete isOriginDeclaration foo1 (nameOffset:91) (firstTokenOffset:75) (offset:91)
element: <testLibrary>::@class::A::@getter::foo1
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo1
reference: <testLibrary>::@class::A::@field::foo1
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo1
isOriginGetterSetter foo2
reference: <testLibrary>::@class::A::@field::foo2
firstFragment: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
getters
isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@getter::foo1
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo1
isOriginDeclaration foo2
reference: <testLibrary>::@class::A::@getter::foo2
firstFragment: #F8
returnType: int
variable: <testLibrary>::@class::A::@field::foo2
''');
}
test_getter_augmentation_chain_fromField() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F7
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
getters
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:48) (offset:64)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F4
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_chain_fromField_twoDeclarations() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment int get foo => 0;
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F7
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
getters
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:48) (offset:64)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F4
nextFragment: #F10
#F9 isAugmentation class A (nameOffset:91) (firstTokenOffset:77) (offset:91)
element: <testLibrary>::@class::A
previousFragment: #F2
getters
#F10 isAugmentation isComplete isOriginDeclaration foo (nameOffset:113) (firstTokenOffset:97) (offset:113)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F7
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_chain_isComplete_instance() async {
var library = await buildLibrary(r'''
class A {
int get foo;
}
augment class A {
augment int get foo => 0;
}
augment class A {
augment int get foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isAbstract isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
getters
#F6 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:48) (offset:64)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F5
nextFragment: #F8
#F7 isAugmentation class A (nameOffset:91) (firstTokenOffset:77) (offset:91)
element: <testLibrary>::@class::A
previousFragment: #F2
getters
#F8 isAbstract isAugmentation isOriginDeclaration foo (nameOffset:113) (firstTokenOffset:97) (offset:113)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_chain_noIntroductoryDeclaration() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
augment int get foo => 0;
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::A::@field::foo
getters
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:48) (firstTokenOffset:32) (offset:48)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_chain_returnType_int_String() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment String get foo => '';
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
nextFragment: #F5
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
getters
#F5 isAugmentation isComplete isOriginDeclaration foo (nameOffset:72) (firstTokenOffset:53) (offset:72)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_chain_twoInSameDeclaration() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment int get foo => 0;
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
getters
#F6 isAugmentation isComplete isOriginDeclaration foo (nameOffset:69) (firstTokenOffset:53) (offset:69)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F5
nextFragment: #F7
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:97) (firstTokenOffset:81) (offset:97)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_sameName_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::A::@field::foo
getters
#F5 isAugmentation isComplete isOriginDeclaration foo (nameOffset:59) (firstTokenOffset:43) (offset:59)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_sameName_instanceMethod() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:43)
element: <testLibrary>::@class::A::@field::foo
getters
#F6 isAugmentation isComplete isOriginDeclaration foo (nameOffset:65) (firstTokenOffset:49) (offset:65)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
previousFragmentOfDifferentKind: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_getter_augmentation_sameName_instanceSetter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {}
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
getters
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:69) (firstTokenOffset:53) (offset:69)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F7
previousFragmentOfDifferentKind: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_sameName_staticField() async {
var library = await buildLibrary(r'''
class A {
static int foo = 0;
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F8 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48)
element: <testLibrary>::@class::A::@field::foo#1
getters
#F9 isAugmentation isComplete isOriginDeclaration foo (nameOffset:70) (firstTokenOffset:54) (offset:70)
element: <testLibrary>::@class::A::@getter::foo#1
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F8
type: int
getter: <testLibrary>::@class::A::@getter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo#1
firstFragment: #F9
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_augmentation_sameName_staticGetter() async {
var library = await buildLibrary(r'''
class A {
static int get foo => 0;
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration isStatic foo (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::A::@field::foo#1
getters
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:75) (firstTokenOffset:59) (offset:75)
element: <testLibrary>::@class::A::@getter::foo#1
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F6
type: int
getter: <testLibrary>::@class::A::@getter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo#1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_getter_augmentation_sameName_staticMethod() async {
var library = await buildLibrary(r'''
class A {
static void foo() {}
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49)
element: <testLibrary>::@class::A::@field::foo
getters
#F6 isAugmentation isComplete isOriginDeclaration foo (nameOffset:71) (firstTokenOffset:55) (offset:71)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_getter_augmentation_sameName_staticSetter() async {
var library = await buildLibrary(r'''
class A {
static set foo(int _) {}
}
augment class A {
augment int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F7 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::A::@field::foo#1
getters
#F8 isAugmentation isComplete isOriginDeclaration foo (nameOffset:75) (firstTokenOffset:59) (offset:75)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F7
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F8
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_external() async {
var library = await buildLibrary(r'''
class C {
external int get x;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F4 isComplete isExternal isOriginDeclaration x (nameOffset:29) (firstTokenOffset:12) (offset:29)
element: <testLibrary>::@class::C::@getter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
getters
isExternal isOriginDeclaration x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_getter_implicit_return_type() async {
var library = await buildLibrary(r'''
class C {
get x => null;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F4 hasImplicitReturnType isComplete isOriginDeclaration x (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::C::@getter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F4
returnType: dynamic
variable: <testLibrary>::@class::C::@field::x
''');
}
test_getter_invokesSuperSelf_getter() async {
var library = await buildLibrary(r'''
class A {
int get foo {
super.foo;
}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 invokesSuperSelf isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
invokesSuperSelf isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_invokesSuperSelf_getter_nestedInAssignment() async {
var library = await buildLibrary(r'''
class A {
int get foo {
(super.foo).foo = 0;
}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 invokesSuperSelf isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
invokesSuperSelf isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_invokesSuperSelf_setter() async {
var library = await buildLibrary(r'''
class A {
int get foo {
super.foo = 0;
}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_missingName() async {
var library = await buildLibrary(r'''
class A {
get() => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 hasImplicitReturnType isComplete isOriginDeclaration get (nameOffset:12) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@method::get
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration get
reference: <testLibrary>::@class::A::@method::get
firstFragment: #F3
returnType: dynamic
''');
}
test_getter_native() async {
var library = await buildLibrary(r'''
class C {
int get x() native;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F4 isComplete isExternal isOriginDeclaration x (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@getter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
getters
isExternal isOriginDeclaration x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_getter_ofGeneric_refEnclosingTypeParameter_false() async {
var library = await buildLibrary(r'''
class C<T> {
int get foo {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::foo
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:23) (firstTokenOffset:15) (offset:23)
element: <testLibrary>::@class::C::@getter::foo
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::C::@getter::foo
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_getter_ofGeneric_refEnclosingTypeParameter_true() async {
var library = await buildLibrary(r'''
class C<T> {
T get foo {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::foo
getters
#F4 isComplete isOriginDeclaration foo (nameOffset:21) (firstTokenOffset:15) (offset:21)
element: <testLibrary>::@class::C::@getter::foo
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
fields
hasEnclosingTypeParameterReference isOriginGetterSetter foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F3
type: T
getter: <testLibrary>::@class::C::@getter::foo
getters
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F4
returnType: T
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_getter_static() async {
var library = await buildLibrary(r'''
class C {
static int get x => null;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F4 isComplete isOriginDeclaration isStatic x (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::C::@getter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter isStatic x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration isStatic x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::C::@field::x
''');
}
test_getter_static_augmentation_chain_isComplete() async {
var library = await buildLibrary(r'''
class A {
static int get foo;
}
augment class A {
augment static int get foo => 0;
}
augment class A {
augment static int get foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isAbstract isOriginDeclaration isStatic foo (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::A::@getter::foo
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
getters
#F6 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:78) (firstTokenOffset:55) (offset:78)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F5
nextFragment: #F8
#F7 isAugmentation class A (nameOffset:105) (firstTokenOffset:91) (offset:105)
element: <testLibrary>::@class::A
previousFragment: #F2
getters
#F8 isAbstract isAugmentation isOriginDeclaration isStatic foo (nameOffset:134) (firstTokenOffset:111) (offset:134)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_static_augmentation_sameName_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment static int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::A::@field::foo
getters
#F5 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:66) (firstTokenOffset:43) (offset:66)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
previousFragmentOfDifferentKind: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_static_augmentation_sameName_instanceField() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment static int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:41) (firstTokenOffset:27) (offset:41)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F8 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41)
element: <testLibrary>::@class::A::@field::foo#1
getters
#F9 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:70) (firstTokenOffset:47) (offset:70)
element: <testLibrary>::@class::A::@getter::foo#1
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F8
type: int
getter: <testLibrary>::@class::A::@getter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo#1
firstFragment: #F9
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_static_augmentation_sameName_instanceGetter() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment static int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46)
element: <testLibrary>::@class::A::@field::foo#1
getters
#F7 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:75) (firstTokenOffset:52) (offset:75)
element: <testLibrary>::@class::A::@getter::foo#1
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F6
type: int
getter: <testLibrary>::@class::A::@getter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo#1
firstFragment: #F7
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_getter_static_augmentation_sameName_instanceMethod() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment static int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:42)
element: <testLibrary>::@class::A::@field::foo
getters
#F6 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:71) (firstTokenOffset:48) (offset:71)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
returnType: int
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_getter_static_augmentation_sameName_instanceSetter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {}
}
augment class A {
augment static int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F7 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46)
element: <testLibrary>::@class::A::@field::foo#1
getters
#F8 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:75) (firstTokenOffset:52) (offset:75)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F7
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F8
returnType: int
variable: <testLibrary>::@class::A::@field::foo#1
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_static_augmentation_sameName_staticField() async {
var library = await buildLibrary(r'''
class A {
static int foo = 0;
}
augment class A {
augment static int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
nextFragment: #F7
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F8 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
getters
#F7 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:77) (firstTokenOffset:54) (offset:77)
element: <testLibrary>::@class::A::@getter::foo
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_getter_static_augmentation_sameName_staticMethod() async {
var library = await buildLibrary(r'''
class A {
static void foo() {}
}
augment class A {
augment static int get foo => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49)
element: <testLibrary>::@class::A::@field::foo
getters
#F6 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:78) (firstTokenOffset:55) (offset:78)
element: <testLibrary>::@class::A::@getter::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F6
previousFragmentOfDifferentKind: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_getters() async {
var library = await buildLibrary(r'''
class C {
int get x => null;
get y => null;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
#F3 isOriginGetterSetter y (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::y
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F5 isComplete isOriginDeclaration x (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@getter::x
#F6 hasImplicitReturnType isComplete isOriginDeclaration y (nameOffset:37) (firstTokenOffset:33) (offset:37)
element: <testLibrary>::@class::C::@getter::y
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
isOriginGetterSetter y
reference: <testLibrary>::@class::C::@field::y
firstFragment: #F3
type: dynamic
getter: <testLibrary>::@class::C::@getter::y
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::C::@field::x
isOriginDeclaration y
reference: <testLibrary>::@class::C::@getter::y
firstFragment: #F6
returnType: dynamic
variable: <testLibrary>::@class::C::@field::y
''');
}
test_implicitConstructor_named_const() async {
var library = await buildLibrary(r'''
class C {
final Object x;
const C.named(this.x);
}
const x = C.named(42);
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isFinal isOriginDeclaration x (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::C::@field::x
inducedGetter: #F3
constructors
#F4 isComplete isConst isOriginDeclaration named (nameOffset:38) (firstTokenOffset:30) (offset:38)
element: <testLibrary>::@class::C::@constructor::named
typeName: C
typeNameOffset: 36
periodOffset: 37
formalParameters
#F5 requiredPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:49) (firstTokenOffset:44) (offset:49)
element: <testLibrary>::@class::C::@constructor::named::@formalParameter::x
getters
#F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::C::@getter::x
inducingVariable: #F2
topLevelVariables
#F6 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:62) (firstTokenOffset:62) (offset:62)
element: <testLibrary>::@topLevelVariable::x
initializer: expression_0
InstanceCreationExpression
constructorName: ConstructorName
type: NamedType
name: C @66
element: <testLibrary>::@class::C
type: C
period: . @67
name: SimpleIdentifier
token: named @68
element: <testLibrary>::@class::C::@constructor::named
staticType: null
element: <testLibrary>::@class::C::@constructor::named
argumentList: ArgumentList
leftParenthesis: ( @73
arguments2
IntegerLiteral
literal: 42 @74
staticType: int
rightParenthesis: ) @76
staticType: C
inducedGetter: #F7
getters
#F7 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:62)
element: <testLibrary>::@getter::x
inducingVariable: #F6
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isFinal isOriginDeclaration x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: Object
getter: <testLibrary>::@class::C::@getter::x
constructors
isConst isOriginDeclaration named
reference: <testLibrary>::@class::C::@constructor::named
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.x
firstFragment: #F5
type: Object
field: <testLibrary>::@class::C::@field::x
getters
isOriginVariable x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F3
returnType: Object
variable: <testLibrary>::@class::C::@field::x
topLevelVariables
hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer x
reference: <testLibrary>::@topLevelVariable::x
firstFragment: #F6
type: C
constantInitializer
fragment: #F6
expression: expression_0
getter: <testLibrary>::@getter::x
getters
isOriginVariable isStatic x
reference: <testLibrary>::@getter::x
firstFragment: #F7
returnType: C
variable: <testLibrary>::@topLevelVariable::x
''');
}
test_implicitField_getterFirst() async {
var library = await buildLibrary(r'''
class C {
int get x => 0;
void set x(int value) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F4 isComplete isOriginDeclaration x (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::C::@getter::x
setters
#F5 isComplete isOriginDeclaration x (nameOffset:39) (firstTokenOffset:30) (offset:39)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F6 requiredPositional isOriginDeclaration value (nameOffset:45) (firstTokenOffset:41) (offset:45)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_implicitField_setterFirst() async {
var library = await buildLibrary(r'''
class C {
void set x(int value) {}
int get x => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F4 isComplete isOriginDeclaration x (nameOffset:47) (firstTokenOffset:39) (offset:47)
element: <testLibrary>::@class::C::@getter::x
setters
#F5 isComplete isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F6 requiredPositional isOriginDeclaration value (nameOffset:27) (firstTokenOffset:23) (offset:27)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::x
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
getters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@getter::x
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::C::@field::x
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_method_abstract() async {
var library = await buildLibrary(r'''
abstract class C {
f();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class C (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 hasImplicitReturnType isAbstract isOriginDeclaration f (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@method::f
classes
isAbstract isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
returnType: dynamic
''');
}
test_method_async() async {
var library = await buildLibrary(r'''
import 'dart:async';
class C {
Future f() async {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
dart:async
classes
#F1 class C (nameOffset:28) (firstTokenOffset:22) (offset:28)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isAsynchronous isComplete isOriginDeclaration f (nameOffset:41) (firstTokenOffset:34) (offset:41) async
element: <testLibrary>::@class::C::@method::f
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
returnType: Future<dynamic>
''');
}
test_method_asyncStar() async {
var library = await buildLibrary(r'''
import 'dart:async';
class C {
Stream f() async* {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
dart:async
classes
#F1 class C (nameOffset:28) (firstTokenOffset:22) (offset:28)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isAsynchronous isComplete isGenerator isOriginDeclaration f (nameOffset:41) (firstTokenOffset:34) (offset:41) async*
element: <testLibrary>::@class::C::@method::f
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
returnType: Stream<dynamic>
''');
}
test_method_augmentation_add() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
void bar() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F5 isComplete isOriginDeclaration bar (nameOffset:54) (firstTokenOffset:49) (offset:54)
element: <testLibrary>::@class::A::@method::bar
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
isOriginDeclaration bar
reference: <testLibrary>::@class::A::@method::bar
firstFragment: #F5
returnType: void
''');
}
test_method_augmentation_add_generic() async {
var library = await buildLibrary(r'''
class A<T> {
T foo() => throw 0;
}
augment class A<T> {
T bar() => throw 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F6 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:15) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:52) (firstTokenOffset:38) (offset:52)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:54) (firstTokenOffset:54) (offset:54)
element: #E0 T
previousFragment: #F3
methods
#F7 isComplete isOriginDeclaration bar (nameOffset:63) (firstTokenOffset:61) (offset:63)
element: <testLibrary>::@class::A::@method::bar
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F6
returnType: T
hasEnclosingTypeParameterReference isOriginDeclaration bar
reference: <testLibrary>::@class::A::@method::bar
firstFragment: #F7
returnType: T
''');
}
test_method_augmentation_add_inferTypes_ofAugmentation() async {
var library = await buildLibrary(r'''
class B extends A {}
class A {
int foo(String a) => 0;
}
augment class B {
foo(a) => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class B (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::B
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
#F4 class A (nameOffset:28) (firstTokenOffset:22) (offset:28)
element: <testLibrary>::@class::A
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F6 isComplete isOriginDeclaration foo (nameOffset:38) (firstTokenOffset:34) (offset:38)
element: <testLibrary>::@class::A::@method::foo
formalParameters
#F7 requiredPositional isOriginDeclaration a (nameOffset:49) (firstTokenOffset:42) (offset:49)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::a
#F2 isAugmentation class B (nameOffset:75) (firstTokenOffset:61) (offset:75)
element: <testLibrary>::@class::B
previousFragment: #F1
methods
#F8 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:81) (firstTokenOffset:81) (offset:81)
element: <testLibrary>::@class::B::@method::foo
formalParameters
#F9 requiredPositional hasImplicitType isOriginDeclaration a (nameOffset:85) (firstTokenOffset:85) (offset:85)
element: <testLibrary>::@class::B::@method::foo::@formalParameter::a
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
supertype: A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F3
superConstructor: <testLibrary>::@class::A::@constructor::new
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::B::@method::foo
firstFragment: #F8
formalParameters
#E0 requiredPositional hasImplicitType a
firstFragment: #F9
type: String
returnType: int
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F4
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F6
formalParameters
#E1 requiredPositional a
firstFragment: #F7
type: String
returnType: int
''');
}
test_method_augmentation_add_inferTypes_usingInterface() async {
var library = await buildLibrary(r'''
class B {
foo(a) => 0;
}
class A {
int foo(String a) => 0;
}
augment class B implements A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class B (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::B
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
methods
#F4 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::B::@method::foo
formalParameters
#F5 requiredPositional hasImplicitType isOriginDeclaration a (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::B::@method::foo::@formalParameter::a
#F6 class A (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::A
constructors
#F7 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F8 isComplete isOriginDeclaration foo (nameOffset:44) (firstTokenOffset:40) (offset:44)
element: <testLibrary>::@class::A::@method::foo
formalParameters
#F9 requiredPositional isOriginDeclaration a (nameOffset:55) (firstTokenOffset:48) (offset:55)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::a
#F2 isAugmentation class B (nameOffset:81) (firstTokenOffset:67) (offset:81)
element: <testLibrary>::@class::B
previousFragment: #F1
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
interfaces
A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::B::@method::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType a
firstFragment: #F5
type: String
returnType: int
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F6
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F7
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F8
formalParameters
#E1 requiredPositional a
firstFragment: #F9
type: String
returnType: int
''');
}
test_method_augmentation_add_inferTypes_usingMixin() async {
var library = await buildLibrary(r'''
class B {
foo(a) => 0;
}
mixin A {
int foo(String a) => 0;
}
augment class B with A {}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class B (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::B
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
methods
#F4 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::B::@method::foo
formalParameters
#F5 requiredPositional hasImplicitType isOriginDeclaration a (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::B::@method::foo::@formalParameter::a
#F2 isAugmentation class B (nameOffset:81) (firstTokenOffset:67) (offset:81)
element: <testLibrary>::@class::B
previousFragment: #F1
mixins
#F6 mixin A (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@mixin::A
methods
#F7 isComplete isOriginDeclaration foo (nameOffset:44) (firstTokenOffset:40) (offset:44)
element: <testLibrary>::@mixin::A::@method::foo
formalParameters
#F8 requiredPositional isOriginDeclaration a (nameOffset:55) (firstTokenOffset:48) (offset:55)
element: <testLibrary>::@mixin::A::@method::foo::@formalParameter::a
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
supertype: Object
mixins
A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::B::@method::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType a
firstFragment: #F5
type: String
returnType: int
mixins
isSimplyBounded mixin A
reference: <testLibrary>::@mixin::A
firstFragment: #F6
superclassConstraints
Object
methods
isOriginDeclaration foo
reference: <testLibrary>::@mixin::A::@method::foo
firstFragment: #F7
formalParameters
#E1 requiredPositional a
firstFragment: #F8
type: String
returnType: int
''');
}
test_method_augmentation_add_withDefaultValue() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
void foo([int x = 42]) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:37) (firstTokenOffset:32) (offset:37)
element: <testLibrary>::@class::A::@method::foo
formalParameters
#F5 optionalPositional isOriginDeclaration x (nameOffset:46) (firstTokenOffset:42) (offset:46)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::x
initializer: expression_0
IntegerLiteral
literal: 42 @50
staticType: int
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
formalParameters
#E0 optionalPositional hasDefaultValue x
firstFragment: #F5
type: int
constantInitializer
fragment: #F5
expression: expression_0
returnType: void
''');
}
test_method_augmentation_chain() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
void bar() {}
}
augment class A {
augment void foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F5
#F6 isComplete isOriginDeclaration bar (nameOffset:33) (firstTokenOffset:28) (offset:33)
element: <testLibrary>::@class::A::@method::bar
#F2 isAugmentation class A (nameOffset:59) (firstTokenOffset:45) (offset:59)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F5 isAbstract isAugmentation isOriginDeclaration foo (nameOffset:78) (firstTokenOffset:65) (offset:78)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
isOriginDeclaration bar
reference: <testLibrary>::@class::A::@method::bar
firstFragment: #F6
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_differentClass() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1) {}
}
augment class A {
augment void foo(int p1) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F5
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F7
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F5 isAugmentation isComplete isOriginDeclaration foo (nameOffset:68) (firstTokenOffset:55) (offset:68)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
formalParameters
#F7 requiredPositional isOriginDeclaration p1 (nameOffset:76) (firstTokenOffset:72) (offset:76)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional p1
firstFragment: #F6
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rN1__rN1() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1}) {}
augment void foo({required int n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:58) (firstTokenOffset:45) (offset:58)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:76) (firstTokenOffset:63) (offset:76)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rN1__rn1() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1}) {}
augment void foo({int n1}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:58) (firstTokenOffset:45) (offset:58)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:67) (firstTokenOffset:63) (offset:67)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rn1__rN1() async {
var library = await buildLibrary(r'''
class A {
void foo({int n1}) {}
augment void foo({required int n1}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:67) (firstTokenOffset:54) (offset:67)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rn1__rn1() async {
var library = await buildLibrary(r'''
class A {
void foo({int n1}) {}
augment void foo({int n1}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rN1__rN1__rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1}) {}
augment void foo({required int n1}) {}
augment void foo({required int n1, required int n2}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:58) (firstTokenOffset:45) (offset:58)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F9
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:76) (firstTokenOffset:63) (offset:76)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
nextFragment: #F10
#F8 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:58)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F7
nextFragment: #F11
#F9 isAugmentation isComplete isOriginDeclaration foo (nameOffset:99) (firstTokenOffset:86) (offset:99)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
formalParameters
#F10 requiredNamed isOriginDeclaration n1 (nameOffset:117) (firstTokenOffset:104) (offset:117)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F6
#F11 requiredNamed isOriginDeclaration n2 (nameOffset:134) (firstTokenOffset:121) (offset:134)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rn1__rn1__rn1_rn2() async {
var library = await buildLibrary(r'''
class A {
void foo({int n1}) {}
augment void foo({int n1}) {}
augment void foo({int n1, int n2}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 optionalNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F9
formalParameters
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
nextFragment: #F10
#F8 optionalNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F7
nextFragment: #F11
#F9 isAugmentation isComplete isOriginDeclaration foo (nameOffset:81) (firstTokenOffset:68) (offset:81)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
formalParameters
#F10 optionalNamed isOriginDeclaration n1 (nameOffset:90) (firstTokenOffset:86) (offset:90)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F6
#F11 optionalNamed isOriginDeclaration n2 (nameOffset:98) (firstTokenOffset:94) (offset:98)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rN1__rN1_differentType() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1}) {}
augment void foo({required double n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:58) (firstTokenOffset:45) (offset:58)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:79) (firstTokenOffset:63) (offset:79)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rn1__rn1_differentType() async {
var library = await buildLibrary(r'''
class A {
void foo({int n1}) {}
augment void foo({double n1}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:61) (firstTokenOffset:54) (offset:61)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rN1__rN1_rN1() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1}) {}
augment void foo({required int n1, required int n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:58) (firstTokenOffset:45) (offset:58)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:76) (firstTokenOffset:63) (offset:76)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:93) (firstTokenOffset:80) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rN1__rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1}) {}
augment void foo({required int n1, required int n2}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:58) (firstTokenOffset:45) (offset:58)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:76) (firstTokenOffset:63) (offset:76)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
#F8 requiredNamed isOriginDeclaration n2 (nameOffset:93) (firstTokenOffset:80) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rn1__rn1_rn2() async {
var library = await buildLibrary(r'''
class A {
void foo({int n1}) {}
augment void foo({int n1, int n2}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 optionalNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
#F8 optionalNamed isOriginDeclaration n2 (nameOffset:66) (firstTokenOffset:62) (offset:66)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rN1_rN1__rN1() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1, required int n1}) {}
augment void foo({required int n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:52) (firstTokenOffset:39) (offset:52)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:75) (firstTokenOffset:62) (offset:75)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:93) (firstTokenOffset:80) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
#F8 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:75)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
#E1 requiredNamed n1
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rN1_rN1__rN1_rN1() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1, required int n1}) {}
augment void foo({required int n1, required int n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:52) (firstTokenOffset:39) (offset:52)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:75) (firstTokenOffset:62) (offset:75)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:93) (firstTokenOffset:80) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:110) (firstTokenOffset:97) (offset:110)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
#E1 requiredNamed n1
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rN1_rN2__rN1() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1, required int n2}) {}
augment void foo({required int n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 requiredNamed isOriginDeclaration n2 (nameOffset:52) (firstTokenOffset:39) (offset:52)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:75) (firstTokenOffset:62) (offset:75)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:93) (firstTokenOffset:80) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
#F8 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:75)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
#E1 requiredNamed n2
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rn1_rn2__rn1() async {
var library = await buildLibrary(r'''
class A {
void foo({int n1, int n2}) {}
augment void foo({int n1}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 optionalNamed isOriginDeclaration n2 (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:57) (firstTokenOffset:44) (offset:57)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:66) (firstTokenOffset:62) (offset:66)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
#F8 optionalNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F5
type: int
#E1 optionalNamed n2
firstFragment: #F7
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rN1_rN2__rN1__rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1, required int n2}) {}
augment void foo({required int n1}) {}
augment void foo({required int n1, required int n2}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 requiredNamed isOriginDeclaration n2 (nameOffset:52) (firstTokenOffset:39) (offset:52)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:75) (firstTokenOffset:62) (offset:75)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F9
formalParameters
#F6 requiredNamed isOriginDeclaration n1 (nameOffset:93) (firstTokenOffset:80) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
nextFragment: #F10
#F8 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:75)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F7
nextFragment: #F11
#F9 isAugmentation isComplete isOriginDeclaration foo (nameOffset:116) (firstTokenOffset:103) (offset:116)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
formalParameters
#F10 requiredNamed isOriginDeclaration n1 (nameOffset:134) (firstTokenOffset:121) (offset:134)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F6
#F11 requiredNamed isOriginDeclaration n2 (nameOffset:151) (firstTokenOffset:138) (offset:151)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F5
type: int
#E1 requiredNamed n2
firstFragment: #F7
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rn1_rn2__rn1__rn1_rn2() async {
var library = await buildLibrary(r'''
class A {
void foo({int n1, int n2}) {}
augment void foo({int n1}) {}
augment void foo({int n1, int n2}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration n1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F6
#F7 optionalNamed isOriginDeclaration n2 (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:57) (firstTokenOffset:44) (offset:57)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F9
formalParameters
#F6 optionalNamed isOriginDeclaration n1 (nameOffset:66) (firstTokenOffset:62) (offset:66)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F5
nextFragment: #F10
#F8 optionalNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F7
nextFragment: #F11
#F9 isAugmentation isComplete isOriginDeclaration foo (nameOffset:89) (firstTokenOffset:76) (offset:89)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
formalParameters
#F10 optionalNamed isOriginDeclaration n1 (nameOffset:98) (firstTokenOffset:94) (offset:98)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F6
#F11 optionalNamed isOriginDeclaration n2 (nameOffset:106) (firstTokenOffset:102) (offset:106)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed n1
firstFragment: #F5
type: int
#E1 optionalNamed n2
firstFragment: #F7
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rN1_rN2__rP1__rP1__rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n1, required int n2}) {}
augment void foo(int p1) {}
augment void foo(int p1) {}
augment void foo({required int n1, required int n2}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F8
#F9 requiredNamed isOriginDeclaration n2 (nameOffset:52) (firstTokenOffset:39) (offset:52)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F10
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:75) (firstTokenOffset:62) (offset:75)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F11
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:83) (firstTokenOffset:79) (offset:83)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
nextFragment: #F12
#F8 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:75)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F7
nextFragment: #F13
#F10 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:75)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F9
nextFragment: #F14
#F11 isAugmentation isComplete isOriginDeclaration foo (nameOffset:105) (firstTokenOffset:92) (offset:105)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
nextFragment: #F15
formalParameters
#F12 requiredPositional isOriginDeclaration p1 (nameOffset:113) (firstTokenOffset:109) (offset:113)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F6
nextFragment: #F16
#F13 requiredNamed isOriginOtherFragmentOfEnclosing n1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:105)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F8
nextFragment: #F17
#F14 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:105)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F10
nextFragment: #F18
#F15 isAugmentation isComplete isOriginDeclaration foo (nameOffset:135) (firstTokenOffset:122) (offset:135)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F11
formalParameters
#F16 requiredPositional isOriginOtherFragmentOfEnclosing p1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:135)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F12
#F17 requiredNamed isOriginDeclaration n1 (nameOffset:153) (firstTokenOffset:140) (offset:153)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F13
#F18 requiredNamed isOriginDeclaration n2 (nameOffset:170) (firstTokenOffset:157) (offset:170)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F14
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n1
firstFragment: #F7
type: int
#E1 requiredNamed n2
firstFragment: #F9
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rN2_rN1__rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
void foo({required int n2, required int n1}) {}
augment void foo({required int n1, required int n2}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredNamed isOriginDeclaration n2 (nameOffset:35) (firstTokenOffset:22) (offset:35)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F6
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:52) (firstTokenOffset:39) (offset:52)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:75) (firstTokenOffset:62) (offset:75)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:93) (firstTokenOffset:80) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F7
#F6 requiredNamed isOriginDeclaration n2 (nameOffset:110) (firstTokenOffset:97) (offset:110)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredNamed n2
firstFragment: #F5
type: int
#E1 requiredNamed n1
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rn2_rn1__rn1_rn2() async {
var library = await buildLibrary(r'''
class A {
void foo({int n2, int n1}) {}
augment void foo({int n1, int n2}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration n2 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F6
#F7 optionalNamed isOriginDeclaration n1 (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:57) (firstTokenOffset:44) (offset:57)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F8 optionalNamed isOriginDeclaration n1 (nameOffset:66) (firstTokenOffset:62) (offset:66)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F7
#F6 optionalNamed isOriginDeclaration n2 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed n2
firstFragment: #F5
type: int
#E1 optionalNamed n1
firstFragment: #F7
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rn__rn() async {
var library = await buildLibrary(r'''
import 'dart:core' as core;
class A {
void foo({core.int}) {}
augment void foo({core.int}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
libraryImports
dart:core as core (nameOffset:22) (firstTokenOffset:<null>) (offset:22)
prefixes
<testLibraryFragment>::@prefix::core
fragments: @22
classes
#F1 class A (nameOffset:34) (firstTokenOffset:28) (offset:34)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:45) (firstTokenOffset:40) (offset:45)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalNamed isOriginDeclaration <null-name> (nameOffset:<null>) (firstTokenOffset:50) (offset:50)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::<null-name>
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:79) (firstTokenOffset:66) (offset:79)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalNamed isOriginDeclaration <null-name> (nameOffset:<null>) (firstTokenOffset:84) (offset:84)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::<null-name>
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalNamed <null-name>
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rP1__rP1() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1) {}
augment void foo(int p1) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:47) (firstTokenOffset:34) (offset:47)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:55) (firstTokenOffset:51) (offset:55)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1__rp1() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1) {}
augment void foo([int p1]) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:47) (firstTokenOffset:34) (offset:47)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalPositional isOriginDeclaration p1 (nameOffset:56) (firstTokenOffset:52) (offset:56)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rp1__rP1() async {
var library = await buildLibrary(r'''
class A {
void foo([int p1]) {}
augment void foo(int p1) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:57) (firstTokenOffset:53) (offset:57)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rp1__rp1() async {
var library = await buildLibrary(r'''
class A {
void foo([int p1]) {}
augment void foo([int p1]) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalPositional isOriginDeclaration p1 (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1__rP1__rP1_rP2() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1) {}
augment void foo(int p1) {}
augment void foo(int p1, int p2) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:47) (firstTokenOffset:34) (offset:47)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F9
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:55) (firstTokenOffset:51) (offset:55)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
nextFragment: #F10
#F8 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
nextFragment: #F11
#F9 isAugmentation isComplete isOriginDeclaration foo (nameOffset:77) (firstTokenOffset:64) (offset:77)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:85) (firstTokenOffset:81) (offset:85)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F6
#F11 requiredPositional isOriginDeclaration p2 (nameOffset:93) (firstTokenOffset:89) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rP1__rP1_differentType() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1) {}
augment void foo(double p1) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:47) (firstTokenOffset:34) (offset:47)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:58) (firstTokenOffset:51) (offset:58)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rp1__rp1_differentType() async {
var library = await buildLibrary(r'''
class A {
void foo([int p1]) {}
augment void foo([double p1]) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalPositional isOriginDeclaration p1 (nameOffset:61) (firstTokenOffset:54) (offset:61)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1__rP1_rP2() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1) {}
augment void foo(int p1, int p2) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:47) (firstTokenOffset:34) (offset:47)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:55) (firstTokenOffset:51) (offset:55)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 requiredPositional isOriginDeclaration p2 (nameOffset:63) (firstTokenOffset:59) (offset:63)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rp1__rp1_rp2() async {
var library = await buildLibrary(r'''
class A {
void foo([int p1]) {}
augment void foo([int p1, int p2]) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 optionalPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:36) (offset:49)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalPositional isOriginDeclaration p1 (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 optionalPositional isOriginDeclaration p2 (nameOffset:66) (firstTokenOffset:62) (offset:66)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1__rP1_rP2__rP1() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1) {}
augment void foo(int p1, int p2) {}
augment void foo(int p1) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:47) (firstTokenOffset:34) (offset:47)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F9
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:55) (firstTokenOffset:51) (offset:55)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
nextFragment: #F10
#F8 requiredPositional isOriginDeclaration p2 (nameOffset:63) (firstTokenOffset:59) (offset:63)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
nextFragment: #F11
#F9 isAugmentation isComplete isOriginDeclaration foo (nameOffset:85) (firstTokenOffset:72) (offset:85)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:93) (firstTokenOffset:89) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F6
#F11 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:85)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rP1__rP1ft() async {
var library = await buildLibrary(r'''
class A {
void foo(void Function(int) p1) {}
augment void foo(void p1(int a)) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:40) (firstTokenOffset:21) (offset:40)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:62) (firstTokenOffset:49) (offset:62)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:71) (firstTokenOffset:66) (offset:71)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: void Function(int)
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rP1__rP2() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1) {}
augment void foo(int p2) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:47) (firstTokenOffset:34) (offset:47)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p2 (nameOffset:55) (firstTokenOffset:51) (offset:55)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1_rN1__rP1_rN1() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1, {required int n1}) {}
augment void foo(int p1, {required int n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:43) (firstTokenOffset:30) (offset:43)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:53) (offset:66)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:92) (firstTokenOffset:79) (offset:92)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
#E1 requiredNamed n1
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1_rN1__rP1_rN1_differentType() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1, {required int n1}) {}
augment void foo(double p1, {required double n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredNamed isOriginDeclaration n1 (nameOffset:43) (firstTokenOffset:30) (offset:43)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:53) (offset:66)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:77) (firstTokenOffset:70) (offset:77)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 requiredNamed isOriginDeclaration n1 (nameOffset:98) (firstTokenOffset:82) (offset:98)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
#E1 requiredNamed n1
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1_rN1__rP1_rP2_rN1_rN2() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1, {required int n1}) {}
augment void foo(int p1, int p2, {required int n1, required int n2}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F9 requiredNamed isOriginDeclaration n1 (nameOffset:43) (firstTokenOffset:30) (offset:43)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F10
#F11 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F12
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:53) (offset:66)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 requiredPositional isOriginDeclaration p2 (nameOffset:82) (firstTokenOffset:78) (offset:82)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
#F10 requiredNamed isOriginDeclaration n1 (nameOffset:100) (firstTokenOffset:87) (offset:100)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F9
#F12 requiredNamed isOriginDeclaration n2 (nameOffset:117) (firstTokenOffset:104) (offset:117)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F11
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
#E1 requiredNamed n1
firstFragment: #F9
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1_rP2__rP1() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1, int p2) {}
augment void foo(int p1) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredPositional isOriginDeclaration p2 (nameOffset:33) (firstTokenOffset:29) (offset:33)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:42) (offset:55)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:63) (firstTokenOffset:59) (offset:63)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:55)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
#E1 requiredPositional p2
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rp1_rp2__rp1() async {
var library = await buildLibrary(r'''
class A {
void foo([int p1, int p2]) {}
augment void foo([int p1]) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalPositional isOriginDeclaration p1 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 optionalPositional isOriginDeclaration p2 (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:57) (firstTokenOffset:44) (offset:57)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalPositional isOriginDeclaration p1 (nameOffset:66) (firstTokenOffset:62) (offset:66)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 optionalPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalPositional p1
firstFragment: #F5
type: int
#E1 optionalPositional p2
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1_rP2__rP1__rP1_rP2() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1, int p2) {}
augment void foo(int p1) {}
augment void foo(int p1, int p2) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredPositional isOriginDeclaration p2 (nameOffset:33) (firstTokenOffset:29) (offset:33)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:42) (offset:55)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F9
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:63) (firstTokenOffset:59) (offset:63)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
nextFragment: #F10
#F8 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:55)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
nextFragment: #F11
#F9 isAugmentation isComplete isOriginDeclaration foo (nameOffset:85) (firstTokenOffset:72) (offset:85)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
formalParameters
#F10 requiredPositional isOriginDeclaration p1 (nameOffset:93) (firstTokenOffset:89) (offset:93)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F6
#F11 requiredPositional isOriginDeclaration p2 (nameOffset:101) (firstTokenOffset:97) (offset:101)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
#E1 requiredPositional p2
firstFragment: #F7
type: int
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rP1_rP2__rP2_rP1() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1, int p2) {}
augment void foo(int p2, int p1) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredPositional isOriginDeclaration p2 (nameOffset:33) (firstTokenOffset:29) (offset:33)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:42) (offset:55)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p2 (nameOffset:63) (firstTokenOffset:59) (offset:63)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 requiredPositional isOriginDeclaration p1 (nameOffset:71) (firstTokenOffset:67) (offset:71)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
#E1 requiredPositional p2
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1_rP2_rN1_rN2__rP1_rN1() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1, int p2, {required int n1, required int n2}) {}
augment void foo(int p1, {required int n1}) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F7 requiredPositional isOriginDeclaration p2 (nameOffset:33) (firstTokenOffset:29) (offset:33)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F8
#F9 requiredNamed isOriginDeclaration n1 (nameOffset:51) (firstTokenOffset:38) (offset:51)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
nextFragment: #F10
#F11 requiredNamed isOriginDeclaration n2 (nameOffset:68) (firstTokenOffset:55) (offset:68)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
nextFragment: #F12
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:91) (firstTokenOffset:78) (offset:91)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:99) (firstTokenOffset:95) (offset:99)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
#F8 requiredPositional isOriginOtherFragmentOfEnclosing p2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:91)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F7
#F10 requiredNamed isOriginDeclaration n1 (nameOffset:117) (firstTokenOffset:104) (offset:117)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n1
previousFragment: #F9
#F12 requiredNamed isOriginOtherFragmentOfEnclosing n2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:91)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::n2
previousFragment: #F11
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int
#E1 requiredPositional p2
firstFragment: #F7
type: int
#E2 requiredNamed n1
firstFragment: #F9
type: int
#E3 requiredNamed n2
firstFragment: #F11
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_formalParameters_rP1ft__rP1() async {
var library = await buildLibrary(r'''
class A {
void foo(void p1(int a)) {}
augment void foo(void Function(int) p1) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:26) (firstTokenOffset:21) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:42) (offset:55)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:78) (firstTokenOffset:59) (offset:78)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: void Function(int)
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rP1ft__rP1ft() async {
var library = await buildLibrary(r'''
class A {
void foo(void p1(int a)) {}
augment void foo(void p1(int a)) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:26) (firstTokenOffset:21) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:42) (offset:55)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:64) (firstTokenOffset:59) (offset:64)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: void Function(int)
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rP1ft__rP1ft_differentType() async {
var library = await buildLibrary(r'''
class A {
void foo(void p1(int a)) {}
augment void foo(void p1(double a)) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:26) (firstTokenOffset:21) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:42) (offset:55)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:64) (firstTokenOffset:59) (offset:64)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: void Function(int)
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rP1ftt__rP1ftt() async {
var library = await buildLibrary(r'''
class A {
void foo(int p1<T>(T a)) {}
augment void foo(int p1<T>(T a)) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 requiredPositional isOriginDeclaration p1 (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F6
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:42) (offset:55)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 requiredPositional isOriginDeclaration p1 (nameOffset:63) (firstTokenOffset:59) (offset:63)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 requiredPositional p1
firstFragment: #F5
type: int Function<T>(T)
returnType: void
''');
}
test_method_augmentation_chain_formalParameters_rp2_rp1__rp1_rp2() async {
var library = await buildLibrary(r'''
class A {
void foo([int p2, int p1]) {}
augment void foo([int p1, int p2]) {}
}
''');
configuration.withExportScope = true;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
formalParameters
#F5 optionalPositional isOriginDeclaration p2 (nameOffset:26) (firstTokenOffset:22) (offset:26)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
nextFragment: #F6
#F7 optionalPositional isOriginDeclaration p1 (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
nextFragment: #F8
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:57) (firstTokenOffset:44) (offset:57)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
formalParameters
#F6 optionalPositional isOriginDeclaration p1 (nameOffset:66) (firstTokenOffset:62) (offset:66)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p2
previousFragment: #F5
#F8 optionalPositional isOriginDeclaration p2 (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::p1
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
formalParameters
#E0 optionalPositional p2
firstFragment: #F5
type: int
#E1 optionalPositional p1
firstFragment: #F7
type: int
returnType: void
exportEntries
declared <testLibrary>::@class::A
exportNamespace
A: <testLibrary>::@class::A
''');
}
test_method_augmentation_chain_generic() async {
var library = await buildLibrary(r'''
class A<T> {
T foo() => throw 0;
}
augment class A<T> {
augment T foo() => throw 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
typeParameters
#F3 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
nextFragment: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F6 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:15) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F7
#F2 isAugmentation class A (nameOffset:52) (firstTokenOffset:38) (offset:52)
element: <testLibrary>::@class::A
previousFragment: #F1
typeParameters
#F4 T (nameOffset:54) (firstTokenOffset:54) (offset:54)
element: #E0 T
previousFragment: #F3
methods
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:71) (firstTokenOffset:61) (offset:71)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F6
returnType: T
''');
}
test_method_augmentation_chain_inferTypes() async {
var library = await buildLibrary(r'''
class B extends A {
foo(a) => 0;
}
class A {
int foo(String a) => 0;
}
augment class B {
augment foo(a) => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class B (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::B
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
methods
#F4 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::B::@method::foo
nextFragment: #F5
formalParameters
#F6 requiredPositional hasImplicitType isOriginDeclaration a (nameOffset:26) (firstTokenOffset:26) (offset:26)
element: <testLibrary>::@class::B::@method::foo::@formalParameter::a
nextFragment: #F7
#F8 class A (nameOffset:44) (firstTokenOffset:38) (offset:44)
element: <testLibrary>::@class::A
constructors
#F9 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F10 isComplete isOriginDeclaration foo (nameOffset:54) (firstTokenOffset:50) (offset:54)
element: <testLibrary>::@class::A::@method::foo
formalParameters
#F11 requiredPositional isOriginDeclaration a (nameOffset:65) (firstTokenOffset:58) (offset:65)
element: <testLibrary>::@class::A::@method::foo::@formalParameter::a
#F2 isAugmentation class B (nameOffset:91) (firstTokenOffset:77) (offset:91)
element: <testLibrary>::@class::B
previousFragment: #F1
methods
#F5 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:105) (firstTokenOffset:97) (offset:105)
element: <testLibrary>::@class::B::@method::foo
previousFragment: #F4
formalParameters
#F7 requiredPositional hasImplicitType isOriginDeclaration a (nameOffset:109) (firstTokenOffset:109) (offset:109)
element: <testLibrary>::@class::B::@method::foo::@formalParameter::a
previousFragment: #F6
classes
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F1
supertype: A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F3
superConstructor: <testLibrary>::@class::A::@constructor::new
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::B::@method::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType a
firstFragment: #F6
type: String
returnType: int
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F8
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F9
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F10
formalParameters
#E1 requiredPositional a
firstFragment: #F11
type: String
returnType: int
''');
}
test_method_augmentation_chain_isComplete_instance() async {
var library = await buildLibrary(r'''
class A {
void foo();
}
augment class A {
augment void foo() {}
}
augment class A {
augment void foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isAbstract isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F5
#F2 isAugmentation class A (nameOffset:41) (firstTokenOffset:27) (offset:41)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F6
methods
#F5 isAugmentation isComplete isOriginDeclaration foo (nameOffset:60) (firstTokenOffset:47) (offset:60)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
nextFragment: #F7
#F6 isAugmentation class A (nameOffset:86) (firstTokenOffset:72) (offset:86)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F7 isAbstract isAugmentation isOriginDeclaration foo (nameOffset:105) (firstTokenOffset:92) (offset:105)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_method_augmentation_chain_noIntroductoryDeclaration() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:45) (firstTokenOffset:32) (offset:45)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_method_augmentation_chain_returnType_void_int() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment int foo() => 0;
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
#F2 isAugmentation class A (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:61) (firstTokenOffset:49) (offset:61)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
returnType: void
''');
}
test_method_augmentation_chain_twoDeclarations() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment void foo() {}
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F5
#F2 isAugmentation class A (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F6
methods
#F5 isAugmentation isComplete isOriginDeclaration foo (nameOffset:62) (firstTokenOffset:49) (offset:62)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
nextFragment: #F7
#F6 isAugmentation class A (nameOffset:88) (firstTokenOffset:74) (offset:88)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:107) (firstTokenOffset:94) (offset:107)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_method_augmentation_chain_twoInSameDeclaration() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment void foo() {}
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F5
#F2 isAugmentation class A (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F5 isAugmentation isComplete isOriginDeclaration foo (nameOffset:62) (firstTokenOffset:49) (offset:62)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
nextFragment: #F6
#F6 isAugmentation isComplete isOriginDeclaration foo (nameOffset:86) (firstTokenOffset:73) (offset:86)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_bounds_int_int() async {
var library = await buildLibrary(r'''
class A {
void foo<T extends int>() {}
}
augment class A {
augment void foo<T extends int>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:57) (firstTokenOffset:43) (offset:57)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:76) (firstTokenOffset:63) (offset:76)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
typeParameters
#F6 T (nameOffset:80) (firstTokenOffset:80) (offset:80)
element: #E0 T
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
bound: int
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_bounds_int_nothing() async {
var library = await buildLibrary(r'''
class A {
void foo<T extends int>() {}
}
augment class A {
augment void foo<T>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:57) (firstTokenOffset:43) (offset:57)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:76) (firstTokenOffset:63) (offset:76)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
typeParameters
#F6 T (nameOffset:80) (firstTokenOffset:80) (offset:80)
element: #E0 T
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
bound: int
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_bounds_int_string() async {
var library = await buildLibrary(r'''
class A {
void foo<T extends int>() {}
}
augment class A {
augment void foo<T extends String>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:57) (firstTokenOffset:43) (offset:57)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:76) (firstTokenOffset:63) (offset:76)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
typeParameters
#F6 T (nameOffset:80) (firstTokenOffset:80) (offset:80)
element: #E0 T
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
bound: int
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_bounds_nothing_int() async {
var library = await buildLibrary(r'''
class A {
void foo<T>() {}
}
augment class A {
augment void foo<T extends int>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:51) (offset:64)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
typeParameters
#F6 T (nameOffset:68) (firstTokenOffset:68) (offset:68)
element: #E0 T
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_count_111() async {
var library = await buildLibrary(r'''
class A {
void foo<T>() {}
}
augment class A {
augment void foo<T>() {}
}
augment class A {
augment void foo<T>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F7
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:51) (offset:64)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F8
typeParameters
#F6 T (nameOffset:68) (firstTokenOffset:68) (offset:68)
element: #E0 T
previousFragment: #F5
nextFragment: #F9
#F7 isAugmentation class A (nameOffset:92) (firstTokenOffset:78) (offset:92)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F8 isAugmentation isComplete isOriginDeclaration foo (nameOffset:111) (firstTokenOffset:98) (offset:111)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
typeParameters
#F9 T (nameOffset:115) (firstTokenOffset:115) (offset:115)
element: #E0 T
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_count_112() async {
var library = await buildLibrary(r'''
class A {
void foo<T>() {}
}
augment class A {
augment void foo<T>() {}
}
augment class A {
augment void foo<T, U>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F7 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: #E1 U
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:51) (offset:64)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F10
typeParameters
#F6 T (nameOffset:68) (firstTokenOffset:68) (offset:68)
element: #E0 T
previousFragment: #F5
nextFragment: #F11
#F8 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:64)
element: #E1 U
previousFragment: #F7
nextFragment: #F12
#F9 isAugmentation class A (nameOffset:92) (firstTokenOffset:78) (offset:92)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F10 isAugmentation isComplete isOriginDeclaration foo (nameOffset:111) (firstTokenOffset:98) (offset:111)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
typeParameters
#F11 T (nameOffset:115) (firstTokenOffset:115) (offset:115)
element: #E0 T
previousFragment: #F6
#F12 U (nameOffset:118) (firstTokenOffset:118) (offset:118)
element: #E1 U
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_count_121() async {
var library = await buildLibrary(r'''
class A {
void foo<T>() {}
}
augment class A {
augment void foo<T, U>() {}
}
augment class A {
augment void foo<T>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F7 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: #E1 U
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:51) (offset:64)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F10
typeParameters
#F6 T (nameOffset:68) (firstTokenOffset:68) (offset:68)
element: #E0 T
previousFragment: #F5
nextFragment: #F11
#F8 U (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: #E1 U
previousFragment: #F7
nextFragment: #F12
#F9 isAugmentation class A (nameOffset:95) (firstTokenOffset:81) (offset:95)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F10 isAugmentation isComplete isOriginDeclaration foo (nameOffset:114) (firstTokenOffset:101) (offset:114)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
typeParameters
#F11 T (nameOffset:118) (firstTokenOffset:118) (offset:118)
element: #E0 T
previousFragment: #F6
#F12 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:114)
element: #E1 U
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_count_123() async {
var library = await buildLibrary(r'''
class A {
void foo<T>() {}
}
augment class A {
augment void foo<T, U>() {}
}
augment class A {
augment void foo<T, U, V>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F7 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: #E1 U
nextFragment: #F8
#F9 isOriginOtherFragmentOfEnclosing V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17)
element: #E2 V
nextFragment: #F10
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F11
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:64) (firstTokenOffset:51) (offset:64)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F12
typeParameters
#F6 T (nameOffset:68) (firstTokenOffset:68) (offset:68)
element: #E0 T
previousFragment: #F5
nextFragment: #F13
#F8 U (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: #E1 U
previousFragment: #F7
nextFragment: #F14
#F10 isOriginOtherFragmentOfEnclosing V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:64)
element: #E2 V
previousFragment: #F9
nextFragment: #F15
#F11 isAugmentation class A (nameOffset:95) (firstTokenOffset:81) (offset:95)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F12 isAugmentation isComplete isOriginDeclaration foo (nameOffset:114) (firstTokenOffset:101) (offset:114)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
typeParameters
#F13 T (nameOffset:118) (firstTokenOffset:118) (offset:118)
element: #E0 T
previousFragment: #F6
#F14 U (nameOffset:121) (firstTokenOffset:121) (offset:121)
element: #E1 U
previousFragment: #F8
#F15 V (nameOffset:124) (firstTokenOffset:124) (offset:124)
element: #E2 V
previousFragment: #F10
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_count_211() async {
var library = await buildLibrary(r'''
class A {
void foo<T, U>() {}
}
augment class A {
augment void foo<T>() {}
}
augment class A {
augment void foo<T>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F7 U (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: #E1 U
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:67) (firstTokenOffset:54) (offset:67)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F10
typeParameters
#F6 T (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: #E0 T
previousFragment: #F5
nextFragment: #F11
#F8 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67)
element: #E1 U
previousFragment: #F7
nextFragment: #F12
#F9 isAugmentation class A (nameOffset:95) (firstTokenOffset:81) (offset:95)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F10 isAugmentation isComplete isOriginDeclaration foo (nameOffset:114) (firstTokenOffset:101) (offset:114)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
typeParameters
#F11 T (nameOffset:118) (firstTokenOffset:118) (offset:118)
element: #E0 T
previousFragment: #F6
#F12 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:114)
element: #E1 U
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
#E1 U
firstFragment: #F7
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_count_212() async {
var library = await buildLibrary(r'''
class A {
void foo<T, U>() {}
}
augment class A {
augment void foo<T>() {}
}
augment class A {
augment void foo<T, U>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F7 U (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: #E1 U
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:67) (firstTokenOffset:54) (offset:67)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
nextFragment: #F10
typeParameters
#F6 T (nameOffset:71) (firstTokenOffset:71) (offset:71)
element: #E0 T
previousFragment: #F5
nextFragment: #F11
#F8 isOriginOtherFragmentOfEnclosing U (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67)
element: #E1 U
previousFragment: #F7
nextFragment: #F12
#F9 isAugmentation class A (nameOffset:95) (firstTokenOffset:81) (offset:95)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F10 isAugmentation isComplete isOriginDeclaration foo (nameOffset:114) (firstTokenOffset:101) (offset:114)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
typeParameters
#F11 T (nameOffset:118) (firstTokenOffset:118) (offset:118)
element: #E0 T
previousFragment: #F6
#F12 U (nameOffset:121) (firstTokenOffset:121) (offset:121)
element: #E1 U
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
#E1 U
firstFragment: #F7
returnType: void
''');
}
test_method_augmentation_chain_typeParameters_differentNames() async {
var library = await buildLibrary(r'''
class A {
void foo<T, U>() {}
}
augment class A {
augment void foo<U, T>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F4
typeParameters
#F5 T (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: #E0 T
nextFragment: #F6
#F7 U (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: #E1 U
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:68) (firstTokenOffset:55) (offset:68)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F3
typeParameters
#F6 U (nameOffset:72) (firstTokenOffset:72) (offset:72)
element: #E0 T
previousFragment: #F5
#F8 T (nameOffset:75) (firstTokenOffset:75) (offset:75)
element: #E1 U
previousFragment: #F7
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F5
#E1 U
firstFragment: #F7
returnType: void
''');
}
test_method_augmentation_sameName_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration foo (nameOffset:56) (firstTokenOffset:43) (offset:56)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_method_augmentation_sameName_instanceField() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F8 isAugmentation isComplete isOriginDeclaration foo (nameOffset:61) (firstTokenOffset:48) (offset:61)
element: <testLibrary>::@class::A::@method::foo
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F8
previousFragmentOfDifferentKind: #F3
returnType: void
''');
}
test_method_augmentation_sameName_instanceGetter() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F6 isAugmentation isComplete isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:53) (offset:66)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F6
previousFragmentOfDifferentKind: #F5
returnType: void
''');
}
test_method_augmentation_sameName_instanceSetter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {}
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:53) (offset:66)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F7
previousFragmentOfDifferentKind: #F5
returnType: void
''');
}
test_method_augmentation_sameName_staticField() async {
var library = await buildLibrary(r'''
class A {
static int foo = 0;
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F8 isAugmentation isComplete isOriginDeclaration foo (nameOffset:67) (firstTokenOffset:54) (offset:67)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F8
returnType: void
''');
}
test_method_augmentation_sameName_staticGetter() async {
var library = await buildLibrary(r'''
class A {
static int get foo => 0;
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration isStatic foo (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F6 isAugmentation isComplete isOriginDeclaration foo (nameOffset:72) (firstTokenOffset:59) (offset:72)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F6
returnType: void
''');
}
test_method_augmentation_sameName_staticMethod() async {
var library = await buildLibrary(r'''
class A {
static void foo() {}
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F5 isAugmentation isComplete isOriginDeclaration foo (nameOffset:68) (firstTokenOffset:55) (offset:68)
element: <testLibrary>::@class::A::@method::foo#1
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo#1
firstFragment: #F5
returnType: void
''');
}
test_method_augmentation_sameName_staticSetter() async {
var library = await buildLibrary(r'''
class A {
static set foo(int _) {}
}
augment class A {
augment void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F7 isAugmentation isComplete isOriginDeclaration foo (nameOffset:72) (firstTokenOffset:59) (offset:72)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F7
returnType: void
''');
}
test_method_documented() async {
var library = await buildLibrary(r'''
class C {
/**
* Docs
*/
f() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 hasImplicitReturnType isComplete isOriginDeclaration f (nameOffset:34) (firstTokenOffset:12) (offset:34)
element: <testLibrary>::@class::C::@method::f
documentationComment: /**\n * Docs\n */
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
documentationComment: /**\n * Docs\n */
returnType: dynamic
''');
}
test_method_external() async {
var library = await buildLibrary(r'''
class C {
external f();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 hasImplicitReturnType isComplete isExternal isOriginDeclaration f (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@method::f
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isExternal isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
returnType: dynamic
''');
}
test_method_formalParameter_regular_requiredPositional_inferredType_nonStatic_implicit() async {
var library = await buildLibrary(r'''
class C extends D {
void f(value) {}
}
abstract class D {
void f(int value);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration f (nameOffset:27) (firstTokenOffset:22) (offset:27)
element: <testLibrary>::@class::C::@method::f
formalParameters
#F4 requiredPositional hasImplicitType isOriginDeclaration value (nameOffset:29) (firstTokenOffset:29) (offset:29)
element: <testLibrary>::@class::C::@method::f::@formalParameter::value
#F5 isAbstract class D (nameOffset:57) (firstTokenOffset:42) (offset:57)
element: <testLibrary>::@class::D
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
methods
#F7 isAbstract isOriginDeclaration f (nameOffset:68) (firstTokenOffset:63) (offset:68)
element: <testLibrary>::@class::D::@method::f
formalParameters
#F8 requiredPositional isOriginDeclaration value (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::D::@method::f::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
superConstructor: <testLibrary>::@class::D::@constructor::new
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
formalParameters
#E0 requiredPositional hasImplicitType value
firstFragment: #F4
type: int
returnType: void
isAbstract isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F5
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F6
methods
isOriginDeclaration f
reference: <testLibrary>::@class::D::@method::f
firstFragment: #F7
formalParameters
#E1 requiredPositional value
firstFragment: #F8
type: int
returnType: void
''');
}
test_method_formalParameters() async {
var library = await buildLibrary(r'''
class C {
f(x, y) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 hasImplicitReturnType isComplete isOriginDeclaration f (nameOffset:12) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@method::f
formalParameters
#F4 requiredPositional hasImplicitType isOriginDeclaration x (nameOffset:14) (firstTokenOffset:14) (offset:14)
element: <testLibrary>::@class::C::@method::f::@formalParameter::x
#F5 requiredPositional hasImplicitType isOriginDeclaration y (nameOffset:17) (firstTokenOffset:17) (offset:17)
element: <testLibrary>::@class::C::@method::f::@formalParameter::y
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
formalParameters
#E0 requiredPositional hasImplicitType x
firstFragment: #F4
type: dynamic
#E1 requiredPositional hasImplicitType y
firstFragment: #F5
type: dynamic
returnType: dynamic
''');
}
test_method_hasImplicitReturnType_false() async {
var library = await buildLibrary(r'''
class C {
int m() => 0;
}
''');
var c = library.firstFragment.classes.single;
var m = c.methods.single;
expect(m.hasImplicitReturnType, isFalse);
}
test_method_hasImplicitReturnType_true() async {
var library = await buildLibrary(r'''
class C {
m() => 0;
}
''');
var c = library.firstFragment.classes.single;
var m = c.methods.single;
expect(m.hasImplicitReturnType, isTrue);
}
test_method_inferred_type_nonStatic_implicit_return() async {
var library = await buildLibrary(r'''
class C extends D {
f() => null;
}
abstract class D {
int f();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 hasImplicitReturnType isComplete isOriginDeclaration f (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: <testLibrary>::@class::C::@method::f
#F4 isAbstract class D (nameOffset:53) (firstTokenOffset:38) (offset:53)
element: <testLibrary>::@class::D
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
methods
#F6 isAbstract isOriginDeclaration f (nameOffset:63) (firstTokenOffset:59) (offset:63)
element: <testLibrary>::@class::D::@method::f
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
superConstructor: <testLibrary>::@class::D::@constructor::new
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
returnType: int
isAbstract isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F4
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F5
methods
isOriginDeclaration f
reference: <testLibrary>::@class::D::@method::f
firstFragment: #F6
returnType: int
''');
}
test_method_invokesSuperSelf() async {
var library = await buildLibrary(r'''
class A {
void foo() {
super.foo();
}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 invokesSuperSelf isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
invokesSuperSelf isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
returnType: void
''');
}
test_method_missingName() async {
var library = await buildLibrary(r'''
class A {
() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 hasImplicitReturnType isComplete isOriginDeclaration <null-name> (nameOffset:<null>) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@method::#0
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration <null-name>
reference: <testLibrary>::@class::A::@method::#0
firstFragment: #F3
returnType: dynamic
''');
}
test_method_namedAsSupertype() async {
var library = await buildLibrary(r'''
class A {}
class B extends A {
void A() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
#F3 hasExtendsClause class B (nameOffset:18) (firstTokenOffset:12) (offset:18)
element: <testLibrary>::@class::B
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
methods
#F5 isComplete isOriginDeclaration A (nameOffset:39) (firstTokenOffset:34) (offset:39)
element: <testLibrary>::@class::B::@method::A
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F3
supertype: A
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F4
superConstructor: <testLibrary>::@class::A::@constructor::new
methods
isOriginDeclaration A
reference: <testLibrary>::@class::B::@method::A
firstFragment: #F5
returnType: void
''');
}
test_method_native() async {
var library = await buildLibrary(r'''
class C {
int m() native;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isExternal isOriginDeclaration m (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::C::@method::m
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isExternal isOriginDeclaration m
reference: <testLibrary>::@class::C::@method::m
firstFragment: #F3
returnType: int
''');
}
test_method_ofGeneric_refEnclosingTypeParameter_false_hide() async {
var library = await buildLibrary(r'''
class C<T> {
void foo<T>(T _) {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:15) (offset:20)
element: <testLibrary>::@class::C::@method::foo
typeParameters
#F4 T (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: #E1 T
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:29) (firstTokenOffset:27) (offset:29)
element: <testLibrary>::@class::C::@method::foo::@formalParameter::_
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::C::@method::foo
firstFragment: #F3
typeParameters
#E1 T
firstFragment: #F4
formalParameters
#E2 requiredPositional _
firstFragment: #F5
type: T
returnType: void
''');
}
test_method_ofGeneric_refEnclosingTypeParameter_true_formalParameter() async {
var library = await buildLibrary(r'''
class C<T> {
void foo(T _) {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:15) (offset:20)
element: <testLibrary>::@class::C::@method::foo
formalParameters
#F4 requiredPositional isOriginDeclaration _ (nameOffset:26) (firstTokenOffset:24) (offset:26)
element: <testLibrary>::@class::C::@method::foo::@formalParameter::_
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::C::@method::foo
firstFragment: #F3
formalParameters
#E1 requiredPositional _
firstFragment: #F4
type: T
returnType: void
''');
}
test_method_ofGeneric_refEnclosingTypeParameter_true_formalParameter2() async {
var library = await buildLibrary(r'''
class C<T> {
void foo(void Function(T) _) {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:15) (offset:20)
element: <testLibrary>::@class::C::@method::foo
formalParameters
#F4 requiredPositional isOriginDeclaration _ (nameOffset:41) (firstTokenOffset:24) (offset:41)
element: <testLibrary>::@class::C::@method::foo::@formalParameter::_
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::C::@method::foo
firstFragment: #F3
formalParameters
#E1 requiredPositional _
firstFragment: #F4
type: void Function(T)
returnType: void
''');
}
test_method_ofGeneric_refEnclosingTypeParameter_true_inferred() async {
var library = await buildLibrary(r'''
class A<U> {
U foo() {}
}
class B<T> extends A<T> {
foo() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 U (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 U
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:15) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F4 hasExtendsClause class B (nameOffset:35) (firstTokenOffset:29) (offset:35)
element: <testLibrary>::@class::B
typeParameters
#F5 T (nameOffset:37) (firstTokenOffset:37) (offset:37)
element: #E1 T
methods
#F6 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:57) (firstTokenOffset:57) (offset:57)
element: <testLibrary>::@class::B::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 U
firstFragment: #F2
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F3
returnType: U
isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F4
typeParameters
#E1 T
firstFragment: #F5
supertype: A<T>
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::B::@method::foo
firstFragment: #F6
returnType: T
''');
}
test_method_ofGeneric_refEnclosingTypeParameter_true_returnType() async {
var library = await buildLibrary(r'''
class C<T> {
T foo() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:15) (offset:17)
element: <testLibrary>::@class::C::@method::foo
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::C::@method::foo
firstFragment: #F3
returnType: T
''');
}
test_method_ofGeneric_refEnclosingTypeParameter_true_typeAlias() async {
var library = await buildLibrary(r'''
typedef MyInt<U> = int;
class C<T> {
MyInt<T> foo() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:31) (firstTokenOffset:25) (offset:31)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: #E0 T
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:49) (firstTokenOffset:40) (offset:49)
element: <testLibrary>::@class::C::@method::foo
typeAliases
#F4 MyInt (nameOffset:8) (firstTokenOffset:0) (offset:8)
element: <testLibrary>::@typeAlias::MyInt
typeParameters
#F5 U (nameOffset:14) (firstTokenOffset:14) (offset:14)
element: #E1 U
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::C::@method::foo
firstFragment: #F3
returnType: int
alias: <testLibrary>::@typeAlias::MyInt
typeArguments
T
typeAliases
isSimplyBounded MyInt
reference: <testLibrary>::@typeAlias::MyInt
firstFragment: #F4
typeParameters
#E1 U
firstFragment: #F5
aliasedType: int
''');
}
test_method_ofGeneric_refEnclosingTypeParameter_true_typeParameter() async {
var library = await buildLibrary(r'''
class C<T> {
void foo<U extends T>() {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
methods
#F3 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:15) (offset:20)
element: <testLibrary>::@class::C::@method::foo
typeParameters
#F4 U (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: #E1 U
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
methods
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::C::@method::foo
firstFragment: #F3
typeParameters
#E1 U
firstFragment: #F4
bound: T
returnType: void
''');
}
test_method_static() async {
var library = await buildLibrary(r'''
class C {
static f() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 hasImplicitReturnType isComplete isOriginDeclaration isStatic f (nameOffset:19) (firstTokenOffset:12) (offset:19)
element: <testLibrary>::@class::C::@method::f
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration isStatic f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
returnType: dynamic
''');
}
test_method_static_augmentation_chain_isComplete() async {
var library = await buildLibrary(r'''
class A {
static void foo();
}
augment class A {
augment static void foo() {}
}
augment class A {
augment static void foo();
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isAbstract isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
nextFragment: #F5
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F6
methods
#F5 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:74) (firstTokenOffset:54) (offset:74)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F4
nextFragment: #F7
#F6 isAugmentation class A (nameOffset:100) (firstTokenOffset:86) (offset:100)
element: <testLibrary>::@class::A
previousFragment: #F2
methods
#F7 isAbstract isAugmentation isOriginDeclaration isStatic foo (nameOffset:126) (firstTokenOffset:106) (offset:126)
element: <testLibrary>::@class::A::@method::foo
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_method_static_augmentation_sameName_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment static void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F4 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:63) (firstTokenOffset:43) (offset:63)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
previousFragmentOfDifferentKind: #F3
returnType: void
''');
}
test_method_static_augmentation_sameName_instanceField() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment static void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:41) (firstTokenOffset:27) (offset:41)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F8 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:67) (firstTokenOffset:47) (offset:67)
element: <testLibrary>::@class::A::@method::foo
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F8
returnType: void
''');
}
test_method_static_augmentation_sameName_instanceGetter() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment static void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F6 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:72) (firstTokenOffset:52) (offset:72)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F6
returnType: void
''');
}
test_method_static_augmentation_sameName_instanceMethod() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment static void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F5 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:68) (firstTokenOffset:48) (offset:68)
element: <testLibrary>::@class::A::@method::foo#1
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo#1
firstFragment: #F5
returnType: void
''');
}
test_method_static_augmentation_sameName_instanceSetter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {}
}
augment class A {
augment static void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F7 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:72) (firstTokenOffset:52) (offset:72)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F7
returnType: void
''');
}
test_method_static_augmentation_sameName_staticField() async {
var library = await buildLibrary(r'''
class A {
static int foo = 0;
}
augment class A {
augment static void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F8 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:74) (firstTokenOffset:54) (offset:74)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F8
previousFragmentOfDifferentKind: #F3
returnType: void
''');
}
test_method_static_augmentation_sameName_staticGetter() async {
var library = await buildLibrary(r'''
class A {
static int get foo => 0;
}
augment class A {
augment static void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration isStatic foo (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F6 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:79) (firstTokenOffset:59) (offset:79)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F6
previousFragmentOfDifferentKind: #F5
returnType: void
''');
}
test_method_static_augmentation_sameName_staticSetter() async {
var library = await buildLibrary(r'''
class A {
static set foo(int _) {}
}
augment class A {
augment static void foo() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
methods
#F7 isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:79) (firstTokenOffset:59) (offset:79)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F7
previousFragmentOfDifferentKind: #F5
returnType: void
''');
}
test_method_static_typeParameter() async {
var library = await buildLibrary(r'''
class A<T> {
static T? foo() => null;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:25) (firstTokenOffset:15) (offset:25)
element: <testLibrary>::@class::A::@method::foo
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: InvalidType
''');
}
test_method_syncStar() async {
var library = await buildLibrary(r'''
class C {
Iterable<int> f() sync* {
yield 42;
}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isGenerator isOriginDeclaration f (nameOffset:26) (firstTokenOffset:12) (offset:26) sync*
element: <testLibrary>::@class::C::@method::f
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
returnType: Iterable<int>
''');
}
test_method_typeParameter() async {
var library = await buildLibrary(r'''
class C {
T f<T, U>(U u) => null;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration f (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::C::@method::f
typeParameters
#F4 T (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: #E0 T
#F5 U (nameOffset:19) (firstTokenOffset:19) (offset:19)
element: #E1 U
formalParameters
#F6 requiredPositional isOriginDeclaration u (nameOffset:24) (firstTokenOffset:22) (offset:24)
element: <testLibrary>::@class::C::@method::f::@formalParameter::u
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F4
#E1 U
firstFragment: #F5
formalParameters
#E2 requiredPositional u
firstFragment: #F6
type: U
returnType: T
''');
}
test_method_typeParameter_inGenericClass() async {
var library = await buildLibrary(r'''
class C<T, U> {
V f<V, W>(T t, U u, W w) => null;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
#F3 U (nameOffset:11) (firstTokenOffset:11) (offset:11)
element: #E1 U
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F5 isComplete isOriginDeclaration f (nameOffset:20) (firstTokenOffset:18) (offset:20)
element: <testLibrary>::@class::C::@method::f
typeParameters
#F6 V (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: #E2 V
#F7 W (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: #E3 W
formalParameters
#F8 requiredPositional isOriginDeclaration t (nameOffset:30) (firstTokenOffset:28) (offset:30)
element: <testLibrary>::@class::C::@method::f::@formalParameter::t
#F9 requiredPositional isOriginDeclaration u (nameOffset:35) (firstTokenOffset:33) (offset:35)
element: <testLibrary>::@class::C::@method::f::@formalParameter::u
#F10 requiredPositional isOriginDeclaration w (nameOffset:40) (firstTokenOffset:38) (offset:40)
element: <testLibrary>::@class::C::@method::f::@formalParameter::w
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
#E1 U
firstFragment: #F3
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
methods
hasEnclosingTypeParameterReference isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F5
typeParameters
#E2 V
firstFragment: #F6
#E3 W
firstFragment: #F7
formalParameters
#E4 requiredPositional t
firstFragment: #F8
type: T
#E5 requiredPositional u
firstFragment: #F9
type: U
#E6 requiredPositional w
firstFragment: #F10
type: W
returnType: V
''');
}
test_method_typeParameter_with_formalParameter_regular_requiredPositional_functionTypedSuffix() async {
var library = await buildLibrary(r'''
class C {
void f<T, U>(T x(U u)) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration f (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::C::@method::f
typeParameters
#F4 T (nameOffset:19) (firstTokenOffset:19) (offset:19)
element: #E0 T
#F5 U (nameOffset:22) (firstTokenOffset:22) (offset:22)
element: #E1 U
formalParameters
#F6 requiredPositional isOriginDeclaration x (nameOffset:27) (firstTokenOffset:25) (offset:27)
element: <testLibrary>::@class::C::@method::f::@formalParameter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
typeParameters
#E0 T
firstFragment: #F4
#E1 U
firstFragment: #F5
formalParameters
#E2 requiredPositional x
firstFragment: #F6
type: T Function(U)
returnType: void
''');
}
test_methods() async {
var library = await buildLibrary(r'''
class C {
f() {}
g() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 hasImplicitReturnType isComplete isOriginDeclaration f (nameOffset:12) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::C::@method::f
#F4 hasImplicitReturnType isComplete isOriginDeclaration g (nameOffset:21) (firstTokenOffset:21) (offset:21)
element: <testLibrary>::@class::C::@method::g
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F3
returnType: dynamic
isOriginDeclaration g
reference: <testLibrary>::@class::C::@method::g
firstFragment: #F4
returnType: dynamic
''');
}
test_operator() async {
var library = await buildLibrary(r'''
class C {
C operator +(C other) => null;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration + (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::C::@method::+
formalParameters
#F4 requiredPositional isOriginDeclaration other (nameOffset:27) (firstTokenOffset:25) (offset:27)
element: <testLibrary>::@class::C::@method::+::@formalParameter::other
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration +
reference: <testLibrary>::@class::C::@method::+
firstFragment: #F3
formalParameters
#E0 requiredPositional other
firstFragment: #F4
type: C
returnType: C
''');
}
test_operator_equal() async {
var library = await buildLibrary(r'''
class C {
bool operator ==(Object other) => false;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration == (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::C::@method::==
formalParameters
#F4 requiredPositional isOriginDeclaration other (nameOffset:36) (firstTokenOffset:29) (offset:36)
element: <testLibrary>::@class::C::@method::==::@formalParameter::other
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration ==
reference: <testLibrary>::@class::C::@method::==
firstFragment: #F3
formalParameters
#E0 requiredPositional other
firstFragment: #F4
type: Object
returnType: bool
''');
}
test_operator_external() async {
var library = await buildLibrary(r'''
class C {
external C operator +(C other);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isExternal isOriginDeclaration + (nameOffset:32) (firstTokenOffset:12) (offset:32)
element: <testLibrary>::@class::C::@method::+
formalParameters
#F4 requiredPositional isOriginDeclaration other (nameOffset:36) (firstTokenOffset:34) (offset:36)
element: <testLibrary>::@class::C::@method::+::@formalParameter::other
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isExternal isOriginDeclaration +
reference: <testLibrary>::@class::C::@method::+
firstFragment: #F3
formalParameters
#E0 requiredPositional other
firstFragment: #F4
type: C
returnType: C
''');
}
test_operator_greater_equal() async {
var library = await buildLibrary(r'''
class C {
bool operator >=(C other) => false;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration >= (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::C::@method::>=
formalParameters
#F4 requiredPositional isOriginDeclaration other (nameOffset:31) (firstTokenOffset:29) (offset:31)
element: <testLibrary>::@class::C::@method::>=::@formalParameter::other
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration >=
reference: <testLibrary>::@class::C::@method::>=
firstFragment: #F3
formalParameters
#E0 requiredPositional other
firstFragment: #F4
type: C
returnType: bool
''');
}
test_operator_index() async {
var library = await buildLibrary(r'''
class C {
bool operator [](int i) => null;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration [] (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::C::@method::[]
formalParameters
#F4 requiredPositional isOriginDeclaration i (nameOffset:33) (firstTokenOffset:29) (offset:33)
element: <testLibrary>::@class::C::@method::[]::@formalParameter::i
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration []
reference: <testLibrary>::@class::C::@method::[]
firstFragment: #F3
formalParameters
#E0 requiredPositional i
firstFragment: #F4
type: int
returnType: bool
''');
}
test_operator_index_set() async {
var library = await buildLibrary(r'''
class C {
void operator []=(int i, bool v) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration []= (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::C::@method::[]=
formalParameters
#F4 requiredPositional isOriginDeclaration i (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::C::@method::[]=::@formalParameter::i
#F5 requiredPositional isOriginDeclaration v (nameOffset:42) (firstTokenOffset:37) (offset:42)
element: <testLibrary>::@class::C::@method::[]=::@formalParameter::v
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration []=
reference: <testLibrary>::@class::C::@method::[]=
firstFragment: #F3
formalParameters
#E0 requiredPositional i
firstFragment: #F4
type: int
#E1 requiredPositional v
firstFragment: #F5
type: bool
returnType: void
''');
}
test_operator_less_equal() async {
var library = await buildLibrary(r'''
class C {
bool operator <=(C other) => false;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F3 isComplete isOriginDeclaration <= (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::C::@method::<=
formalParameters
#F4 requiredPositional isOriginDeclaration other (nameOffset:31) (firstTokenOffset:29) (offset:31)
element: <testLibrary>::@class::C::@method::<=::@formalParameter::other
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration <=
reference: <testLibrary>::@class::C::@method::<=
firstFragment: #F3
formalParameters
#E0 requiredPositional other
firstFragment: #F4
type: C
returnType: bool
''');
}
test_operator_minus() async {
var library = await buildLibrary(r'''
class A {
int operator -(int other) => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration - (nameOffset:25) (firstTokenOffset:12) (offset:25)
element: <testLibrary>::@class::A::@method::-
formalParameters
#F4 requiredPositional isOriginDeclaration other (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@method::-::@formalParameter::other
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration -
reference: <testLibrary>::@class::A::@method::-
firstFragment: #F3
formalParameters
#E0 requiredPositional other
firstFragment: #F4
type: int
returnType: int
''');
}
test_operator_minus_unary() async {
var library = await buildLibrary(r'''
class A {
int operator -() => 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 isComplete isOriginDeclaration - (nameOffset:25) (firstTokenOffset:12) (offset:25)
element: <testLibrary>::@class::A::@method::unary-
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration -
reference: <testLibrary>::@class::A::@method::unary-
firstFragment: #F3
returnType: int
''');
}
test_primaryInitializerScope_fieldInitializer_instance() async {
var library = await buildLibrary(r'''
class A(int foo) {
var bar = foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 hasImplicitType hasInitializer isOriginDeclaration bar (nameOffset:25) (firstTokenOffset:25) (offset:25)
element: <testLibrary>::@class::A::@field::bar
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::A::@getter::bar
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::A::@setter::bar
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25)
element: <testLibrary>::@class::A::@setter::bar::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasImplicitType hasInitializer isOriginDeclaration isTypeInferredFromInitializer bar
reference: <testLibrary>::@class::A::@field::bar
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::bar
setter: <testLibrary>::@class::A::@setter::bar
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional foo
firstFragment: #F6
type: int
getters
isOriginVariable bar
reference: <testLibrary>::@class::A::@getter::bar
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::bar
setters
isOriginVariable bar
reference: <testLibrary>::@class::A::@setter::bar
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::bar
''');
}
test_primaryInitializerScope_fieldInitializer_instance_declaringFormal() async {
var library = await buildLibrary(r'''
class A(final int foo) {
var bar = foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isFinal isOriginDeclaringFormalParameter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F3
#F4 hasImplicitType hasInitializer isOriginDeclaration bar (nameOffset:31) (firstTokenOffset:31) (offset:31)
element: <testLibrary>::@class::A::@field::bar
inducedGetter: #F5
inducedSetter: #F6
constructors
#F7 isComplete isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F8 requiredPositional isDeclaring isFinal isOriginDeclaration this.foo (nameOffset:18) (firstTokenOffset:8) (offset:18)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F2
#F5 isComplete isOriginVariable bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::A::@getter::bar
inducingVariable: #F4
setters
#F6 isComplete isOriginVariable bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::A::@setter::bar
inducingVariable: #F4
formalParameters
#F9 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31)
element: <testLibrary>::@class::A::@setter::bar::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isFinal isOriginDeclaringFormalParameter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::foo
declaringFormalParameter: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
hasImplicitType hasInitializer isOriginDeclaration isTypeInferredFromInitializer bar
reference: <testLibrary>::@class::A::@field::bar
firstFragment: #F4
type: int
getter: <testLibrary>::@class::A::@getter::bar
setter: <testLibrary>::@class::A::@setter::bar
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F7
formalParameters
#E0 requiredPositional isDeclaring isFinal this.foo
firstFragment: #F8
type: int
field: <testLibrary>::@class::A::@field::foo
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::foo
isOriginVariable bar
reference: <testLibrary>::@class::A::@getter::bar
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::bar
setters
isOriginVariable bar
reference: <testLibrary>::@class::A::@setter::bar
firstFragment: #F6
formalParameters
#E1 requiredPositional value
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::bar
''');
}
test_primaryInitializerScope_fieldInitializer_instance_late() async {
var library = await buildLibrary(r'''
class A(int foo) {
late var bar = foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 hasImplicitType hasInitializer isLate isOriginDeclaration bar (nameOffset:30) (firstTokenOffset:30) (offset:30)
element: <testLibrary>::@class::A::@field::bar
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::A::@getter::bar
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::A::@setter::bar
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30)
element: <testLibrary>::@class::A::@setter::bar::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasImplicitType hasInitializer isLate isOriginDeclaration isTypeInferredFromInitializer bar
reference: <testLibrary>::@class::A::@field::bar
firstFragment: #F2
type: InvalidType
getter: <testLibrary>::@class::A::@getter::bar
setter: <testLibrary>::@class::A::@setter::bar
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional foo
firstFragment: #F6
type: int
getters
isOriginVariable bar
reference: <testLibrary>::@class::A::@getter::bar
firstFragment: #F3
returnType: InvalidType
variable: <testLibrary>::@class::A::@field::bar
setters
isOriginVariable bar
reference: <testLibrary>::@class::A::@setter::bar
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: InvalidType
returnType: void
variable: <testLibrary>::@class::A::@field::bar
''');
}
test_primaryInitializerScope_fieldInitializer_instance_typePromotion() async {
var library = await buildLibrary(r'''
class A(int? foo) {
var bar = foo != null ? foo : 0;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 hasImplicitType hasInitializer isOriginDeclaration bar (nameOffset:26) (firstTokenOffset:26) (offset:26)
element: <testLibrary>::@class::A::@field::bar
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isOriginDeclaration foo (nameOffset:13) (firstTokenOffset:8) (offset:13)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::A::@getter::bar
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::A::@setter::bar
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::A::@setter::bar::@formalParameter::value
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasImplicitType hasInitializer isOriginDeclaration isTypeInferredFromInitializer bar
reference: <testLibrary>::@class::A::@field::bar
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::bar
setter: <testLibrary>::@class::A::@setter::bar
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional foo
firstFragment: #F6
type: int?
getters
isOriginVariable bar
reference: <testLibrary>::@class::A::@getter::bar
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::bar
setters
isOriginVariable bar
reference: <testLibrary>::@class::A::@setter::bar
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::bar
''');
}
test_primaryInitializerScope_fieldInitializer_static() async {
var library = await buildLibrary(r'''
class A(int foo) {
static var bar = foo;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 hasImplicitType hasInitializer isOriginDeclaration isStatic bar (nameOffset:32) (firstTokenOffset:32) (offset:32)
element: <testLibrary>::@class::A::@field::bar
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginDeclaration isPrimary new (nameOffset:<null>) (firstTokenOffset:6) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
typeNameOffset: 6
formalParameters
#F6 requiredPositional isOriginDeclaration foo (nameOffset:12) (firstTokenOffset:8) (offset:12)
element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo
getters
#F3 isComplete isOriginVariable isStatic bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32)
element: <testLibrary>::@class::A::@getter::bar
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable isStatic bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32)
element: <testLibrary>::@class::A::@setter::bar
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32)
element: <testLibrary>::@class::A::@setter::bar::@formalParameter::value
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasImplicitType hasInitializer isOriginDeclaration isStatic isTypeInferredFromInitializer bar
reference: <testLibrary>::@class::A::@field::bar
firstFragment: #F2
type: InvalidType
getter: <testLibrary>::@class::A::@getter::bar
setter: <testLibrary>::@class::A::@setter::bar
constructors
isOriginDeclaration isPrimary new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
formalParameters
#E0 requiredPositional foo
firstFragment: #F6
type: int
getters
isOriginVariable isStatic bar
reference: <testLibrary>::@class::A::@getter::bar
firstFragment: #F3
returnType: InvalidType
variable: <testLibrary>::@class::A::@field::bar
setters
isOriginVariable isStatic bar
reference: <testLibrary>::@class::A::@setter::bar
firstFragment: #F4
formalParameters
#E1 requiredPositional value
firstFragment: #F7
type: InvalidType
returnType: void
variable: <testLibrary>::@class::A::@field::bar
''');
}
test_setter_abstract() async {
var library = await buildLibrary(r'''
abstract class C {
void set x(int value);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 isAbstract class C (nameOffset:15) (firstTokenOffset:0) (offset:15)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isAbstract isOriginDeclaration x (nameOffset:30) (firstTokenOffset:21) (offset:30)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional isOriginDeclaration value (nameOffset:36) (firstTokenOffset:32) (offset:36)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isAbstract isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_augmentation_add() async {
var library = await buildLibrary(r'''
class A {
set foo1(int _) {}
}
augment class A {
set foo2(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo1
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration foo1 (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo1
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@setter::foo1::@formalParameter::_
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F7 isOriginGetterSetter foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48)
element: <testLibrary>::@class::A::@field::foo2
setters
#F8 hasImplicitReturnType isComplete isOriginDeclaration foo2 (nameOffset:58) (firstTokenOffset:54) (offset:58)
element: <testLibrary>::@class::A::@setter::foo2
formalParameters
#F9 requiredPositional isOriginDeclaration _ (nameOffset:67) (firstTokenOffset:63) (offset:67)
element: <testLibrary>::@class::A::@setter::foo2::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo1
reference: <testLibrary>::@class::A::@field::foo1
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo1
isOriginGetterSetter foo2
reference: <testLibrary>::@class::A::@field::foo2
firstFragment: #F7
type: int
setter: <testLibrary>::@class::A::@setter::foo2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@setter::foo1
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo1
isOriginDeclaration foo2
reference: <testLibrary>::@class::A::@setter::foo2
firstFragment: #F8
formalParameters
#E1 requiredPositional _
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo2
''');
}
test_setter_augmentation_chain() async {
var library = await buildLibrary(r'''
class A {
set foo1(int _) {}
set foo2(int _) {}
}
augment class A {
augment set foo1(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo1
#F4 isOriginGetterSetter foo2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo2
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F6 hasImplicitReturnType isComplete isOriginDeclaration foo1 (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo1
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:25) (firstTokenOffset:21) (offset:25)
element: <testLibrary>::@class::A::@setter::foo1::@formalParameter::_
nextFragment: #F8
nextFragment: #F9
#F10 hasImplicitReturnType isComplete isOriginDeclaration foo2 (nameOffset:37) (firstTokenOffset:33) (offset:37)
element: <testLibrary>::@class::A::@setter::foo2
formalParameters
#F11 requiredPositional isOriginDeclaration _ (nameOffset:46) (firstTokenOffset:42) (offset:46)
element: <testLibrary>::@class::A::@setter::foo2::@formalParameter::_
#F2 isAugmentation class A (nameOffset:69) (firstTokenOffset:55) (offset:69)
element: <testLibrary>::@class::A
previousFragment: #F1
setters
#F9 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo1 (nameOffset:87) (firstTokenOffset:75) (offset:87)
element: <testLibrary>::@class::A::@setter::foo1
formalParameters
#F8 requiredPositional isOriginDeclaration _ (nameOffset:96) (firstTokenOffset:92) (offset:96)
element: <testLibrary>::@class::A::@setter::foo1::@formalParameter::_
previousFragment: #F7
previousFragment: #F6
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo1
reference: <testLibrary>::@class::A::@field::foo1
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo1
isOriginGetterSetter foo2
reference: <testLibrary>::@class::A::@field::foo2
firstFragment: #F4
type: int
setter: <testLibrary>::@class::A::@setter::foo2
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
setters
isOriginDeclaration foo1
reference: <testLibrary>::@class::A::@setter::foo1
firstFragment: #F6
formalParameters
#E0 requiredPositional _
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo1
isOriginDeclaration foo2
reference: <testLibrary>::@class::A::@setter::foo2
firstFragment: #F10
formalParameters
#E1 requiredPositional _
firstFragment: #F11
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo2
''');
}
test_setter_augmentation_chain_fromField() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F8
nextFragment: #F9
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
setters
#F9 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:60) (firstTokenOffset:48) (offset:60)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F8 requiredPositional isOriginDeclaration _ (nameOffset:68) (firstTokenOffset:64) (offset:68)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F7
previousFragment: #F5
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_augmentation_chain_isComplete_instance() async {
var library = await buildLibrary(r'''
class A {
set foo(int _);
}
augment class A {
augment set foo(int _) {}
}
augment class A {
augment set foo(int _);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isAbstract isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:45) (firstTokenOffset:31) (offset:45)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
setters
#F8 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:63) (firstTokenOffset:51) (offset:63)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:71) (firstTokenOffset:67) (offset:71)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
previousFragment: #F6
nextFragment: #F10
previousFragment: #F5
nextFragment: #F11
#F9 isAugmentation class A (nameOffset:94) (firstTokenOffset:80) (offset:94)
element: <testLibrary>::@class::A
previousFragment: #F2
setters
#F11 hasImplicitReturnType isAbstract isAugmentation isOriginDeclaration foo (nameOffset:112) (firstTokenOffset:100) (offset:112)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F10 requiredPositional isOriginDeclaration _ (nameOffset:120) (firstTokenOffset:116) (offset:120)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_augmentation_chain_noIntroductoryDeclaration() async {
var library = await buildLibrary(r'''
class A {}
augment class A {
augment set foo(int _) {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
#F2 isAugmentation class A (nameOffset:26) (firstTokenOffset:12) (offset:26)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26)
element: <testLibrary>::@class::A::@field::foo
setters
#F4 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:44) (firstTokenOffset:32) (offset:44)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:52) (firstTokenOffset:48) (offset:52)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional _
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_augmentation_sameName_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::A::@field::foo
setters
#F5 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:55) (firstTokenOffset:43) (offset:55)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:63) (firstTokenOffset:59) (offset:63)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_augmentation_sameName_instanceGetter() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:47) (firstTokenOffset:33) (offset:47)
element: <testLibrary>::@class::A
previousFragment: #F1
setters
#F6 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:65) (firstTokenOffset:53) (offset:65)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:73) (firstTokenOffset:69) (offset:73)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
previousFragmentOfDifferentKind: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_augmentation_sameName_instanceMethod() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:43) (firstTokenOffset:29) (offset:43)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:43)
element: <testLibrary>::@class::A::@field::foo
setters
#F6 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:61) (firstTokenOffset:49) (offset:61)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:69) (firstTokenOffset:65) (offset:69)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
previousFragmentOfDifferentKind: #F4
formalParameters
#E0 requiredPositional _
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_setter_augmentation_sameName_staticField() async {
var library = await buildLibrary(r'''
class A {
static int foo = 0;
}
augment class A {
augment set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F8 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48)
element: <testLibrary>::@class::A::@field::foo#1
setters
#F9 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:66) (firstTokenOffset:54) (offset:66)
element: <testLibrary>::@class::A::@setter::foo#1
formalParameters
#F10 requiredPositional isOriginDeclaration _ (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@setter::foo#1::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F8
type: int
setter: <testLibrary>::@class::A::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo#1
firstFragment: #F9
formalParameters
#E1 requiredPositional _
firstFragment: #F10
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_setter_augmentation_sameName_staticGetter() async {
var library = await buildLibrary(r'''
class A {
static int get foo => 0;
}
augment class A {
augment set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration isStatic foo (nameOffset:27) (firstTokenOffset:12) (offset:27)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::A::@field::foo#1
setters
#F7 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:71) (firstTokenOffset:59) (offset:71)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F8 requiredPositional isOriginDeclaration _ (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F6
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F7
formalParameters
#E0 requiredPositional _
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_setter_augmentation_sameName_staticMethod() async {
var library = await buildLibrary(r'''
class A {
static void foo() {}
}
augment class A {
augment set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49)
element: <testLibrary>::@class::A::@field::foo
setters
#F6 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:67) (firstTokenOffset:55) (offset:67)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:75) (firstTokenOffset:71) (offset:75)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
formalParameters
#E0 requiredPositional _
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_setter_augmentation_sameName_staticSetter() async {
var library = await buildLibrary(r'''
class A {
static set foo(int _) {}
}
augment class A {
augment set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:53) (firstTokenOffset:39) (offset:53)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F7 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53)
element: <testLibrary>::@class::A::@field::foo#1
setters
#F8 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration foo (nameOffset:71) (firstTokenOffset:59) (offset:71)
element: <testLibrary>::@class::A::@setter::foo#1
formalParameters
#F9 requiredPositional isOriginDeclaration _ (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@setter::foo#1::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F7
type: int
setter: <testLibrary>::@class::A::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo#1
firstFragment: #F8
formalParameters
#E1 requiredPositional _
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_setter_covariant() async {
var library = await buildLibrary(r'''
class C {
void set x(covariant int value);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isAbstract isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional isExplicitlyCovariant isOriginDeclaration value (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional isCovariant value
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_external() async {
var library = await buildLibrary(r'''
class C {
external void set x(int value);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isExternal isOriginDeclaration x (nameOffset:30) (firstTokenOffset:12) (offset:30)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional isOriginDeclaration value (nameOffset:36) (firstTokenOffset:32) (offset:36)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isExternal isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_formalParameter_regular_requiredPositional_implicitType() async {
var library = await buildLibrary(r'''
class C {
void set x(value) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional hasImplicitType isOriginDeclaration value (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType value
firstFragment: #F5
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_formalParameter_regular_requiredPositional_inferredType_nonStatic_implicit() async {
var library = await buildLibrary(r'''
class C extends D {
void set f(value) {}
}
abstract class D {
void set f(int value);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 hasExtendsClause class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::f
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isOriginDeclaration f (nameOffset:31) (firstTokenOffset:22) (offset:31)
element: <testLibrary>::@class::C::@setter::f
formalParameters
#F5 requiredPositional hasImplicitType isOriginDeclaration value (nameOffset:33) (firstTokenOffset:33) (offset:33)
element: <testLibrary>::@class::C::@setter::f::@formalParameter::value
#F6 isAbstract class D (nameOffset:61) (firstTokenOffset:46) (offset:61)
element: <testLibrary>::@class::D
fields
#F7 isOriginGetterSetter f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::D::@field::f
constructors
#F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
setters
#F9 isAbstract isOriginDeclaration f (nameOffset:76) (firstTokenOffset:67) (offset:76)
element: <testLibrary>::@class::D::@setter::f
formalParameters
#F10 requiredPositional isOriginDeclaration value (nameOffset:82) (firstTokenOffset:78) (offset:82)
element: <testLibrary>::@class::D::@setter::f::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
supertype: D
fields
isOriginGetterSetter f
reference: <testLibrary>::@class::C::@field::f
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::f
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
superConstructor: <testLibrary>::@class::D::@constructor::new
setters
isOriginDeclaration f
reference: <testLibrary>::@class::C::@setter::f
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType value
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::f
isAbstract isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F6
fields
isOriginGetterSetter f
reference: <testLibrary>::@class::D::@field::f
firstFragment: #F7
type: int
setter: <testLibrary>::@class::D::@setter::f
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F8
setters
isOriginDeclaration f
reference: <testLibrary>::@class::D::@setter::f
firstFragment: #F9
formalParameters
#E1 requiredPositional value
firstFragment: #F10
type: int
returnType: void
variable: <testLibrary>::@class::D::@field::f
''');
}
test_setter_implicit_return_type() async {
var library = await buildLibrary(r'''
class C {
set x(int value) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 hasImplicitReturnType isComplete isOriginDeclaration x (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional isOriginDeclaration value (nameOffset:22) (firstTokenOffset:18) (offset:22)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_inferred_type_conflictingInheritance() async {
var library = await buildLibrary(r'''
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
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginDeclaration t (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::t
inducedGetter: #F3
inducedSetter: #F4
constructors
#F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F3 isComplete isOriginVariable t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::t
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::t
inducingVariable: #F2
formalParameters
#F6 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::t::@formalParameter::value
#F7 hasExtendsClause class B (nameOffset:28) (firstTokenOffset:22) (offset:28)
element: <testLibrary>::@class::B
fields
#F8 isOriginDeclaration t (nameOffset:51) (firstTokenOffset:51) (offset:51)
element: <testLibrary>::@class::B::@field::t
inducedGetter: #F9
inducedSetter: #F10
constructors
#F11 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28)
element: <testLibrary>::@class::B::@constructor::new
typeName: B
getters
#F9 isComplete isOriginVariable t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:51)
element: <testLibrary>::@class::B::@getter::t
inducingVariable: #F8
setters
#F10 isComplete isOriginVariable t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:51)
element: <testLibrary>::@class::B::@setter::t
inducingVariable: #F8
formalParameters
#F12 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:51)
element: <testLibrary>::@class::B::@setter::t::@formalParameter::value
#F13 hasExtendsClause class C (nameOffset:63) (firstTokenOffset:57) (offset:63)
element: <testLibrary>::@class::C
constructors
#F14 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
#F15 hasExtendsClause class D (nameOffset:98) (firstTokenOffset:92) (offset:98)
element: <testLibrary>::@class::D
fields
#F16 isOriginGetterSetter t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:98)
element: <testLibrary>::@class::D::@field::t
constructors
#F17 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:98)
element: <testLibrary>::@class::D::@constructor::new
typeName: D
setters
#F18 isComplete isOriginDeclaration t (nameOffset:123) (firstTokenOffset:114) (offset:123)
element: <testLibrary>::@class::D::@setter::t
formalParameters
#F19 requiredPositional hasImplicitType isOriginDeclaration p (nameOffset:125) (firstTokenOffset:125) (offset:125)
element: <testLibrary>::@class::D::@setter::t::@formalParameter::p
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginDeclaration t
reference: <testLibrary>::@class::A::@field::t
firstFragment: #F2
type: int
getter: <testLibrary>::@class::A::@getter::t
setter: <testLibrary>::@class::A::@setter::t
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F5
getters
isOriginVariable t
reference: <testLibrary>::@class::A::@getter::t
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::A::@field::t
setters
isOriginVariable t
reference: <testLibrary>::@class::A::@setter::t
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::t
hasNonFinalField isSimplyBounded class B
reference: <testLibrary>::@class::B
firstFragment: #F7
supertype: A
fields
isOriginDeclaration t
reference: <testLibrary>::@class::B::@field::t
firstFragment: #F8
type: double
getter: <testLibrary>::@class::B::@getter::t
setter: <testLibrary>::@class::B::@setter::t
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::B::@constructor::new
firstFragment: #F11
superConstructor: <testLibrary>::@class::A::@constructor::new
getters
isOriginVariable t
reference: <testLibrary>::@class::B::@getter::t
firstFragment: #F9
returnType: double
variable: <testLibrary>::@class::B::@field::t
setters
isOriginVariable t
reference: <testLibrary>::@class::B::@setter::t
firstFragment: #F10
formalParameters
#E1 requiredPositional value
firstFragment: #F12
type: double
returnType: void
variable: <testLibrary>::@class::B::@field::t
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F13
supertype: A
interfaces
B
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F14
superConstructor: <testLibrary>::@class::A::@constructor::new
hasNonFinalField isSimplyBounded class D
reference: <testLibrary>::@class::D
firstFragment: #F15
supertype: C
fields
isOriginGetterSetter t
reference: <testLibrary>::@class::D::@field::t
firstFragment: #F16
type: dynamic
setter: <testLibrary>::@class::D::@setter::t
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::D::@constructor::new
firstFragment: #F17
superConstructor: <testLibrary>::@class::C::@constructor::new
setters
isOriginDeclaration t
reference: <testLibrary>::@class::D::@setter::t
firstFragment: #F18
formalParameters
#E2 requiredPositional hasImplicitType p
firstFragment: #F19
type: dynamic
returnType: void
variable: <testLibrary>::@class::D::@field::t
''');
}
test_setter_inferred_type_static_implicit_return() async {
var library = await buildLibrary(r'''
class C {
static set f(int value) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter isStatic f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::f
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 hasImplicitReturnType isComplete isOriginDeclaration isStatic f (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::C::@setter::f
formalParameters
#F5 requiredPositional isOriginDeclaration value (nameOffset:29) (firstTokenOffset:25) (offset:29)
element: <testLibrary>::@class::C::@setter::f::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter isStatic f
reference: <testLibrary>::@class::C::@field::f
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::f
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration isStatic f
reference: <testLibrary>::@class::C::@setter::f
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::f
''');
}
test_setter_invalid_formalParameter_field_requiredPositional() async {
var library = await buildLibrary(r'''
class C {
int foo;
void set bar(this.foo) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::C::@field::foo
inducedGetter: #F3
inducedSetter: #F4
#F5 isOriginGetterSetter bar (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::bar
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
getters
#F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@getter::foo
inducingVariable: #F2
setters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::foo
inducingVariable: #F2
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::value
#F8 isComplete isOriginDeclaration bar (nameOffset:32) (firstTokenOffset:23) (offset:32)
element: <testLibrary>::@class::C::@setter::bar
formalParameters
#F9 requiredPositional hasImplicitType isFinal isOriginDeclaration this.foo (nameOffset:41) (firstTokenOffset:36) (offset:41)
element: <testLibrary>::@class::C::@setter::bar::@formalParameter::foo
classes
hasNonFinalField isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginDeclaration foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F2
type: int
getter: <testLibrary>::@class::C::@getter::foo
setter: <testLibrary>::@class::C::@setter::foo
isOriginGetterSetter bar
reference: <testLibrary>::@class::C::@field::bar
firstFragment: #F5
type: dynamic
setter: <testLibrary>::@class::C::@setter::bar
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::C::@getter::foo
firstFragment: #F3
returnType: int
variable: <testLibrary>::@class::C::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo
isOriginDeclaration bar
reference: <testLibrary>::@class::C::@setter::bar
firstFragment: #F8
formalParameters
#E1 requiredPositional hasImplicitType isFinal this.foo
firstFragment: #F9
type: dynamic
field: <null>
returnType: void
variable: <testLibrary>::@class::C::@field::bar
''');
}
test_setter_invalid_formalParameter_field_requiredPositional_sameName() async {
var library = await buildLibrary(r'''
class C {
set x(this.x) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 hasImplicitReturnType isComplete isOriginDeclaration x (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:23) (firstTokenOffset:18) (offset:23)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::x
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType isFinal this.x
firstFragment: #F5
type: dynamic
field: <null>
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_invalid_formalParameter_regular_optionalNamed() async {
var library = await buildLibrary(r'''
class C {
void set x({a}) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 optionalNamed hasImplicitType isOriginDeclaration a (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::a
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 optionalNamed hasImplicitType a
firstFragment: #F5
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_invalid_formalParameter_regular_optionalPositional() async {
var library = await buildLibrary(r'''
class C {
void set x([a]) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 optionalPositional hasImplicitType isOriginDeclaration a (nameOffset:24) (firstTokenOffset:24) (offset:24)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::a
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 optionalPositional hasImplicitType a
firstFragment: #F5
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_invalid_formalParameters_none() async {
var library = await buildLibrary(r'''
class C {
void set x() {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional hasImplicitType isOriginDeclaration <null-name> (nameOffset:<null>) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::<null-name>
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType <null-name>
firstFragment: #F5
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_invalid_formalParameters_tooMany() async {
var library = await buildLibrary(r'''
class C {
void set x(a, b) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional hasImplicitType isOriginDeclaration a (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::a
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: dynamic
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional hasImplicitType a
firstFragment: #F5
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_invokesSuperSelf_getter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {
super.foo;
}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F4 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional _
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_invokesSuperSelf_setter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {
super.foo = 0;
}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
fields
#F2 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F4 hasImplicitReturnType invokesSuperSelf isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F2
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
setters
invokesSuperSelf isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F4
formalParameters
#E0 requiredPositional _
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_missingName() async {
var library = await buildLibrary(r'''
class A {
set(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
constructors
#F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F3 hasImplicitReturnType isComplete isOriginDeclaration set (nameOffset:12) (firstTokenOffset:12) (offset:12)
element: <testLibrary>::@class::A::@method::set
formalParameters
#F4 requiredPositional isOriginDeclaration _ (nameOffset:20) (firstTokenOffset:16) (offset:20)
element: <testLibrary>::@class::A::@method::set::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F2
methods
isOriginDeclaration set
reference: <testLibrary>::@class::A::@method::set
firstFragment: #F3
formalParameters
#E0 requiredPositional _
firstFragment: #F4
type: int
returnType: dynamic
''');
}
test_setter_native() async {
var library = await buildLibrary(r'''
class C {
void set x(int value) native;
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isExternal isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional isOriginDeclaration value (nameOffset:27) (firstTokenOffset:23) (offset:27)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isExternal isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_ofGeneric_refEnclosingTypeParameter_false() async {
var library = await buildLibrary(r'''
class C<T> {
set foo(int _) {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::foo
setters
#F4 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:19) (firstTokenOffset:15) (offset:19)
element: <testLibrary>::@class::C::@setter::foo
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:27) (firstTokenOffset:23) (offset:27)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::C::@setter::foo
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F4
formalParameters
#E1 requiredPositional _
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_setter_ofGeneric_refEnclosingTypeParameter_true() async {
var library = await buildLibrary(r'''
class C<T> {
set foo(T _) {}
}
''');
configuration.withConstructors = false;
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::foo
setters
#F4 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:19) (firstTokenOffset:15) (offset:19)
element: <testLibrary>::@class::C::@setter::foo
formalParameters
#F5 requiredPositional isOriginDeclaration _ (nameOffset:25) (firstTokenOffset:23) (offset:25)
element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
fields
hasEnclosingTypeParameterReference isOriginGetterSetter foo
reference: <testLibrary>::@class::C::@field::foo
firstFragment: #F3
type: T
setter: <testLibrary>::@class::C::@setter::foo
setters
hasEnclosingTypeParameterReference isOriginDeclaration foo
reference: <testLibrary>::@class::C::@setter::foo
firstFragment: #F4
formalParameters
#E1 requiredPositional _
firstFragment: #F5
type: T
returnType: void
variable: <testLibrary>::@class::C::@field::foo
''');
}
test_setter_static() async {
var library = await buildLibrary(r'''
class C {
static void set x(int value) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F4 isComplete isOriginDeclaration isStatic x (nameOffset:28) (firstTokenOffset:12) (offset:28)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F5 requiredPositional isOriginDeclaration value (nameOffset:34) (firstTokenOffset:30) (offset:34)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter isStatic x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::x
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration isStatic x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F4
formalParameters
#E0 requiredPositional value
firstFragment: #F5
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
''');
}
test_setter_static_augmentation_chain_isComplete() async {
var library = await buildLibrary(r'''
class A {
static set foo(int _);
}
augment class A {
augment static set foo(int _) {}
}
augment class A {
augment static set foo(int _);
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isAbstract isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:12) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:31) (firstTokenOffset:27) (offset:31)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
nextFragment: #F7
nextFragment: #F8
#F2 isAugmentation class A (nameOffset:52) (firstTokenOffset:38) (offset:52)
element: <testLibrary>::@class::A
previousFragment: #F1
nextFragment: #F9
setters
#F8 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:77) (firstTokenOffset:58) (offset:77)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:85) (firstTokenOffset:81) (offset:85)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
previousFragment: #F6
nextFragment: #F10
previousFragment: #F5
nextFragment: #F11
#F9 isAugmentation class A (nameOffset:108) (firstTokenOffset:94) (offset:108)
element: <testLibrary>::@class::A
previousFragment: #F2
setters
#F11 hasImplicitReturnType isAbstract isAugmentation isOriginDeclaration isStatic foo (nameOffset:133) (firstTokenOffset:114) (offset:133)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F10 requiredPositional isOriginDeclaration _ (nameOffset:141) (firstTokenOffset:137) (offset:141)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
previousFragment: #F7
previousFragment: #F8
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_static_augmentation_sameName_constructor() async {
var library = await buildLibrary(r'''
class A {
A.foo();
}
augment class A {
augment static set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginDeclaration foo (nameOffset:14) (firstTokenOffset:12) (offset:14)
element: <testLibrary>::@class::A::@constructor::foo
typeName: A
typeNameOffset: 12
periodOffset: 13
#F2 isAugmentation class A (nameOffset:37) (firstTokenOffset:23) (offset:37)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F4 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@class::A::@field::foo
setters
#F5 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:62) (firstTokenOffset:43) (offset:62)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:70) (firstTokenOffset:66) (offset:70)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F4
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@constructor::foo
firstFragment: #F3
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
previousFragmentOfDifferentKind: #F3
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_static_augmentation_sameName_instanceField() async {
var library = await buildLibrary(r'''
class A {
int foo = 0;
}
augment class A {
augment static set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:16) (offset:16)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:16)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
#F2 isAugmentation class A (nameOffset:41) (firstTokenOffset:27) (offset:41)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F8 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41)
element: <testLibrary>::@class::A::@field::foo#1
setters
#F9 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:66) (firstTokenOffset:47) (offset:66)
element: <testLibrary>::@class::A::@setter::foo#1
formalParameters
#F10 requiredPositional isOriginDeclaration _ (nameOffset:74) (firstTokenOffset:70) (offset:74)
element: <testLibrary>::@class::A::@setter::foo#1::@formalParameter::_
classes
hasNonFinalField isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F8
type: int
setter: <testLibrary>::@class::A::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo#1
firstFragment: #F9
formalParameters
#E1 requiredPositional _
firstFragment: #F10
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_setter_static_augmentation_sameName_instanceGetter() async {
var library = await buildLibrary(r'''
class A {
int get foo => 0;
}
augment class A {
augment static set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F5 isComplete isOriginDeclaration foo (nameOffset:20) (firstTokenOffset:12) (offset:20)
element: <testLibrary>::@class::A::@getter::foo
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F6 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46)
element: <testLibrary>::@class::A::@field::foo#1
setters
#F7 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:71) (firstTokenOffset:52) (offset:71)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F8 requiredPositional isOriginDeclaration _ (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F6
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
getters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F5
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F7
formalParameters
#E0 requiredPositional _
firstFragment: #F8
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_setter_static_augmentation_sameName_instanceMethod() async {
var library = await buildLibrary(r'''
class A {
void foo() {}
}
augment class A {
augment static set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration foo (nameOffset:17) (firstTokenOffset:12) (offset:17)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:42) (firstTokenOffset:28) (offset:42)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:42)
element: <testLibrary>::@class::A::@field::foo
setters
#F6 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:67) (firstTokenOffset:48) (offset:67)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:75) (firstTokenOffset:71) (offset:75)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
formalParameters
#E0 requiredPositional _
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_setter_static_augmentation_sameName_instanceSetter() async {
var library = await buildLibrary(r'''
class A {
set foo(int _) {}
}
augment class A {
augment static set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 isOriginGetterSetter foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@field::foo
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
setters
#F5 hasImplicitReturnType isComplete isOriginDeclaration foo (nameOffset:16) (firstTokenOffset:12) (offset:16)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F6 requiredPositional isOriginDeclaration _ (nameOffset:24) (firstTokenOffset:20) (offset:24)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
#F2 isAugmentation class A (nameOffset:46) (firstTokenOffset:32) (offset:46)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F7 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46)
element: <testLibrary>::@class::A::@field::foo#1
setters
#F8 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:71) (firstTokenOffset:52) (offset:71)
element: <testLibrary>::@class::A::@setter::foo#1
formalParameters
#F9 requiredPositional isOriginDeclaration _ (nameOffset:79) (firstTokenOffset:75) (offset:79)
element: <testLibrary>::@class::A::@setter::foo#1::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
setter: <testLibrary>::@class::A::@setter::foo
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo#1
firstFragment: #F7
type: int
setter: <testLibrary>::@class::A::@setter::foo#1
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional _
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo#1
firstFragment: #F8
formalParameters
#E1 requiredPositional _
firstFragment: #F9
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo#1
''');
}
test_setter_static_augmentation_sameName_staticField() async {
var library = await buildLibrary(r'''
class A {
static int foo = 0;
}
augment class A {
augment static set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
fields
#F3 hasInitializer isOriginDeclaration isStatic foo (nameOffset:23) (firstTokenOffset:23) (offset:23)
element: <testLibrary>::@class::A::@field::foo
inducedGetter: #F4
inducedSetter: #F5
constructors
#F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
getters
#F4 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@getter::foo
inducingVariable: #F3
setters
#F5 isComplete isOriginVariable isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo
inducingVariable: #F3
formalParameters
#F7 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
nextFragment: #F8
nextFragment: #F9
#F2 isAugmentation class A (nameOffset:48) (firstTokenOffset:34) (offset:48)
element: <testLibrary>::@class::A
previousFragment: #F1
setters
#F9 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:73) (firstTokenOffset:54) (offset:73)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F8 requiredPositional isOriginDeclaration _ (nameOffset:81) (firstTokenOffset:77) (offset:81)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::value
previousFragment: #F7
previousFragment: #F5
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
hasInitializer isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F3
type: int
getter: <testLibrary>::@class::A::@getter::foo
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F6
getters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@getter::foo
firstFragment: #F4
returnType: int
variable: <testLibrary>::@class::A::@field::foo
setters
isOriginVariable isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
''');
}
test_setter_static_augmentation_sameName_staticMethod() async {
var library = await buildLibrary(r'''
class A {
static void foo() {}
}
augment class A {
augment static set foo(int _) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::A
nextFragment: #F2
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::A::@constructor::new
typeName: A
methods
#F4 isComplete isOriginDeclaration isStatic foo (nameOffset:24) (firstTokenOffset:12) (offset:24)
element: <testLibrary>::@class::A::@method::foo
#F2 isAugmentation class A (nameOffset:49) (firstTokenOffset:35) (offset:49)
element: <testLibrary>::@class::A
previousFragment: #F1
fields
#F5 isOriginGetterSetter isStatic foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49)
element: <testLibrary>::@class::A::@field::foo
setters
#F6 hasImplicitReturnType isAugmentation isComplete isOriginDeclaration isStatic foo (nameOffset:74) (firstTokenOffset:55) (offset:74)
element: <testLibrary>::@class::A::@setter::foo
formalParameters
#F7 requiredPositional isOriginDeclaration _ (nameOffset:82) (firstTokenOffset:78) (offset:82)
element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_
classes
isSimplyBounded class A
reference: <testLibrary>::@class::A
firstFragment: #F1
fields
isOriginGetterSetter isStatic foo
reference: <testLibrary>::@class::A::@field::foo
firstFragment: #F5
type: int
setter: <testLibrary>::@class::A::@setter::foo
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::A::@constructor::new
firstFragment: #F3
setters
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@setter::foo
firstFragment: #F6
previousFragmentOfDifferentKind: #F4
formalParameters
#E0 requiredPositional _
firstFragment: #F7
type: int
returnType: void
variable: <testLibrary>::@class::A::@field::foo
methods
isOriginDeclaration isStatic foo
reference: <testLibrary>::@class::A::@method::foo
firstFragment: #F4
returnType: void
''');
}
test_setters() async {
var library = await buildLibrary(r'''
class C {
void set x(int value) {}
set y(value) {}
}
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
fields
#F2 isOriginGetterSetter x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::x
#F3 isOriginGetterSetter y (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@field::y
constructors
#F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
setters
#F5 isComplete isOriginDeclaration x (nameOffset:21) (firstTokenOffset:12) (offset:21)
element: <testLibrary>::@class::C::@setter::x
formalParameters
#F6 requiredPositional isOriginDeclaration value (nameOffset:27) (firstTokenOffset:23) (offset:27)
element: <testLibrary>::@class::C::@setter::x::@formalParameter::value
#F7 hasImplicitReturnType isComplete isOriginDeclaration y (nameOffset:43) (firstTokenOffset:39) (offset:43)
element: <testLibrary>::@class::C::@setter::y
formalParameters
#F8 requiredPositional hasImplicitType isOriginDeclaration value (nameOffset:45) (firstTokenOffset:45) (offset:45)
element: <testLibrary>::@class::C::@setter::y::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
fields
isOriginGetterSetter x
reference: <testLibrary>::@class::C::@field::x
firstFragment: #F2
type: int
setter: <testLibrary>::@class::C::@setter::x
isOriginGetterSetter y
reference: <testLibrary>::@class::C::@field::y
firstFragment: #F3
type: dynamic
setter: <testLibrary>::@class::C::@setter::y
constructors
isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F4
setters
isOriginDeclaration x
reference: <testLibrary>::@class::C::@setter::x
firstFragment: #F5
formalParameters
#E0 requiredPositional value
firstFragment: #F6
type: int
returnType: void
variable: <testLibrary>::@class::C::@field::x
isOriginDeclaration y
reference: <testLibrary>::@class::C::@setter::y
firstFragment: #F7
formalParameters
#E1 requiredPositional hasImplicitType value
firstFragment: #F8
type: dynamic
returnType: void
variable: <testLibrary>::@class::C::@field::y
''');
}
test_unused_typeParameter() async {
var library = await buildLibrary(r'''
class C<T> {
void f() {}
}
C<int> c;
var v = c.f;
''');
checkElementText(library, r'''
library
reference: <testLibrary>
fragments
#F0 <testLibraryFragment>
element: <testLibrary>
classes
#F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6)
element: <testLibrary>::@class::C
typeParameters
#F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8)
element: #E0 T
constructors
#F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6)
element: <testLibrary>::@class::C::@constructor::new
typeName: C
methods
#F4 isComplete isOriginDeclaration f (nameOffset:20) (firstTokenOffset:15) (offset:20)
element: <testLibrary>::@class::C::@method::f
topLevelVariables
#F5 isOriginDeclaration isStatic c (nameOffset:37) (firstTokenOffset:37) (offset:37)
element: <testLibrary>::@topLevelVariable::c
inducedGetter: #F6
inducedSetter: #F7
#F8 hasImplicitType hasInitializer isOriginDeclaration isStatic v (nameOffset:44) (firstTokenOffset:44) (offset:44)
element: <testLibrary>::@topLevelVariable::v
inducedGetter: #F9
inducedSetter: #F10
getters
#F6 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@getter::c
inducingVariable: #F5
#F9 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@getter::v
inducingVariable: #F8
setters
#F7 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@setter::c
inducingVariable: #F5
formalParameters
#F11 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:37)
element: <testLibrary>::@setter::c::@formalParameter::value
#F10 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@setter::v
inducingVariable: #F8
formalParameters
#F12 requiredPositional value (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44)
element: <testLibrary>::@setter::v::@formalParameter::value
classes
isSimplyBounded class C
reference: <testLibrary>::@class::C
firstFragment: #F1
typeParameters
#E0 T
firstFragment: #F2
constructors
hasEnclosingTypeParameterReference isOriginImplicitDefault new
reference: <testLibrary>::@class::C::@constructor::new
firstFragment: #F3
methods
isOriginDeclaration f
reference: <testLibrary>::@class::C::@method::f
firstFragment: #F4
returnType: void
topLevelVariables
isOriginDeclaration isStatic c
reference: <testLibrary>::@topLevelVariable::c
firstFragment: #F5
type: C<int>
getter: <testLibrary>::@getter::c
setter: <testLibrary>::@setter::c
hasImplicitType hasInitializer isOriginDeclaration isStatic isTypeInferredFromInitializer v
reference: <testLibrary>::@topLevelVariable::v
firstFragment: #F8
type: void Function()
getter: <testLibrary>::@getter::v
setter: <testLibrary>::@setter::v
getters
isOriginVariable isStatic c
reference: <testLibrary>::@getter::c
firstFragment: #F6
returnType: C<int>
variable: <testLibrary>::@topLevelVariable::c
isOriginVariable isStatic v
reference: <testLibrary>::@getter::v
firstFragment: #F9
returnType: void Function()
variable: <testLibrary>::@topLevelVariable::v
setters
isOriginVariable isStatic c
reference: <testLibrary>::@setter::c
firstFragment: #F7
formalParameters
#E1 requiredPositional value
firstFragment: #F11
type: C<int>
returnType: void
variable: <testLibrary>::@topLevelVariable::c
isOriginVariable isStatic v
reference: <testLibrary>::@setter::v
firstFragment: #F10
formalParameters
#E2 requiredPositional value
firstFragment: #F12
type: void Function()
returnType: void
variable: <testLibrary>::@topLevelVariable::v
''');
}
}
@reflectiveTest
class ClassElementTest_fromBytes extends ClassElementTest {
@override
bool get keepLinkingLibraries => false;
}
@reflectiveTest
class ClassElementTest_keepLinking extends ClassElementTest {
@override
bool get keepLinkingLibraries => true;
}