[cfe] Allow abstract classes to implement and extend Enum

Part of https://github.com/dart-lang/sdk/issues/47453

Change-Id: I6782b4a9f13f95f626f41c311c05ce949649c828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228562
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
Chloe Stefantsova
2022-01-18 13:52:34 +00:00
committed by Commit Bot
parent f8b306cf27
commit df0f476177
28 changed files with 1311 additions and 5 deletions
@@ -2806,6 +2806,30 @@ const MessageCode messageEnumInstantiation = const MessageCode(
analyzerCodes: <String>["INSTANTIATE_ENUM"],
problemMessage: r"""Enums can't be instantiated.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)>
templateEnumSupertypeOfNonAbstractClass =
const Template<Message Function(String name)>(
problemMessageTemplate:
r"""Non-abstract class '#name' has 'Enum' as a superinterface.""",
withArguments: _withArgumentsEnumSupertypeOfNonAbstractClass);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeEnumSupertypeOfNonAbstractClass =
const Code<Message Function(String name)>(
"EnumSupertypeOfNonAbstractClass",
);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsEnumSupertypeOfNonAbstractClass(String name) {
if (name.isEmpty) throw 'No name provided';
name = demangleMixinApplicationName(name);
return new Message(codeEnumSupertypeOfNonAbstractClass,
problemMessage:
"""Non-abstract class '${name}' has 'Enum' as a superinterface.""",
arguments: {'name': name});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeEqualityCannotBeEqualityOperand =
messageEqualityCannotBeEqualityOperand;
@@ -8,7 +8,6 @@ const List<String> denylistedCoreClasses = [
"int",
"num",
"double",
"Enum",
"String",
"Null"
];
@@ -1648,6 +1648,8 @@ severity: $severity
denylistedCoreClasses[i],
required: true) as ClassBuilder);
}
ClassBuilder enumClass =
coreLibrary.lookupLocalMember("Enum", required: true) as ClassBuilder;
if (typedDataLibrary != null) {
for (int i = 0; i < denylistedTypedDataClasses.length; i++) {
// Allow the member to not exist. If it doesn't, nobody can extend it.
@@ -1664,8 +1666,8 @@ severity: $severity
topologicalSort(classGraph);
List<SourceClassBuilder> classes = result.sortedVertices;
for (SourceClassBuilder cls in classes) {
checkClassSupertypes(
cls, classGraph.directSupertypeMap[cls]!, denyListedClasses);
checkClassSupertypes(cls, classGraph.directSupertypeMap[cls]!,
denyListedClasses, enumClass);
}
List<SourceClassBuilder> classesWithCycles = result.cyclicVertices;
@@ -1708,10 +1710,30 @@ severity: $severity
}
}
bool checkEnumSupertypeIsDenylisted(SourceClassBuilder cls) {
if (!cls.library.enableEnhancedEnumsInLibrary) {
cls.addProblem(
templateExperimentNotEnabled.withArguments('enhanced-enums',
cls.library.enableEnhancedEnumsVersionInLibrary.toText()),
cls.charOffset,
noLength);
return true;
} else {
if (!cls.isAbstract) {
cls.addProblem(
templateEnumSupertypeOfNonAbstractClass.withArguments(cls.name),
cls.charOffset,
noLength);
}
return false;
}
}
void checkClassSupertypes(
SourceClassBuilder cls,
Map<TypeDeclarationBuilder?, TypeAliasBuilder?> directSupertypeMap,
Set<ClassBuilder> denyListedClasses) {
Set<ClassBuilder> denyListedClasses,
ClassBuilder enumClass) {
// Check that the direct supertypes aren't deny-listed or enums.
List<TypeDeclarationBuilder?> directSupertypes =
directSupertypeMap.keys.toList();
@@ -1721,7 +1743,9 @@ severity: $severity
cls.addProblem(templateExtendingEnum.withArguments(supertype.name),
cls.charOffset, noLength);
} else if (!cls.library.mayImplementRestrictedTypes &&
denyListedClasses.contains(supertype)) {
(denyListedClasses.contains(supertype) ||
identical(supertype, enumClass) &&
checkEnumSupertypeIsDenylisted(cls))) {
TypeAliasBuilder? aliasBuilder = directSupertypeMap[supertype];
if (aliasBuilder != null) {
cls.addProblem(
+2
View File
@@ -218,6 +218,8 @@ EnumDeclaresConstFactory/example: Fail
EnumDeclaresFactory/analyzerCode: Fail
EnumDeclaresFactory/example: Fail
EnumInstantiation/example: Fail
EnumSupertypeOfNonAbstractClass/analyzerCode: Fail
EnumSupertypeOfNonAbstractClass/example: Fail
EqualityCannotBeEqualityOperand/part_wrapped_script1: Fail
EqualityCannotBeEqualityOperand/part_wrapped_script2: Fail
EqualityCannotBeEqualityOperand/script1: Fail
+3
View File
@@ -5455,3 +5455,6 @@ PositionalSuperParametersAndArguments:
SuperInitializerParameter:
problemMessage: "This is the super-initializer parameter."
severity: CONTEXT
EnumSupertypeOfNonAbstractClass:
problemMessage: "Non-abstract class '#name' has 'Enum' as a superinterface."
@@ -75,6 +75,7 @@ stringokempty
struct<#name
structs
super.namedconstructor
superinterface
supermixin
team
this.namedconstructor
@@ -321,7 +321,9 @@ dw
dyn
e's
e2e
ea
ease
eb
ec
echo
edits
@@ -0,0 +1,40 @@
// 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 extends Enum { // Ok.
int get foo => index;
}
enum EA with A { element }
abstract class B implements Enum { // Ok.
int get foo => index;
}
enum EB with B { element }
mixin M on Enum { // Ok.
int get foo => index;
}
enum EM with M { element }
mixin N implements Enum { // Ok.
int get foo => index;
}
enum EN with N { element }
expectEquals(x, y) {
if (x != y) {
throw "Expected '$x' to be equal to '$y'.";
}
}
main() {
expectEquals(EA.element.foo, EA.element.index);
expectEquals(EB.element.foo, EB.element.index);
expectEquals(EM.element.foo, EM.element.index);
expectEquals(EN.element.foo, EN.element.index);
}
@@ -0,0 +1,128 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
abstract class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EA&_Enum&A = core::_Enum with self::A /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EA&_Enum&A
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::A::foo};
}
class EA extends self::_EA&_Enum&A /*isEnum*/ {
static const field core::List<self::EA> values = #C4;
static const field self::EA element = #C3;
const constructor •(core::int index, core::String name) → self::EA
: super self::_EA&_Enum&A::•(index, name)
;
method toString() → core::String
;
}
abstract class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EB&_Enum&B = core::_Enum with self::B /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EB&_Enum&B
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::B::foo};
}
class EB extends self::_EB&_Enum&B /*isEnum*/ {
static const field core::List<self::EB> values = #C6;
static const field self::EB element = #C5;
const constructor •(core::int index, core::String name) → self::EB
: super self::_EB&_Enum&B::•(index, name)
;
method toString() → core::String
;
}
abstract class M extends core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EM&_Enum&M = core::_Enum with self::M /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EM&_Enum&M
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::M::foo};
}
class EM extends self::_EM&_Enum&M /*isEnum*/ {
static const field core::List<self::EM> values = #C8;
static const field self::EM element = #C7;
const constructor •(core::int index, core::String name) → self::EM
: super self::_EM&_Enum&M::•(index, name)
;
method toString() → core::String
;
}
abstract class N extends core::Object implements core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EN&_Enum&N = core::_Enum with self::N /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EN&_Enum&N
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::N::foo};
}
class EN extends self::_EN&_Enum&N /*isEnum*/ {
static const field core::List<self::EN> values = #C10;
static const field self::EN element = #C9;
const constructor •(core::int index, core::String name) → self::EN
: super self::_EN&_Enum&N::•(index, name)
;
method toString() → core::String
;
}
static method expectEquals(dynamic x, dynamic y) → dynamic {
if(!(x =={core::Object::==}{(core::Object) → core::bool} y)) {
throw "Expected '${x}' to be equal to '${y}'.";
}
}
static method main() → dynamic {
self::expectEquals(#C3.{self::_EA&_Enum&A::foo}{core::int}, #C3.{core::_Enum::index}{core::int});
self::expectEquals(#C5.{self::_EB&_Enum&B::foo}{core::int}, #C5.{core::_Enum::index}{core::int});
self::expectEquals(#C7.{self::_EM&_Enum&M::foo}{core::int}, #C7.{core::_Enum::index}{core::int});
self::expectEquals(#C9.{self::_EN&_Enum&N::foo}{core::int}, #C9.{core::_Enum::index}{core::int});
}
constants {
#C1 = 0
#C2 = "element"
#C3 = self::EA {index:#C1, _name:#C2}
#C4 = <self::EA>[#C3]
#C5 = self::EB {index:#C1, _name:#C2}
#C6 = <self::EB>[#C5]
#C7 = self::EM {index:#C1, _name:#C2}
#C8 = <self::EM>[#C7]
#C9 = self::EN {index:#C1, _name:#C2}
#C10 = <self::EN>[#C9]
}
Constructor coverage from constants:
org-dartlang-testcase:///enum_as_supertype.dart:
- EA. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _EA&_Enum&A. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:76:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
- EB. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- _EB&_Enum&B. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- EM. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- _EM&_Enum&M. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- EN. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
- _EN&_Enum&N. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
@@ -0,0 +1,128 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
abstract class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EA&_Enum&A extends core::_Enum implements self::A /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EA&_Enum&A
: super core::_Enum::•(index, _name)
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
class EA extends self::_EA&_Enum&A /*isEnum*/ {
static const field core::List<self::EA> values = #C4;
static const field self::EA element = #C3;
const constructor •(core::int index, core::String name) → self::EA
: super self::_EA&_Enum&A::•(index, name)
;
method toString() → core::String
;
}
abstract class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EB&_Enum&B extends core::_Enum implements self::B /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EB&_Enum&B
: super core::_Enum::•(index, _name)
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
class EB extends self::_EB&_Enum&B /*isEnum*/ {
static const field core::List<self::EB> values = #C6;
static const field self::EB element = #C5;
const constructor •(core::int index, core::String name) → self::EB
: super self::_EB&_Enum&B::•(index, name)
;
method toString() → core::String
;
}
abstract class M extends core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EM&_Enum&M extends core::_Enum implements self::M /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EM&_Enum&M
: super core::_Enum::•(index, _name)
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
class EM extends self::_EM&_Enum&M /*isEnum*/ {
static const field core::List<self::EM> values = #C8;
static const field self::EM element = #C7;
const constructor •(core::int index, core::String name) → self::EM
: super self::_EM&_Enum&M::•(index, name)
;
method toString() → core::String
;
}
abstract class N extends core::Object implements core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EN&_Enum&N extends core::_Enum implements self::N /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EN&_Enum&N
: super core::_Enum::•(index, _name)
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
class EN extends self::_EN&_Enum&N /*isEnum*/ {
static const field core::List<self::EN> values = #C10;
static const field self::EN element = #C9;
const constructor •(core::int index, core::String name) → self::EN
: super self::_EN&_Enum&N::•(index, name)
;
method toString() → core::String
;
}
static method expectEquals(dynamic x, dynamic y) → dynamic {
if(!(x =={core::Object::==}{(core::Object) → core::bool} y)) {
throw "Expected '${x}' to be equal to '${y}'.";
}
}
static method main() → dynamic {
self::expectEquals(#C3.{self::_EA&_Enum&A::foo}{core::int}, #C3.{core::_Enum::index}{core::int});
self::expectEquals(#C5.{self::_EB&_Enum&B::foo}{core::int}, #C5.{core::_Enum::index}{core::int});
self::expectEquals(#C7.{self::_EM&_Enum&M::foo}{core::int}, #C7.{core::_Enum::index}{core::int});
self::expectEquals(#C9.{self::_EN&_Enum&N::foo}{core::int}, #C9.{core::_Enum::index}{core::int});
}
constants {
#C1 = 0
#C2 = "element"
#C3 = self::EA {index:#C1, _name:#C2}
#C4 = <self::EA>[#C3]
#C5 = self::EB {index:#C1, _name:#C2}
#C6 = <self::EB>[#C5]
#C7 = self::EM {index:#C1, _name:#C2}
#C8 = <self::EM>[#C7]
#C9 = self::EN {index:#C1, _name:#C2}
#C10 = <self::EN>[#C9]
}
Constructor coverage from constants:
org-dartlang-testcase:///enum_as_supertype.dart:
- EA. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _EA&_Enum&A. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:76:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
- EB. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- _EB&_Enum&B. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- EM. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- _EM&_Enum&M. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- EN. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
- _EN&_Enum&N. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
@@ -0,0 +1,18 @@
abstract class A extends Enum {
int get foo => index;
}
enum EA with A { element }
abstract class B implements Enum {
int get foo => index;
}
enum EB with B { element }
mixin M on Enum {
int get foo => index;
}
enum EM with M { element }
mixin N implements Enum {
int get foo => index;
}
enum EN with N { element }
expectEquals(x, y) {}
main() {}
@@ -0,0 +1,128 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
abstract class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EA&_Enum&A = core::_Enum with self::A /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EA&_Enum&A
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::A::foo};
}
class EA extends self::_EA&_Enum&A /*isEnum*/ {
static const field core::List<self::EA> values = #C4;
static const field self::EA element = #C3;
const constructor •(core::int index, core::String name) → self::EA
: super self::_EA&_Enum&A::•(index, name)
;
method toString() → core::String
;
}
abstract class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EB&_Enum&B = core::_Enum with self::B /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EB&_Enum&B
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::B::foo};
}
class EB extends self::_EB&_Enum&B /*isEnum*/ {
static const field core::List<self::EB> values = #C6;
static const field self::EB element = #C5;
const constructor •(core::int index, core::String name) → self::EB
: super self::_EB&_Enum&B::•(index, name)
;
method toString() → core::String
;
}
abstract class M extends core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EM&_Enum&M = core::_Enum with self::M /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EM&_Enum&M
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::M::foo};
}
class EM extends self::_EM&_Enum&M /*isEnum*/ {
static const field core::List<self::EM> values = #C8;
static const field self::EM element = #C7;
const constructor •(core::int index, core::String name) → self::EM
: super self::_EM&_Enum&M::•(index, name)
;
method toString() → core::String
;
}
abstract class N extends core::Object implements core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EN&_Enum&N = core::_Enum with self::N /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EN&_Enum&N
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::N::foo};
}
class EN extends self::_EN&_Enum&N /*isEnum*/ {
static const field core::List<self::EN> values = #C10;
static const field self::EN element = #C9;
const constructor •(core::int index, core::String name) → self::EN
: super self::_EN&_Enum&N::•(index, name)
;
method toString() → core::String
;
}
static method expectEquals(dynamic x, dynamic y) → dynamic {
if(!(x =={core::Object::==}{(core::Object) → core::bool} y)) {
throw "Expected '${x}' to be equal to '${y}'.";
}
}
static method main() → dynamic {
self::expectEquals(#C3.{self::_EA&_Enum&A::foo}{core::int}, #C3.{core::_Enum::index}{core::int});
self::expectEquals(#C5.{self::_EB&_Enum&B::foo}{core::int}, #C5.{core::_Enum::index}{core::int});
self::expectEquals(#C7.{self::_EM&_Enum&M::foo}{core::int}, #C7.{core::_Enum::index}{core::int});
self::expectEquals(#C9.{self::_EN&_Enum&N::foo}{core::int}, #C9.{core::_Enum::index}{core::int});
}
constants {
#C1 = 0
#C2 = "element"
#C3 = self::EA {index:#C1, _name:#C2}
#C4 = <self::EA*>[#C3]
#C5 = self::EB {index:#C1, _name:#C2}
#C6 = <self::EB*>[#C5]
#C7 = self::EM {index:#C1, _name:#C2}
#C8 = <self::EM*>[#C7]
#C9 = self::EN {index:#C1, _name:#C2}
#C10 = <self::EN*>[#C9]
}
Constructor coverage from constants:
org-dartlang-testcase:///enum_as_supertype.dart:
- EA. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _EA&_Enum&A. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:76:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
- EB. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- _EB&_Enum&B. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- EM. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- _EM&_Enum&M. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- EN. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
- _EN&_Enum&N. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
@@ -0,0 +1,128 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
abstract class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EA&_Enum&A = core::_Enum with self::A /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EA&_Enum&A
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::A::foo};
}
class EA extends self::_EA&_Enum&A /*isEnum*/ {
static const field core::List<self::EA> values = #C4;
static const field self::EA element = #C3;
const constructor •(core::int index, core::String name) → self::EA
: super self::_EA&_Enum&A::•(index, name)
;
method toString() → core::String
;
}
abstract class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EB&_Enum&B = core::_Enum with self::B /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EB&_Enum&B
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::B::foo};
}
class EB extends self::_EB&_Enum&B /*isEnum*/ {
static const field core::List<self::EB> values = #C6;
static const field self::EB element = #C5;
const constructor •(core::int index, core::String name) → self::EB
: super self::_EB&_Enum&B::•(index, name)
;
method toString() → core::String
;
}
abstract class M extends core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EM&_Enum&M = core::_Enum with self::M /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EM&_Enum&M
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::M::foo};
}
class EM extends self::_EM&_Enum&M /*isEnum*/ {
static const field core::List<self::EM> values = #C8;
static const field self::EM element = #C7;
const constructor •(core::int index, core::String name) → self::EM
: super self::_EM&_Enum&M::•(index, name)
;
method toString() → core::String
;
}
abstract class N extends core::Object implements core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EN&_Enum&N = core::_Enum with self::N /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EN&_Enum&N
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::N::foo};
}
class EN extends self::_EN&_Enum&N /*isEnum*/ {
static const field core::List<self::EN> values = #C10;
static const field self::EN element = #C9;
const constructor •(core::int index, core::String name) → self::EN
: super self::_EN&_Enum&N::•(index, name)
;
method toString() → core::String
;
}
static method expectEquals(dynamic x, dynamic y) → dynamic {
if(!(x =={core::Object::==}{(core::Object) → core::bool} y)) {
throw "Expected '${x}' to be equal to '${y}'.";
}
}
static method main() → dynamic {
self::expectEquals(#C3.{self::_EA&_Enum&A::foo}{core::int}, #C3.{core::_Enum::index}{core::int});
self::expectEquals(#C5.{self::_EB&_Enum&B::foo}{core::int}, #C5.{core::_Enum::index}{core::int});
self::expectEquals(#C7.{self::_EM&_Enum&M::foo}{core::int}, #C7.{core::_Enum::index}{core::int});
self::expectEquals(#C9.{self::_EN&_Enum&N::foo}{core::int}, #C9.{core::_Enum::index}{core::int});
}
constants {
#C1 = 0
#C2 = "element"
#C3 = self::EA {index:#C1, _name:#C2}
#C4 = <self::EA*>[#C3]
#C5 = self::EB {index:#C1, _name:#C2}
#C6 = <self::EB*>[#C5]
#C7 = self::EM {index:#C1, _name:#C2}
#C8 = <self::EM*>[#C7]
#C9 = self::EN {index:#C1, _name:#C2}
#C10 = <self::EN*>[#C9]
}
Constructor coverage from constants:
org-dartlang-testcase:///enum_as_supertype.dart:
- EA. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _EA&_Enum&A. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:76:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
- EB. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- _EB&_Enum&B. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- EM. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- _EM&_Enum&M. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- EN. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
- _EN&_Enum&N. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
@@ -0,0 +1,100 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
abstract class A extends core::Enum {
synthetic constructor •() → self::A
;
get foo() → core::int
;
}
abstract class _EA&_Enum&A = core::_Enum with self::A /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EA&_Enum&A
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::A::foo};
}
class EA extends self::_EA&_Enum&A /*isEnum*/ {
static const field core::List<self::EA> values = const <self::EA>[self::EA::element];
static const field self::EA element = const self::EA::•(0, "element");
const constructor •(core::int index, core::String name) → self::EA
;
method toString() → core::String
;
}
abstract class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
;
get foo() → core::int
;
}
abstract class _EB&_Enum&B = core::_Enum with self::B /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EB&_Enum&B
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::B::foo};
}
class EB extends self::_EB&_Enum&B /*isEnum*/ {
static const field core::List<self::EB> values = const <self::EB>[self::EB::element];
static const field self::EB element = const self::EB::•(0, "element");
const constructor •(core::int index, core::String name) → self::EB
;
method toString() → core::String
;
}
abstract class M extends core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
;
}
abstract class _EM&_Enum&M = core::_Enum with self::M /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EM&_Enum&M
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::M::foo};
}
class EM extends self::_EM&_Enum&M /*isEnum*/ {
static const field core::List<self::EM> values = const <self::EM>[self::EM::element];
static const field self::EM element = const self::EM::•(0, "element");
const constructor •(core::int index, core::String name) → self::EM
;
method toString() → core::String
;
}
abstract class N extends core::Object implements core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
;
}
abstract class _EN&_Enum&N = core::_Enum with self::N /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EN&_Enum&N
: super core::_Enum::•(index, _name)
;
mixin-super-stub get foo() → core::int
return super.{self::N::foo};
}
class EN extends self::_EN&_Enum&N /*isEnum*/ {
static const field core::List<self::EN> values = const <self::EN>[self::EN::element];
static const field self::EN element = const self::EN::•(0, "element");
const constructor •(core::int index, core::String name) → self::EN
;
method toString() → core::String
;
}
static method expectEquals(dynamic x, dynamic y) → dynamic
;
static method main() → dynamic
;
Extra constant evaluation status:
Evaluated: ListLiteral @ org-dartlang-testcase:///enum_as_supertype.dart:9:6 -> ListConstant(const <EA*>[const EA{}])
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///enum_as_supertype.dart:9:18 -> InstanceConstant(const EA{})
Evaluated: ListLiteral @ org-dartlang-testcase:///enum_as_supertype.dart:15:6 -> ListConstant(const <EB*>[const EB{}])
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///enum_as_supertype.dart:15:18 -> InstanceConstant(const EB{})
Evaluated: ListLiteral @ org-dartlang-testcase:///enum_as_supertype.dart:21:6 -> ListConstant(const <EM*>[const EM{}])
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///enum_as_supertype.dart:21:18 -> InstanceConstant(const EM{})
Evaluated: ListLiteral @ org-dartlang-testcase:///enum_as_supertype.dart:27:6 -> ListConstant(const <EN*>[const EN{}])
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///enum_as_supertype.dart:27:18 -> InstanceConstant(const EN{})
Extra constant evaluation: evaluated: 20, effectively constant: 8
@@ -0,0 +1,128 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
abstract class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EA&_Enum&A extends core::_Enum implements self::A /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EA&_Enum&A
: super core::_Enum::•(index, _name)
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
class EA extends self::_EA&_Enum&A /*isEnum*/ {
static const field core::List<self::EA> values = #C4;
static const field self::EA element = #C3;
const constructor •(core::int index, core::String name) → self::EA
: super self::_EA&_Enum&A::•(index, name)
;
method toString() → core::String
;
}
abstract class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EB&_Enum&B extends core::_Enum implements self::B /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EB&_Enum&B
: super core::_Enum::•(index, _name)
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
class EB extends self::_EB&_Enum&B /*isEnum*/ {
static const field core::List<self::EB> values = #C6;
static const field self::EB element = #C5;
const constructor •(core::int index, core::String name) → self::EB
: super self::_EB&_Enum&B::•(index, name)
;
method toString() → core::String
;
}
abstract class M extends core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EM&_Enum&M extends core::_Enum implements self::M /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EM&_Enum&M
: super core::_Enum::•(index, _name)
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
class EM extends self::_EM&_Enum&M /*isEnum*/ {
static const field core::List<self::EM> values = #C8;
static const field self::EM element = #C7;
const constructor •(core::int index, core::String name) → self::EM
: super self::_EM&_Enum&M::•(index, name)
;
method toString() → core::String
;
}
abstract class N extends core::Object implements core::Enum /*isMixinDeclaration*/ {
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
abstract class _EN&_Enum&N extends core::_Enum implements self::N /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •(core::int index, core::String _name) → self::_EN&_Enum&N
: super core::_Enum::•(index, _name)
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
}
class EN extends self::_EN&_Enum&N /*isEnum*/ {
static const field core::List<self::EN> values = #C10;
static const field self::EN element = #C9;
const constructor •(core::int index, core::String name) → self::EN
: super self::_EN&_Enum&N::•(index, name)
;
method toString() → core::String
;
}
static method expectEquals(dynamic x, dynamic y) → dynamic {
if(!(x =={core::Object::==}{(core::Object) → core::bool} y)) {
throw "Expected '${x}' to be equal to '${y}'.";
}
}
static method main() → dynamic {
self::expectEquals(#C3.{self::_EA&_Enum&A::foo}{core::int}, #C3.{core::_Enum::index}{core::int});
self::expectEquals(#C5.{self::_EB&_Enum&B::foo}{core::int}, #C5.{core::_Enum::index}{core::int});
self::expectEquals(#C7.{self::_EM&_Enum&M::foo}{core::int}, #C7.{core::_Enum::index}{core::int});
self::expectEquals(#C9.{self::_EN&_Enum&N::foo}{core::int}, #C9.{core::_Enum::index}{core::int});
}
constants {
#C1 = 0
#C2 = "element"
#C3 = self::EA {index:#C1, _name:#C2}
#C4 = <self::EA*>[#C3]
#C5 = self::EB {index:#C1, _name:#C2}
#C6 = <self::EB*>[#C5]
#C7 = self::EM {index:#C1, _name:#C2}
#C8 = <self::EM*>[#C7]
#C9 = self::EN {index:#C1, _name:#C2}
#C10 = <self::EN*>[#C9]
}
Constructor coverage from constants:
org-dartlang-testcase:///enum_as_supertype.dart:
- EA. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _EA&_Enum&A. (from org-dartlang-testcase:///enum_as_supertype.dart:9:6)
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:76:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
- EB. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- _EB&_Enum&B. (from org-dartlang-testcase:///enum_as_supertype.dart:15:6)
- EM. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- _EM&_Enum&M. (from org-dartlang-testcase:///enum_as_supertype.dart:21:6)
- EN. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
- _EN&_Enum&N. (from org-dartlang-testcase:///enum_as_supertype.dart:27:6)
@@ -0,0 +1,13 @@
// 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.
class A extends Enum { // Error.
int get foo => index;
}
class B implements Enum { // Error.
int get foo => index;
}
main() {}
@@ -0,0 +1,69 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: Non-abstract class 'A' has 'Enum' as a superinterface.
// class A extends Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: Non-abstract class 'B' has 'Enum' as a superinterface.
// class B implements Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: The non-abstract class 'A' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class A extends Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: The non-abstract class 'B' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class B implements Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
import self as self;
import "dart:core" as core;
class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
static method main() → dynamic {}
constants {
#C1 = #org-dartlang-testcase:///enum_as_supertype_error.dart::_name
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = <core::Symbol*, dynamic>{)
}
@@ -0,0 +1,69 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: Non-abstract class 'A' has 'Enum' as a superinterface.
// class A extends Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: Non-abstract class 'B' has 'Enum' as a superinterface.
// class B implements Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: The non-abstract class 'A' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class A extends Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: The non-abstract class 'B' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class B implements Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
import self as self;
import "dart:core" as core;
class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
static method main() → dynamic {}
constants {
#C1 = #org-dartlang-testcase:///enum_as_supertype_error.dart::_name
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = <core::Symbol*, dynamic>{)
}
@@ -0,0 +1,9 @@
class A extends Enum {
int get foo => index;
}
class B implements Enum {
int get foo => index;
}
main() {}
@@ -0,0 +1,9 @@
class A extends Enum {
int get foo => index;
}
class B implements Enum {
int get foo => index;
}
main() {}
@@ -0,0 +1,69 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: Non-abstract class 'A' has 'Enum' as a superinterface.
// class A extends Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: Non-abstract class 'B' has 'Enum' as a superinterface.
// class B implements Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: The non-abstract class 'A' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class A extends Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: The non-abstract class 'B' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class B implements Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
import self as self;
import "dart:core" as core;
class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
static method main() → dynamic {}
constants {
#C1 = #org-dartlang-testcase:///enum_as_supertype_error.dart::_name
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = <core::Symbol*, dynamic>{)
}
@@ -0,0 +1,69 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: Non-abstract class 'A' has 'Enum' as a superinterface.
// class A extends Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: Non-abstract class 'B' has 'Enum' as a superinterface.
// class B implements Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: The non-abstract class 'A' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class A extends Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: The non-abstract class 'B' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class B implements Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
import self as self;
import "dart:core" as core;
class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
static method main() → dynamic {}
constants {
#C1 = #org-dartlang-testcase:///enum_as_supertype_error.dart::_name
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = <core::Symbol*, dynamic>{)
}
@@ -0,0 +1,73 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: Non-abstract class 'A' has 'Enum' as a superinterface.
// class A extends Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: Non-abstract class 'B' has 'Enum' as a superinterface.
// class B implements Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: The non-abstract class 'A' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class A extends Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: The non-abstract class 'B' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class B implements Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
import self as self;
import "dart:core" as core;
class A extends core::Enum {
synthetic constructor •() → self::A
;
get foo() → core::int
;
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#_name, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
;
get foo() → core::int
;
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#_name, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
static method main() → dynamic
;
Extra constant evaluation status:
Evaluated: SymbolLiteral @ org-dartlang-sdk:///sdk/lib/core/enum.dart:47:14 -> SymbolConstant(#_name)
Evaluated: ListLiteral @ org-dartlang-sdk:///sdk/lib/core/enum.dart:47:14 -> ListConstant(const <Type*>[])
Evaluated: ListLiteral @ org-dartlang-sdk:///sdk/lib/core/enum.dart:47:14 -> ListConstant(const <dynamic>[])
Evaluated: MapLiteral @ org-dartlang-sdk:///sdk/lib/core/enum.dart:47:14 -> MapConstant(const <Symbol*, dynamic>{})
Evaluated: SymbolLiteral @ org-dartlang-sdk:///sdk/lib/core/enum.dart:47:14 -> SymbolConstant(#_name)
Evaluated: ListLiteral @ org-dartlang-sdk:///sdk/lib/core/enum.dart:47:14 -> ListConstant(const <Type*>[])
Evaluated: ListLiteral @ org-dartlang-sdk:///sdk/lib/core/enum.dart:47:14 -> ListConstant(const <dynamic>[])
Evaluated: MapLiteral @ org-dartlang-sdk:///sdk/lib/core/enum.dart:47:14 -> MapConstant(const <Symbol*, dynamic>{})
Extra constant evaluation: evaluated: 18, effectively constant: 8
@@ -0,0 +1,69 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: Non-abstract class 'A' has 'Enum' as a superinterface.
// class A extends Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: Non-abstract class 'B' has 'Enum' as a superinterface.
// class B implements Enum { // Error.
// ^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:5:7: Error: The non-abstract class 'A' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class A extends Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
// pkg/front_end/testcases/enhanced_enums/enum_as_supertype_error.dart:9:7: Error: The non-abstract class 'B' is missing implementations for these members:
// - Enum.index
// Try to either
// - provide an implementation,
// - inherit an implementation from a superclass or mixin,
// - mark the class as abstract, or
// - provide a 'noSuchMethod' implementation.
//
// class B implements Enum { // Error.
// ^
// sdk/lib/core/enum.dart:22:11: Context: 'Enum.index' is defined here.
// int get index;
// ^^^^^
//
import self as self;
import "dart:core" as core;
class A extends core::Enum {
synthetic constructor •() → self::A
: super core::Enum::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
class B extends core::Object implements core::Enum {
synthetic constructor •() → self::B
: super core::Object::•()
;
get foo() → core::int
return this.{core::Enum::index}{core::int};
no-such-method-forwarder get /* from org-dartlang-sdk:///sdk/lib/core/enum.dart */ _name() → core::String
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::String;
}
static method main() → dynamic {}
constants {
#C1 = #org-dartlang-testcase:///enum_as_supertype_error.dart::_name
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = <core::Symbol*, dynamic>{)
}
+1
View File
@@ -15,6 +15,7 @@ static_field_lowering/opt_in: SemiFuzzFailure
constructor_tearoffs/call_instantiation: TypeCheckError
constructor_tearoffs/lowering/invalid_redirect: VerificationError
enhanced_enums/enum_as_supertype: RuntimeError
enhanced_enums/simple_mixins: RuntimeError
extension_types/access_setter_as_getter: ExpectationFileMismatchSerialized # Expected.
extension_types/call_not_get: ExpectationFileMismatchSerialized # Expected.
@@ -8,6 +8,7 @@
constructor_tearoffs/call_instantiation: TypeCheckError
constructor_tearoffs/lowering/invalid_redirect: VerificationError
enhanced_enums/enum_as_supertype: RuntimeError
enhanced_enums/simple_mixins: RuntimeError
extension_types/access_setter_as_getter: ExpectationFileMismatchSerialized # Expected.
extension_types/call_not_get: ExpectationFileMismatchSerialized # Expected.
@@ -29,6 +29,7 @@ constructor_tearoffs/new_as_selector: FormatterCrash
dart2js/late_fields: FormatterCrash
dart2js/late_statics: FormatterCrash
enhanced_enums/entries_with_type_arguments: FormatterCrash
enhanced_enums/enum_as_supertype: FormatterCrash
enhanced_enums/inference_in_constructor_parameters: FormatterCrash
enhanced_enums/instantiated_generic_enum_types: FormatterCrash
enhanced_enums/issue48084: FormatterCrash
+1
View File
@@ -22,6 +22,7 @@ static_field_lowering/opt_in: SemiFuzzFailure
constructor_tearoffs/call_instantiation: TypeCheckError
constructor_tearoffs/lowering/invalid_redirect: VerificationError
enhanced_enums/enum_as_supertype: RuntimeError
enhanced_enums/simple_mixins: RuntimeError
extension_types/access_setter_as_getter: ExpectationFileMismatchSerialized # Expected.
extension_types/call_not_get: ExpectationFileMismatchSerialized # Expected.