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