Skip to content

Commit bb45179

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Remove tests already moved to ImplicitThisReferenceInInitializerTest.
R=brianwilkerson@google.com Change-Id: Ibaf67be1bea844e10e599aad8b4ebc450e54cac2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123682 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent a003763 commit bb45179

File tree

2 files changed

+39
-112
lines changed

2 files changed

+39
-112
lines changed

pkg/analyzer/test/generated/compile_time_error_code.dart

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,79 +1933,6 @@ class B = A with M implements A;
19331933
]);
19341934
}
19351935

1936-
test_implicitThisReferenceInInitializer_field() async {
1937-
await assertErrorsInCode(r'''
1938-
class A {
1939-
var v;
1940-
A() : v = f;
1941-
var f;
1942-
}
1943-
''', [
1944-
error(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 31, 1),
1945-
]);
1946-
}
1947-
1948-
test_implicitThisReferenceInInitializer_field2() async {
1949-
await assertErrorsInCode(r'''
1950-
class A {
1951-
final x = 0;
1952-
final y = x;
1953-
}
1954-
''', [
1955-
error(StrongModeCode.TOP_LEVEL_INSTANCE_GETTER, 37, 1),
1956-
error(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 37, 1),
1957-
]);
1958-
}
1959-
1960-
test_implicitThisReferenceInInitializer_invocation() async {
1961-
await assertErrorsInCode(r'''
1962-
class A {
1963-
var v;
1964-
A() : v = f();
1965-
f() {}
1966-
}
1967-
''', [
1968-
error(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 31, 1),
1969-
]);
1970-
}
1971-
1972-
test_implicitThisReferenceInInitializer_invocationInStatic() async {
1973-
await assertErrorsInCode(r'''
1974-
class A {
1975-
static var F = m();
1976-
int m() => 0;
1977-
}
1978-
''', [
1979-
error(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 27, 1),
1980-
]);
1981-
}
1982-
1983-
test_implicitThisReferenceInInitializer_redirectingConstructorInvocation() async {
1984-
await assertErrorsInCode(r'''
1985-
class A {
1986-
A(p) {}
1987-
A.named() : this(f);
1988-
var f;
1989-
}
1990-
''', [
1991-
error(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 39, 1),
1992-
]);
1993-
}
1994-
1995-
test_implicitThisReferenceInInitializer_superConstructorInvocation() async {
1996-
await assertErrorsInCode(r'''
1997-
class A {
1998-
A(p) {}
1999-
}
2000-
class B extends A {
2001-
B() : super(f);
2002-
var f;
2003-
}
2004-
''', [
2005-
error(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 56, 1),
2006-
]);
2007-
}
2008-
20091936
test_importInternalLibrary() async {
20101937
// Note, in these error cases we may generate an UNUSED_IMPORT hint, while
20111938
// we could prevent the hint from being generated by testing the import

pkg/analyzer/test/src/diagnostics/implicit_this_reference_in_initializer_test.dart

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ main() {
1515

1616
@reflectiveTest
1717
class ImplicitThisReferenceInInitializerTest extends DriverResolutionTest {
18-
test_implicitThisReferenceInInitializer_constructorName() async {
18+
test_constructorName() async {
1919
await assertNoErrorsInCode(r'''
2020
class A {
2121
A.named() {}
@@ -27,7 +27,7 @@ class B {
2727
''');
2828
}
2929

30-
test_implicitThisReferenceInInitializer_field() async {
30+
test_field() async {
3131
await assertErrorsInCode(r'''
3232
class A {
3333
var v;
@@ -39,7 +39,7 @@ class A {
3939
]);
4040
}
4141

42-
test_implicitThisReferenceInInitializer_field2() async {
42+
test_field2() async {
4343
await assertErrorsInCode(r'''
4444
class A {
4545
final x = 0;
@@ -51,7 +51,7 @@ class A {
5151
]);
5252
}
5353

54-
test_implicitThisReferenceInInitializer_invocation() async {
54+
test_invocation() async {
5555
await assertErrorsInCode(r'''
5656
class A {
5757
var v;
@@ -63,7 +63,7 @@ class A {
6363
]);
6464
}
6565

66-
test_implicitThisReferenceInInitializer_invocationInStatic() async {
66+
test_invocationInStatic() async {
6767
await assertErrorsInCode(r'''
6868
class A {
6969
static var F = m();
@@ -74,7 +74,29 @@ class A {
7474
]);
7575
}
7676

77-
test_implicitThisReferenceInInitializer_prefixedIdentifier() async {
77+
test_isInInstanceVariableInitializer_restored() async {
78+
// If ErrorVerifier._isInInstanceVariableInitializer is not properly
79+
// restored on exit from visitVariableDeclaration, the error at (1)
80+
// won't be detected.
81+
await assertErrorsInCode(r'''
82+
class Foo {
83+
var bar;
84+
Map foo = {
85+
'bar': () {
86+
var _bar;
87+
},
88+
'bop': _foo // (1)
89+
};
90+
_foo() {
91+
}
92+
}
93+
''', [
94+
error(HintCode.UNUSED_LOCAL_VARIABLE, 65, 4),
95+
error(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 89, 4),
96+
]);
97+
}
98+
99+
test_prefixedIdentifier() async {
78100
await assertNoErrorsInCode(r'''
79101
class A {
80102
var f;
@@ -86,7 +108,7 @@ class B {
86108
''');
87109
}
88110

89-
test_implicitThisReferenceInInitializer_qualifiedMethodInvocation() async {
111+
test_qualifiedMethodInvocation() async {
90112
await assertNoErrorsInCode(r'''
91113
class A {
92114
f() {}
@@ -98,7 +120,7 @@ class B {
98120
''');
99121
}
100122

101-
test_implicitThisReferenceInInitializer_qualifiedPropertyAccess() async {
123+
test_qualifiedPropertyAccess() async {
102124
await assertNoErrorsInCode(r'''
103125
class A {
104126
var f;
@@ -110,7 +132,7 @@ class B {
110132
''');
111133
}
112134

113-
test_implicitThisReferenceInInitializer_redirectingConstructorInvocation() async {
135+
test_redirectingConstructorInvocation() async {
114136
await assertErrorsInCode(r'''
115137
class A {
116138
A(p) {}
@@ -122,7 +144,7 @@ class A {
122144
]);
123145
}
124146

125-
test_implicitThisReferenceInInitializer_staticField_thisClass() async {
147+
test_staticField_thisClass() async {
126148
await assertNoErrorsInCode(r'''
127149
class A {
128150
var v;
@@ -132,7 +154,7 @@ class A {
132154
''');
133155
}
134156

135-
test_implicitThisReferenceInInitializer_staticGetter() async {
157+
test_staticGetter() async {
136158
await assertNoErrorsInCode(r'''
137159
class A {
138160
var v;
@@ -142,7 +164,7 @@ class A {
142164
''');
143165
}
144166

145-
test_implicitThisReferenceInInitializer_staticMethod() async {
167+
test_staticMethod() async {
146168
await assertNoErrorsInCode(r'''
147169
class A {
148170
var v;
@@ -152,7 +174,7 @@ class A {
152174
''');
153175
}
154176

155-
test_implicitThisReferenceInInitializer_superConstructorInvocation() async {
177+
test_superConstructorInvocation() async {
156178
await assertErrorsInCode(r'''
157179
class A {
158180
A(p) {}
@@ -166,7 +188,7 @@ class B extends A {
166188
]);
167189
}
168190

169-
test_implicitThisReferenceInInitializer_topLevelField() async {
191+
test_topLevelField() async {
170192
await assertNoErrorsInCode(r'''
171193
class A {
172194
var v;
@@ -176,7 +198,7 @@ var f = 42;
176198
''');
177199
}
178200

179-
test_implicitThisReferenceInInitializer_topLevelFunction() async {
201+
test_topLevelFunction() async {
180202
await assertNoErrorsInCode(r'''
181203
class A {
182204
var v;
@@ -186,7 +208,7 @@ f() => 42;
186208
''');
187209
}
188210

189-
test_implicitThisReferenceInInitializer_topLevelGetter() async {
211+
test_topLevelGetter() async {
190212
await assertNoErrorsInCode(r'''
191213
class A {
192214
var v;
@@ -196,34 +218,12 @@ get f => 42;
196218
''');
197219
}
198220

199-
test_implicitThisReferenceInInitializer_typeParameter() async {
221+
test_typeParameter() async {
200222
await assertNoErrorsInCode(r'''
201223
class A<T> {
202224
var v;
203225
A(p) : v = (p is T);
204226
}
205227
''');
206228
}
207-
208-
test_isInInstanceVariableInitializer_restored() async {
209-
// If ErrorVerifier._isInInstanceVariableInitializer is not properly
210-
// restored on exit from visitVariableDeclaration, the error at (1)
211-
// won't be detected.
212-
await assertErrorsInCode(r'''
213-
class Foo {
214-
var bar;
215-
Map foo = {
216-
'bar': () {
217-
var _bar;
218-
},
219-
'bop': _foo // (1)
220-
};
221-
_foo() {
222-
}
223-
}
224-
''', [
225-
error(HintCode.UNUSED_LOCAL_VARIABLE, 65, 4),
226-
error(CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, 89, 4),
227-
]);
228-
}
229229
}

0 commit comments

Comments
 (0)