mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:12:08 +00:00
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:
parent
57d71479e1
commit
867d682ff5
|
@ -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
|
||||
|
|
|
@ -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() {}
|
|
@ -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 {}
|
|
@ -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
|
||||
;
|
|
@ -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 {}
|
Loading…
Reference in a new issue