Skip to content

Commit

Permalink
Verify that inference ignores setters with function-typed arguments.
Browse files Browse the repository at this point in the history
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2948693002 .
  • Loading branch information
stereotype441 committed Jun 19, 2017
1 parent a474354 commit 8bb13b8
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/front_end/test/fasta/kompile.status
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions pkg/front_end/testcases/inference/infer_setter_function_typed.dart
Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
@@ -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 {}
Original file line number Diff line number Diff line change
@@ -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
;
Original file line number Diff line number Diff line change
@@ -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 {}

0 comments on commit 8bb13b8

Please sign in to comment.