blob: f86f53bb092ed2803ae06f274b37c02fc187fc91 [file] [log] [blame]
// @dart = 2.8
import 'unsound_checks_lib.dart';
class OptOutClass1 {}
class OptOutClass2 {
int operator [](int index) => index;
void operator []=(int index, int value) {}
}
class OptOutClass3 {
OptOutClass3(this.field);
int field;
}
class OptOutClass4 extends OptOutSuperClass4 {
method(int i) => super[i] ??= 42;
methodForEffect(int i) {}
}
class OptOutClass5 {
OptOutClass5(this.field);
int field;
}
class OptOutSuperClass4 {
int operator [](int index) => index;
void operator []=(int index, int value) {}
}
expect(expected, actual) {}
extension OptOutExtension on OptOutClass1 {
int operator [](int index) => index;
void operator []=(int index, int value) {}
}
extensionIfNullOptOut1(int i) => OptOutExtension(new OptOutClass1())[i] ??= 42;
extensionIfNullOptOut1ForEffect(int i) {}
extensionIfNullOptOut2(int i) => new OptOutClass1()[i] ??= 42;
extensionIfNullOptOut2ForEffect(int i) {}
ifNullIndexSetOptOut(int i) => new OptOutClass2()[i] ??= 42;
ifNullIndexSetOptOutForEffect(int i) {}
ifNullOptOut(int i) => i ?? 42;
ifNullPropertySetOptOut(int i) => new OptOutClass3(i).field ??= 42;
ifNullPropertySetOptOutForEffect(int i) {}
ifNullSetOptOut(int i) => i ??= 42;
ifNullSetOptOutForEffect(int i) {}
ifNullSuperIndexSetOptOut(int i) => new OptOutClass4().method(i);
ifNullSuperIndexSetOptOutForEffect(int i) {}
isNotNullOptOut1(int i) => i != null;
isNotNullOptOut2(int i) => null != i;
isNotTestOptOut(int i) => i is! int;
isNullOptOut1(int i) => i == null;
isNullOptOut2(int i) => null == i;
isTestOptOut(int i) => i is int;
main() {}
nullAwareIfNullSetOptOut(int i) {}
nullAwareIfNullSetOptOutForEffect(int i) {}
throws(void f(), [bool Function(Object) testException]) {}