-
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.
Fix a bug in top-level type inference dependency tracking
When there was a top-level type inference dependency from a declared field to an overridden getter or setter, the dependency was not recorded in the field. This caused initializing formals to sometimes fail to infer the field type, because they did not see that it needed to be inferred. Fixes #32866 Change-Id: If75658d087c099787f74af5f5c6db2ee6837febe Reviewed-on: https://dart-review.googlesource.com/62800 Commit-Queue: Kevin Millikin <kmillikin@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
- Loading branch information
Kevin Millikin
authored and
commit-bot@chromium.org
committed
Jun 28, 2018
1 parent
29924c4
commit b0cbc4e
Showing
7 changed files
with
114 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
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,18 @@ | ||
// Copyright (c) 2018, 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. | ||
|
||
// Regression test that top-level inference correctly handles dependencies from | ||
// top-level field -> initializing formal -> field that overrides a getter. | ||
|
||
abstract class B { | ||
String get f; | ||
} | ||
|
||
class A implements B { | ||
final f; | ||
A(this.f); | ||
} | ||
|
||
var a = new A("foo"); | ||
main() => print(a); |
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,19 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class B extends core::Object { | ||
synthetic constructor •() → void | ||
: super core::Object::•() | ||
; | ||
abstract get f() → core::String; | ||
} | ||
class A extends core::Object implements self::B { | ||
final field dynamic f; | ||
constructor •(dynamic f) → void | ||
: self::A::f = f, super core::Object::•() | ||
; | ||
} | ||
static field dynamic a = new self::A::•("foo"); | ||
static method main() → dynamic | ||
return core::print(self::a); |
19 changes: 19 additions & 0 deletions
19
pkg/front_end/testcases/bug32866.dart.direct.transformed.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,19 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class B extends core::Object { | ||
synthetic constructor •() → void | ||
: super core::Object::•() | ||
; | ||
abstract get f() → core::String; | ||
} | ||
class A extends core::Object implements self::B { | ||
final field dynamic f; | ||
constructor •(dynamic f) → void | ||
: self::A::f = f, super core::Object::•() | ||
; | ||
} | ||
static field dynamic a = new self::A::•("foo"); | ||
static method main() → dynamic | ||
return core::print(self::a); |
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,17 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class B extends core::Object { | ||
synthetic constructor •() → void | ||
; | ||
abstract get f() → core::String; | ||
} | ||
class A extends core::Object implements self::B { | ||
final field dynamic f; | ||
constructor •(dynamic f) → void | ||
; | ||
} | ||
static field dynamic a; | ||
static method main() → dynamic | ||
; |
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,19 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class B extends core::Object { | ||
synthetic constructor •() → void | ||
: super core::Object::•() | ||
; | ||
abstract get f() → core::String; | ||
} | ||
class A extends core::Object implements self::B { | ||
final field core::String f; | ||
constructor •(core::String f) → void | ||
: self::A::f = f, super core::Object::•() | ||
; | ||
} | ||
static field self::A a = new self::A::•("foo"); | ||
static method main() → dynamic | ||
return core::print(self::a); |
19 changes: 19 additions & 0 deletions
19
pkg/front_end/testcases/bug32866.dart.strong.transformed.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,19 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class B extends core::Object { | ||
synthetic constructor •() → void | ||
: super core::Object::•() | ||
; | ||
abstract get f() → core::String; | ||
} | ||
class A extends core::Object implements self::B { | ||
final field core::String f; | ||
constructor •(core::String f) → void | ||
: self::A::f = f, super core::Object::•() | ||
; | ||
} | ||
static field self::A a = new self::A::•("foo"); | ||
static method main() → dynamic | ||
return core::print(self::a); |