-
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] Use effective target in redirecting factory tear off lowering
The tear-off lowering for a redirecting factory called the immediate target (even when this was also a redirecting factory) instead of the effective target. This caused problem in backends that don't support redirecting factories directly. Closes #47916 Change-Id: Iafb11c42c1e99e70ed44b0835473a8c69e995b01 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235780 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
- Loading branch information
1 parent
e1718d5
commit 5090974
Showing
61 changed files
with
1,966 additions
and
15 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
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
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
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 @@ | ||
// Copyright (c) 2022, 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. | ||
|
||
abstract class A { | ||
const factory A() = B; | ||
} | ||
|
||
abstract class B implements A { | ||
const factory B() = C; | ||
} | ||
|
||
class C implements B { | ||
const C(); | ||
} | ||
|
||
main() { | ||
A.new; | ||
} |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/dart2js/issue47916.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,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
static final field dynamic _redirecting# = <dynamic>[#C1]/*isLegacy*/; | ||
static factory •() → self::A | ||
return self::B::•(); | ||
static method _#new#tearOff() → self::A | ||
return new self::C::•(); | ||
} | ||
abstract class B extends core::Object implements self::A { | ||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/; | ||
static factory •() → self::B | ||
return new self::C::•(); | ||
static method _#new#tearOff() → self::B | ||
return new self::C::•(); | ||
} | ||
class C extends core::Object implements self::B /*hasConstConstructor*/ { | ||
const constructor •() → self::C | ||
: super core::Object::•() | ||
; | ||
static method _#new#tearOff() → self::C | ||
return new self::C::•(); | ||
} | ||
static method main() → dynamic { | ||
#C3; | ||
} | ||
|
||
constants { | ||
#C1 = constructor-tearoff self::A::• | ||
#C2 = constructor-tearoff self::B::• | ||
#C3 = static-tearoff self::A::_#new#tearOff | ||
} |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/dart2js/issue47916.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,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
static final field dynamic _redirecting# = <dynamic>[#C1]/*isLegacy*/; | ||
static factory •() → self::A | ||
return self::B::•(); | ||
static method _#new#tearOff() → self::A | ||
return new self::C::•(); | ||
} | ||
abstract class B extends core::Object implements self::A { | ||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/; | ||
static factory •() → self::B | ||
return new self::C::•(); | ||
static method _#new#tearOff() → self::B | ||
return new self::C::•(); | ||
} | ||
class C extends core::Object implements self::B /*hasConstConstructor*/ { | ||
const constructor •() → self::C | ||
: super core::Object::•() | ||
; | ||
static method _#new#tearOff() → self::C | ||
return new self::C::•(); | ||
} | ||
static method main() → dynamic { | ||
#C3; | ||
} | ||
|
||
constants { | ||
#C1 = constructor-tearoff self::A::• | ||
#C2 = constructor-tearoff self::B::• | ||
#C3 = static-tearoff self::A::_#new#tearOff | ||
} |
13 changes: 13 additions & 0 deletions
13
pkg/front_end/testcases/dart2js/issue47916.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,13 @@ | ||
abstract class A { | ||
const factory A() = B; | ||
} | ||
|
||
abstract class B implements A { | ||
const factory B() = C; | ||
} | ||
|
||
class C implements B { | ||
const C(); | ||
} | ||
|
||
main() {} |
13 changes: 13 additions & 0 deletions
13
pkg/front_end/testcases/dart2js/issue47916.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,13 @@ | ||
abstract class A { | ||
const factory A() = B; | ||
} | ||
|
||
abstract class B implements A { | ||
const factory B() = C; | ||
} | ||
|
||
class C implements B { | ||
const C(); | ||
} | ||
|
||
main() {} |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/dart2js/issue47916.dart.weak.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,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
static final field dynamic _redirecting# = <dynamic>[#C1]/*isLegacy*/; | ||
static factory •() → self::A | ||
return self::B::•(); | ||
static method _#new#tearOff() → self::A | ||
return new self::C::•(); | ||
} | ||
abstract class B extends core::Object implements self::A { | ||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/; | ||
static factory •() → self::B | ||
return new self::C::•(); | ||
static method _#new#tearOff() → self::B | ||
return new self::C::•(); | ||
} | ||
class C extends core::Object implements self::B /*hasConstConstructor*/ { | ||
const constructor •() → self::C | ||
: super core::Object::•() | ||
; | ||
static method _#new#tearOff() → self::C | ||
return new self::C::•(); | ||
} | ||
static method main() → dynamic { | ||
#C3; | ||
} | ||
|
||
constants { | ||
#C1 = constructor-tearoff self::A::• | ||
#C2 = constructor-tearoff self::B::• | ||
#C3 = static-tearoff self::A::_#new#tearOff | ||
} |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/dart2js/issue47916.dart.weak.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,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
static final field dynamic _redirecting# = <dynamic>[#C1]/*isLegacy*/; | ||
static factory •() → self::A | ||
return self::B::•(); | ||
static method _#new#tearOff() → self::A | ||
return new self::C::•(); | ||
} | ||
abstract class B extends core::Object implements self::A { | ||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/; | ||
static factory •() → self::B | ||
return new self::C::•(); | ||
static method _#new#tearOff() → self::B | ||
return new self::C::•(); | ||
} | ||
class C extends core::Object implements self::B /*hasConstConstructor*/ { | ||
const constructor •() → self::C | ||
: super core::Object::•() | ||
; | ||
static method _#new#tearOff() → self::C | ||
return new self::C::•(); | ||
} | ||
static method main() → dynamic { | ||
#C3; | ||
} | ||
|
||
constants { | ||
#C1 = constructor-tearoff self::A::• | ||
#C2 = constructor-tearoff self::B::• | ||
#C3 = static-tearoff self::A::_#new#tearOff | ||
} |
33 changes: 33 additions & 0 deletions
33
pkg/front_end/testcases/dart2js/issue47916.dart.weak.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,33 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
static final field dynamic _redirecting# = <dynamic>[self::A::•]/*isLegacy*/; | ||
static factory •() → self::A | ||
return self::B::•(); | ||
static method _#new#tearOff() → self::A | ||
return new self::C::•(); | ||
} | ||
abstract class B extends core::Object implements self::A { | ||
static final field dynamic _redirecting# = <dynamic>[self::B::•]/*isLegacy*/; | ||
static factory •() → self::B | ||
return new self::C::•(); | ||
static method _#new#tearOff() → self::B | ||
return new self::C::•(); | ||
} | ||
class C extends core::Object implements self::B /*hasConstConstructor*/ { | ||
const constructor •() → self::C | ||
: super core::Object::•() | ||
; | ||
static method _#new#tearOff() → self::C | ||
return new self::C::•(); | ||
} | ||
static method main() → dynamic | ||
; | ||
|
||
|
||
Extra constant evaluation status: | ||
Evaluated: ConstructorTearOff @ org-dartlang-testcase:///issue47916.dart:5:16 -> ConstructorTearOffConstant(A.) | ||
Evaluated: ConstructorTearOff @ org-dartlang-testcase:///issue47916.dart:9:16 -> ConstructorTearOffConstant(B.) | ||
Extra constant evaluation: evaluated: 9, effectively constant: 2 |
34 changes: 34 additions & 0 deletions
34
pkg/front_end/testcases/dart2js/issue47916.dart.weak.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,34 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:core" as core; | ||
|
||
abstract class A extends core::Object { | ||
static final field dynamic _redirecting# = <dynamic>[#C1]/*isLegacy*/; | ||
static factory •() → self::A | ||
return self::B::•(); | ||
static method _#new#tearOff() → self::A | ||
return new self::C::•(); | ||
} | ||
abstract class B extends core::Object implements self::A { | ||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/; | ||
static factory •() → self::B | ||
return new self::C::•(); | ||
static method _#new#tearOff() → self::B | ||
return new self::C::•(); | ||
} | ||
class C extends core::Object implements self::B /*hasConstConstructor*/ { | ||
const constructor •() → self::C | ||
: super core::Object::•() | ||
; | ||
static method _#new#tearOff() → self::C | ||
return new self::C::•(); | ||
} | ||
static method main() → dynamic { | ||
#C3; | ||
} | ||
|
||
constants { | ||
#C1 = constructor-tearoff self::A::• | ||
#C2 = constructor-tearoff self::B::• | ||
#C3 = static-tearoff self::A::_#new#tearOff | ||
} |
Oops, something went wrong.