Skip to content

Commit 7368e2c

Browse files
kallentuCommit Queue
authored andcommitted
[tests] Dot shorthands: == and parenthesized expression tests.
A few extra tests for parenthesized dot shorthands on the RHS of an == or !=. Bug: #57038 Change-Id: I2400247ea7017feff676090c5131822e0b17d5e5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424680 Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Kallen Tu <[email protected]>
1 parent 55bacbf commit 7368e2c

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

tests/language/dot_shorthands/equality/equality_ctor_error_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,20 @@ void rhsNeedsToBeShorthand(
209209
// [analyzer] unspecified
210210
// [cfe] No type was provided to find the dot shorthand 'constRegular'.
211211

212+
if (ctor == (.new(1))) {
213+
// ^^^
214+
// [analyzer] unspecified
215+
// [cfe] No type was provided to find the dot shorthand 'new'.
216+
print('not ok');
217+
}
218+
219+
if (ctor != (.new(1))) {
220+
// ^^^
221+
// [analyzer] unspecified
222+
// [cfe] No type was provided to find the dot shorthand 'new'.
223+
print('not ok');
224+
}
225+
212226
if (ctor == (condition ? .new(1) : .regular(1))) {
213227
// ^^^
214228
// [analyzer] unspecified

tests/language/dot_shorthands/equality/equality_error_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ void rhsNeedsToBeShorthand(Color color, Integer integer, IntegerExt integerExt,
151151
// [analyzer] unspecified
152152
// [cfe] unspecified
153153

154+
if (color == (.red)) print('not ok');
155+
// ^
156+
// [analyzer] unspecified
157+
// [cfe] unspecified
158+
159+
if (color != (.red)) print('not ok');
160+
// ^
161+
// [analyzer] unspecified
162+
// [cfe] unspecified
163+
154164
if (color == (condition ? .red : .green)) print('not ok');
155165
// ^
156166
// [analyzer] unspecified

tests/language/dot_shorthands/equality/equality_member_error_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ void rhsNeedsToBeShorthand(
9696
StaticMemberExt memberExt,
9797
bool condition,
9898
) {
99+
if (member == (.member())) {
100+
// ^^^^^^
101+
// [analyzer] unspecified
102+
// [cfe] No type was provided to find the dot shorthand 'member'.
103+
print('not ok');
104+
}
105+
106+
if (member != (.member())) {
107+
// ^^^^^^
108+
// [analyzer] unspecified
109+
// [cfe] No type was provided to find the dot shorthand 'member'.
110+
print('not ok');
111+
}
112+
99113
if (member == (condition ? .member() : .memberType<String, int>('s'))) {
100114
// ^^^^^^
101115
// [analyzer] unspecified

tests/language/dot_shorthands/equality/equality_selector_chain_error_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,20 @@ void rhsNeedsToBeShorthand(
178178
ConstructorWithNonFinal ctor,
179179
bool condition,
180180
) {
181+
if (member == (.member().field)) {
182+
// ^^^^^^
183+
// [analyzer] unspecified
184+
// [cfe] No type was provided to find the dot shorthand 'member'.
185+
print('not ok');
186+
}
187+
188+
if (member == (.member().method())) {
189+
// ^^^^^^
190+
// [analyzer] unspecified
191+
// [cfe] No type was provided to find the dot shorthand 'member'.
192+
print('not ok');
193+
}
194+
181195
if (member == (condition ? StaticMember.member() : .member().field)) {
182196
// ^^^^^^
183197
// [analyzer] unspecified

0 commit comments

Comments
 (0)