-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify that inference ignores setters with function-typed arguments.
R=sigmund@google.com Review-Url: https://codereview.chromium.org/2948693002 .
- Loading branch information
1 parent
a474354
commit 8bb13b8
Showing
5 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
pkg/front_end/testcases/inference/infer_setter_function_typed.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
23 changes: 23 additions & 0 deletions
23
pkg/front_end/testcases/inference/infer_setter_function_typed.dart.direct.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |
21 changes: 21 additions & 0 deletions
21
pkg/front_end/testcases/inference/infer_setter_function_typed.dart.outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
; |
23 changes: 23 additions & 0 deletions
23
pkg/front_end/testcases/inference/infer_setter_function_typed.dart.strong.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |