[cfe] Add test for issue 53740

Closes #53740

Change-Id: I14edfcd610366bd0f759030e1eb0dd057fbbaeae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335443
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Johnni Winther
2023-11-10 13:40:19 +00:00
committed by Commit Queue
parent 57724af73a
commit cd58ce5030
9 changed files with 323 additions and 0 deletions
@@ -0,0 +1,21 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by b
// BSD-style license that can be found in the LICENSE file.
class A {
void foo() {}
}
class B implements A {
@override
void foo([int i = 0]) {}
}
extension type ET1(B b) implements A {}
extension type ET2(B b) implements ET1, B {}
void main() {
var et2 = ET2(B());
et2.foo(42);
}
@@ -0,0 +1,48 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
method foo() → void {}
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B
: super core::Object::•()
;
@#C1
method foo([core::int i = #C2]) → void {}
}
extension type ET1(self::B b) implements self::A {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
extension type ET2(self::B b) implements self::ET1 /* = self::B */, self::B {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET2|constructor#;
constructor tearoff • = self::ET2|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::B b) → self::ET1 /* = self::B */ {
lowered final self::ET1 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET1|constructor#_#new#tearOff(self::B b) → self::ET1 /* = self::B */
return self::ET1|constructor#(b);
static extension-type-member method ET2|constructor#(self::B b) → self::ET2 /* = self::B */ {
lowered final self::ET2 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET2|constructor#_#new#tearOff(self::B b) → self::ET2 /* = self::B */
return self::ET2|constructor#(b);
static method main() → void {
self::ET2 /* = self::B */ et2 = self::ET2|constructor#(new self::B::•());
et2.{self::B::foo}(42){([core::int]) → void};
}
constants {
#C1 = core::_Override {}
#C2 = 0
}
@@ -0,0 +1,48 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
method foo() → void {}
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B
: super core::Object::•()
;
@#C1
method foo([core::int i = #C2]) → void {}
}
extension type ET1(self::B b) implements self::A {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
extension type ET2(self::B b) implements self::ET1 /* = self::B */, self::B {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET2|constructor#;
constructor tearoff • = self::ET2|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::B b) → self::ET1 /* = self::B */ {
lowered final self::ET1 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET1|constructor#_#new#tearOff(self::B b) → self::ET1 /* = self::B */
return self::ET1|constructor#(b);
static extension-type-member method ET2|constructor#(self::B b) → self::ET2 /* = self::B */ {
lowered final self::ET2 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET2|constructor#_#new#tearOff(self::B b) → self::ET2 /* = self::B */
return self::ET2|constructor#(b);
static method main() → void {
self::ET2 /* = self::B */ et2 = self::ET2|constructor#(new self::B::•());
et2.{self::B::foo}(42){([core::int]) → void};
}
constants {
#C1 = core::_Override {}
#C2 = 0
}
@@ -0,0 +1,10 @@
class A {
void foo() {}
}
class B implements A {
@override
void foo([int i = 0]) {}
}
extension type ET1(B b) implements A {}
extension type ET2(B b) implements ET1, B {}
void main() {}
@@ -0,0 +1,10 @@
class A {
void foo() {}
}
class B implements A {
@override
void foo([int i = 0]) {}
}
extension type ET1(B b) implements A {}
extension type ET2(B b) implements ET1, B {}
void main() {}
@@ -0,0 +1,48 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
method foo() → void {}
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B
: super core::Object::•()
;
@#C1
method foo([core::int i = #C2]) → void {}
}
extension type ET1(self::B b) implements self::A {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
extension type ET2(self::B b) implements self::ET1 /* = self::B */, self::B {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET2|constructor#;
constructor tearoff • = self::ET2|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::B b) → self::ET1 /* = self::B */ {
lowered final self::ET1 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET1|constructor#_#new#tearOff(self::B b) → self::ET1 /* = self::B */
return self::ET1|constructor#(b);
static extension-type-member method ET2|constructor#(self::B b) → self::ET2 /* = self::B */ {
lowered final self::ET2 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET2|constructor#_#new#tearOff(self::B b) → self::ET2 /* = self::B */
return self::ET2|constructor#(b);
static method main() → void {
self::ET2 /* = self::B */ et2 = self::ET2|constructor#(new self::B::•());
et2.{self::B::foo}(42){([core::int]) → void};
}
constants {
#C1 = core::_Override {}
#C2 = 0
}
@@ -0,0 +1,48 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
method foo() → void {}
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B
: super core::Object::•()
;
@#C1
method foo([core::int i = #C2]) → void {}
}
extension type ET1(self::B b) implements self::A {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
extension type ET2(self::B b) implements self::ET1 /* = self::B */, self::B {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET2|constructor#;
constructor tearoff • = self::ET2|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::B b) → self::ET1 /* = self::B */ {
lowered final self::ET1 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET1|constructor#_#new#tearOff(self::B b) → self::ET1 /* = self::B */
return self::ET1|constructor#(b);
static extension-type-member method ET2|constructor#(self::B b) → self::ET2 /* = self::B */ {
lowered final self::ET2 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET2|constructor#_#new#tearOff(self::B b) → self::ET2 /* = self::B */
return self::ET2|constructor#(b);
static method main() → void {
self::ET2 /* = self::B */ et2 = self::ET2|constructor#(new self::B::•());
et2.{self::B::foo}(42){([core::int]) → void};
}
constants {
#C1 = core::_Override {}
#C2 = 0
}
@@ -0,0 +1,42 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A
;
method foo() → void
;
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B
;
@core::override
method foo([core::int i = 0]) → void
;
}
extension type ET1(self::B b) implements self::A {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
extension type ET2(self::B b) implements self::ET1 /* = self::B */, self::B {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET2|constructor#;
constructor tearoff • = self::ET2|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::B b) → self::ET1 /* = self::B */
;
static extension-type-member method ET1|constructor#_#new#tearOff(self::B b) → self::ET1 /* = self::B */
return self::ET1|constructor#(b);
static extension-type-member method ET2|constructor#(self::B b) → self::ET2 /* = self::B */
;
static extension-type-member method ET2|constructor#_#new#tearOff(self::B b) → self::ET2 /* = self::B */
return self::ET2|constructor#(b);
static method main() → void
;
Extra constant evaluation status:
Evaluated: StaticGet @ org-dartlang-testcase:///issue53740.dart:10:4 -> InstanceConstant(const _Override{})
Extra constant evaluation: evaluated: 5, effectively constant: 1
@@ -0,0 +1,48 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
method foo() → void {}
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B
: super core::Object::•()
;
@#C1
method foo([core::int i = #C2]) → void {}
}
extension type ET1(self::B b) implements self::A {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
extension type ET2(self::B b) implements self::ET1 /* = self::B */, self::B {
abstract extension-type-member representation-field get b() → self::B;
constructor • = self::ET2|constructor#;
constructor tearoff • = self::ET2|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::B b) → self::ET1 /* = self::B */ {
lowered final self::ET1 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET1|constructor#_#new#tearOff(self::B b) → self::ET1 /* = self::B */
return self::ET1|constructor#(b);
static extension-type-member method ET2|constructor#(self::B b) → self::ET2 /* = self::B */ {
lowered final self::ET2 /* = self::B */ #this = b;
return #this;
}
static extension-type-member method ET2|constructor#_#new#tearOff(self::B b) → self::ET2 /* = self::B */
return self::ET2|constructor#(b);
static method main() → void {
self::ET2 /* = self::B */ et2 = self::ET2|constructor#(new self::B::•());
et2.{self::B::foo}(42){([core::int]) → void};
}
constants {
#C1 = core::_Override {}
#C2 = 0
}