blob: 13961a5b5a301cce3d3d4479dd2478fa9471ede9 [file] [log] [blame]
class A {
int zero;
int? zeroOrNull;
A(this.zero, [this.zeroOrNull]);
}
int? test1(A? a) => a?.zero!;
int? test2(A? a) => a?.zeroOrNull!;
bool? test3(A? a) => a?.zero!.isEven;
bool? test4(A? a) => a?.zeroOrNull!.isEven;
class Foo {
Bar? bar;
Foo(this.bar);
Bar? operator [](int? index) => index != null ? new Bar(index) : null;
}
class Bar {
int baz;
Bar(this.baz);
int operator [](int index) => index;
bool operator ==(Object other) => other is Bar && baz == other.baz;
}
Bar? test5(Foo? foo) => foo?.bar!;
int? test6(Foo? foo) => foo?.bar!.baz;
int? test7(Foo? foo, int baz) => foo?.bar![baz];
Bar? test8(Foo? foo, int? bar) => foo?[bar]!;
int? test9(Foo? foo, int? bar) => foo?[bar]!.baz;
test10(Foo? foo, int? bar, int baz) => foo?[bar]![baz];
main() {}
expect(expected, actual) {}
throws(void Function() f) {}