mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
Verify that inference ignores setters with function-typed arguments.
R=sigmund@google.com Review-Url: https://codereview.chromium.org/2948693002 .
This commit is contained in:
parent
a4743540d0
commit
8bb13b8740
|
@ -249,6 +249,7 @@ inference/infer_prefix_expression: Crash
|
|||
inference/infer_prefix_expression_custom: Crash
|
||||
inference/infer_return_of_statement_lambda: Crash
|
||||
inference/infer_setter_from_later_inferred_setter: Crash
|
||||
inference/infer_setter_function_typed: Crash
|
||||
inference/infer_statics_transitively2: Crash
|
||||
inference/infer_statics_transitively3: Crash
|
||||
inference/infer_statics_transitively3_a: Crash
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
// 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;
|
||||
|
||||
// The `value` parameter for `B::x=` has a type, so it should not be inferred
|
||||
// based on `A::x=`.
|
||||
|
||||
typedef int F();
|
||||
|
||||
abstract class A {
|
||||
void set x(F value);
|
||||
}
|
||||
|
||||
abstract class B extends A {
|
||||
void set x(value());
|
||||
}
|
||||
|
||||
T f<T>() => null;
|
||||
|
||||
g(B b) {
|
||||
b. /*@target=B::x*/ x = /*@typeArgs=() -> dynamic*/ f();
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,23 @@
|
|||
library test;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F = () → core::int;
|
||||
abstract class A extends core::Object {
|
||||
constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract set x(() → core::int value) → void;
|
||||
}
|
||||
abstract class B extends self::A {
|
||||
constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract set x(() → dynamic value) → void;
|
||||
}
|
||||
static method f<T extends core::Object>() → self::f::T
|
||||
return null;
|
||||
static method g(self::B b) → dynamic {
|
||||
b.x = self::f<dynamic>();
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,21 @@
|
|||
library test;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F = () → core::int;
|
||||
abstract class A extends core::Object {
|
||||
constructor •() → void
|
||||
;
|
||||
abstract set x(() → core::int value) → void;
|
||||
}
|
||||
abstract class B extends self::A {
|
||||
constructor •() → void
|
||||
;
|
||||
abstract set x(() → dynamic value) → void;
|
||||
}
|
||||
static method f<T extends core::Object>() → self::f::T
|
||||
;
|
||||
static method g(self::B b) → dynamic
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,23 @@
|
|||
library test;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F = () → core::int;
|
||||
abstract class A extends core::Object {
|
||||
constructor •() → void
|
||||
: super core::Object::•()
|
||||
;
|
||||
abstract set x(() → core::int value) → void;
|
||||
}
|
||||
abstract class B extends self::A {
|
||||
constructor •() → void
|
||||
: super self::A::•()
|
||||
;
|
||||
abstract set x(() → dynamic value) → void;
|
||||
}
|
||||
static method f<T extends core::Object>() → self::f::T
|
||||
return null;
|
||||
static method g(self::B b) → dynamic {
|
||||
b.{self::B::x} = self::f<() → dynamic>();
|
||||
}
|
||||
static method main() → dynamic {}
|
Loading…
Reference in a new issue