mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
Add tests of null-aware constructs in void contexts.
Fasta desugares some expressions differently in void contexts, so to be on the safe side, we should test that null-aware invocations and property accesses work in both void and non-void contexts. R=sigmund@google.com Review-Url: https://codereview.chromium.org/2948843002 .
This commit is contained in:
parent
5dd84a802e
commit
e981c6fdbc
6 changed files with 6 additions and 0 deletions
|
@ -11,6 +11,7 @@ class C {
|
|||
|
||||
g(C c) {
|
||||
var /*@type=int*/ x = c?. /*@target=C::f*/ f();
|
||||
c?. /*@target=C::f*/ f();
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
|
|
@ -11,5 +11,6 @@ class C extends core::Object {
|
|||
}
|
||||
static method g(self::C c) → dynamic {
|
||||
dynamic x = let final dynamic #t1 = c in #t1.==(null) ? null : #t1.f();
|
||||
let final dynamic #t2 = c in #t2.==(null) ? null : #t2.f();
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -11,5 +11,6 @@ class C extends core::Object {
|
|||
}
|
||||
static method g(self::C c) → dynamic {
|
||||
core::int x = let final self::C #t1 = c in #t1.==(null) ?{core::int} null : #t1.{self::C::f}();
|
||||
let final self::C #t2 = c in #t2.==(null) ?{core::int} null : #t2.{self::C::f}();
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -11,6 +11,7 @@ class C {
|
|||
|
||||
void f(C c) {
|
||||
var /*@type=int*/ x = c?. /*@target=C::x*/ x;
|
||||
c?. /*@target=C::x*/ x;
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
|
|
@ -10,5 +10,6 @@ class C extends core::Object {
|
|||
}
|
||||
static method f(self::C c) → void {
|
||||
dynamic x = let final dynamic #t1 = c in #t1.==(null) ? null : #t1.x;
|
||||
let final dynamic #t2 = c in #t2.==(null) ? null : #t2.x;
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -10,5 +10,6 @@ class C extends core::Object {
|
|||
}
|
||||
static method f(self::C c) → void {
|
||||
core::int x = let final self::C #t1 = c in #t1.==(null) ?{core::int} null : #t1.{self::C::x};
|
||||
let final self::C #t2 = c in #t2.==(null) ?{core::int} null : #t2.{self::C::x};
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
|
Loading…
Reference in a new issue