-
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.
[cfe] Provide inferred type context to initializing formals
In response to flutter/flutter#160551 Change-Id: I0e4123c76f8d82a6900e12452f0deef2cbb05d36 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404822 Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Chloe Stefantsova <[email protected]>
- Loading branch information
1 parent
d2ce8e7
commit 39d2653
Showing
9 changed files
with
156 additions
and
16 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 |
---|---|---|
|
@@ -510,6 +510,7 @@ coerced | |
coerces | ||
coercing | ||
coercion | ||
coercions | ||
coincides | ||
coinductively | ||
collapses | ||
|
18 changes: 18 additions & 0 deletions
18
pkg/front_end/testcases/inference/flutter_issue160551.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,18 @@ | ||
// Copyright (c) 2025, 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. | ||
|
||
void main() { | ||
print(B().foo); | ||
} | ||
|
||
abstract class A { | ||
A(); | ||
|
||
factory A.redir({double foo}) = B; | ||
} | ||
|
||
class B<T> extends A { | ||
B({this.foo = 10}); | ||
final double foo; | ||
} |
24 changes: 24 additions & 0 deletions
24
pkg/front_end/testcases/inference/flutter_issue160551.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,24 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
constructor •() → self::A | ||
: super core::Object::•() | ||
; | ||
static factory redir({core::double foo = #C1}) → self::A /* redirection-target: self::B::•<dynamic>*/ | ||
return new self::B::•<dynamic>(foo: foo); | ||
} | ||
class B<T extends core::Object? = dynamic> extends self::A { | ||
final field core::double foo; | ||
constructor •({core::double foo = #C1}) → self::B<self::B::T%> | ||
: self::B::foo = foo, super self::A::•() | ||
; | ||
} | ||
static method main() → void { | ||
core::print(new self::B::•<dynamic>().{self::B::foo}{core::double}); | ||
} | ||
|
||
constants { | ||
#C1 = 10.0 | ||
} |
24 changes: 24 additions & 0 deletions
24
pkg/front_end/testcases/inference/flutter_issue160551.dart.strong.modular.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,24 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
constructor •() → self::A | ||
: super core::Object::•() | ||
; | ||
static factory redir({core::double foo = #C1}) → self::A /* redirection-target: self::B::•<dynamic>*/ | ||
return new self::B::•<dynamic>(foo: foo); | ||
} | ||
class B<T extends core::Object? = dynamic> extends self::A { | ||
final field core::double foo; | ||
constructor •({core::double foo = #C1}) → self::B<self::B::T%> | ||
: self::B::foo = foo, super self::A::•() | ||
; | ||
} | ||
static method main() → void { | ||
core::print(new self::B::•<dynamic>().{self::B::foo}{core::double}); | ||
} | ||
|
||
constants { | ||
#C1 = 10.0 | ||
} |
17 changes: 17 additions & 0 deletions
17
pkg/front_end/testcases/inference/flutter_issue160551.dart.strong.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,17 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
constructor •() → self::A | ||
; | ||
static factory redir({core::double foo = null}) → self::A /* redirection-target: self::B::•<dynamic>*/ | ||
return new self::B::•<dynamic>(foo: foo); | ||
} | ||
class B<T extends core::Object? = dynamic> extends self::A { | ||
final field core::double foo; | ||
constructor •({core::double foo = 10.0}) → self::B<self::B::T%> | ||
; | ||
} | ||
static method main() → void | ||
; |
24 changes: 24 additions & 0 deletions
24
pkg/front_end/testcases/inference/flutter_issue160551.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,24 @@ | ||
library; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
constructor •() → self::A | ||
: super core::Object::•() | ||
; | ||
static factory redir({core::double foo = #C1}) → self::A /* redirection-target: self::B::•<dynamic>*/ | ||
return new self::B::•<dynamic>(foo: foo); | ||
} | ||
class B<T extends core::Object? = dynamic> extends self::A { | ||
final field core::double foo; | ||
constructor •({core::double foo = #C1}) → self::B<self::B::T%> | ||
: self::B::foo = foo, super self::A::•() | ||
; | ||
} | ||
static method main() → void { | ||
core::print(new self::B::•<dynamic>().{self::B::foo}{core::double}); | ||
} | ||
|
||
constants { | ||
#C1 = 10.0 | ||
} |
11 changes: 11 additions & 0 deletions
11
pkg/front_end/testcases/inference/flutter_issue160551.dart.textual_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,11 @@ | ||
void main() {} | ||
|
||
abstract class A { | ||
A(); | ||
factory A.redir({double foo}) = B; | ||
} | ||
|
||
class B<T> extends A { | ||
B({this.foo = 10}); | ||
final double foo; | ||
} |
11 changes: 11 additions & 0 deletions
11
pkg/front_end/testcases/inference/flutter_issue160551.dart.textual_outline_modelled.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,11 @@ | ||
abstract class A { | ||
A(); | ||
factory A.redir({double foo}) = B; | ||
} | ||
|
||
class B<T> extends A { | ||
B({this.foo = 10}); | ||
final double foo; | ||
} | ||
|
||
void main() {} |