Test type inference for field initializers using "this." syntax.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2986403002 .
This commit is contained in:
Paul Berry 2017-08-03 14:32:01 -07:00
parent 57d71479e1
commit 867d682ff5
5 changed files with 55 additions and 0 deletions

View file

@ -93,6 +93,7 @@ inference/downwards_inference_on_map_literals: Crash
inference/downwards_inference_yield_yield_star: Fail
inference/field_initializer_context_explicit: Crash
inference/field_initializer_context_implicit: Crash
inference/field_initializer_context_this: Crash
inference/field_initializer_parameter: Crash
inference/field_refers_to_static_getter: Crash
inference/field_refers_to_top_level_getter: Crash

View file

@ -0,0 +1,15 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/*@testedFeatures=inference*/
library test;
T f<T>() => null;
class C {
final int x;
C() : this.x = /*@typeArgs=int*/ f();
}
main() {}

View file

@ -0,0 +1,13 @@
library test;
import self as self;
import "dart:core" as core;
class C extends core::Object {
final field core::int x;
constructor •() → void
: self::C::x = self::f<dynamic>(), super core::Object::•()
;
}
static method f<T extends core::Object>() → self::f::T
return null;
static method main() → dynamic {}

View file

@ -0,0 +1,13 @@
library test;
import self as self;
import "dart:core" as core;
class C extends core::Object {
final field core::int x;
constructor •() → void
;
}
static method f<T extends core::Object>() → self::f::T
;
static method main() → dynamic
;

View file

@ -0,0 +1,13 @@
library test;
import self as self;
import "dart:core" as core;
class C extends core::Object {
final field core::int x;
constructor •() → void
: self::C::x = self::f<core::int>(), super core::Object::•()
;
}
static method f<T extends core::Object>() → self::f::T
return null;
static method main() → dynamic {}