[cfe] Report error when extending/impl/mixing in sealed classes outside of its library.

Change-Id: I8034cba69ca249c2727dea9641c3076788c6a854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271164
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
This commit is contained in:
Kallen Tu 2022-11-23 22:58:21 +00:00 committed by Commit Queue
parent 72493a75c6
commit 669856ce4c
33 changed files with 648 additions and 22 deletions

View file

@ -10659,6 +10659,60 @@ Message _withArgumentsSdkSummaryNotFound(Uri uri_) {
arguments: {'uri': uri_});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
String
name)> templateSealedClassSubtypeOutsideOfLibrary = const Template<
Message Function(String name)>(
problemMessageTemplate:
r"""Sealed class '#name' can't be extended, implemented, or mixed in outside of its library.""",
withArguments: _withArgumentsSealedClassSubtypeOutsideOfLibrary);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)>
codeSealedClassSubtypeOutsideOfLibrary =
const Code<Message Function(String name)>(
"SealedClassSubtypeOutsideOfLibrary",
);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsSealedClassSubtypeOutsideOfLibrary(String name) {
if (name.isEmpty) throw 'No name provided';
name = demangleMixinApplicationName(name);
return new Message(codeSealedClassSubtypeOutsideOfLibrary,
problemMessage:
"""Sealed class '${name}' can't be extended, implemented, or mixed in outside of its library.""",
arguments: {'name': name});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
String
name)> templateSealedMixinSubtypeOutsideOfLibrary = const Template<
Message Function(String name)>(
problemMessageTemplate:
r"""Sealed mixin '#name' can't be mixed in outside of its library.""",
withArguments: _withArgumentsSealedMixinSubtypeOutsideOfLibrary);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)>
codeSealedMixinSubtypeOutsideOfLibrary =
const Code<Message Function(String name)>(
"SealedMixinSubtypeOutsideOfLibrary",
);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsSealedMixinSubtypeOutsideOfLibrary(String name) {
if (name.isEmpty) throw 'No name provided';
name = demangleMixinApplicationName(name);
return new Message(codeSealedMixinSubtypeOutsideOfLibrary,
problemMessage:
"""Sealed mixin '${name}' can't be mixed in outside of its library.""",
arguments: {'name': name});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeSetLiteralTooManyTypeArguments =
messageSetLiteralTooManyTypeArguments;

View file

@ -74,6 +74,8 @@ abstract class ClassBuilder implements DeclarationBuilder {
bool get isMixin;
bool get isMixinDeclaration;
bool get isMixinApplication;
bool get isAnonymousMixinApplication;

View file

@ -57,6 +57,9 @@ class DillClassBuilder extends ClassBuilderImpl {
@override
bool get isMacro => cls.isMacro;
@override
bool get isMixinDeclaration => cls.isMixinDeclaration;
@override
bool get isSealed => cls.isSealed;

View file

@ -103,8 +103,6 @@ class SourceClassBuilder extends ClassBuilderImpl
@override
TypeBuilder? mixedInTypeBuilder;
bool isMixinDeclaration;
final IndexedClass? referencesFromIndexed;
@override
@ -116,6 +114,9 @@ class SourceClassBuilder extends ClassBuilderImpl
@override
final bool isAugmentation;
@override
bool isMixinDeclaration;
bool? _isConflictingAugmentationMember;
/// Returns `true` if this class is a class declared in an augmentation

View file

@ -2069,6 +2069,22 @@ severity: $severity
cls.charOffset,
noLength);
}
} else if (supertype is ClassBuilder &&
supertype.isSealed &&
supertype.libraryBuilder.origin != cls.libraryBuilder.origin) {
if (supertype.isMixinDeclaration) {
cls.addProblem(
templateSealedMixinSubtypeOutsideOfLibrary
.withArguments(supertype.fullNameForErrors),
cls.charOffset,
noLength);
} else {
cls.addProblem(
templateSealedClassSubtypeOutsideOfLibrary
.withArguments(supertype.fullNameForErrors),
cls.charOffset,
noLength);
}
}
}

View file

@ -861,6 +861,10 @@ SdkSpecificationNotFound/analyzerCode: Fail
SdkSpecificationNotFound/example: Fail
SdkSummaryNotFound/analyzerCode: Fail
SdkSummaryNotFound/example: Fail
SealedClassSubtypeOutsideOfLibrary/analyzerCode: Fail
SealedClassSubtypeOutsideOfLibrary/part_wrapped_script: Fail # Uses imports
SealedMixinSubtypeOutsideOfLibrary/analyzerCode: Fail
SealedMixinSubtypeOutsideOfLibrary/part_wrapped_script: Fail # Uses imports
SetLiteralTooManyTypeArguments/analyzerCode: Fail
SetLiteralTooManyTypeArguments/example: Fail
SetOrMapLiteralTooManyTypeArguments/analyzerCode: Fail

View file

@ -5997,3 +5997,23 @@ InheritedRestrictedMemberOfEnumImplementer:
script: |
abstract class A { int get hashCode => 0; }
abstract class B extends A implements Enum {}
SealedClassSubtypeOutsideOfLibrary:
problemMessage: "Sealed class '#name' can't be extended, implemented, or mixed in outside of its library."
experiments: sealed-class
script:
main.dart:
import 'lib.dart';
class B extends A {}
lib.dart:
sealed class A {}
SealedMixinSubtypeOutsideOfLibrary:
problemMessage: "Sealed mixin '#name' can't be mixed in outside of its library."
experiments: sealed-class
script:
main.dart:
import 'lib.dart';
class B with M {}
lib.dart:
sealed mixin M {}

View file

@ -0,0 +1,11 @@
// 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.
import 'main_lib.dart';
class Class1 extends Sealed {}
class Class2 implements Sealed {}
class Class3 with Sealed {}

View file

@ -0,0 +1,52 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:7:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class1 extends Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:9:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class2 implements Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:11:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class3 with Sealed {}
// ^
//
import self as self;
import "main_lib.dart" as mai;
import "dart:core" as core;
import "org-dartlang-testcase:///main_lib.dart";
class Class1 extends mai::Sealed {
synthetic constructor •() → self::Class1
: super mai::Sealed::•()
;
}
class Class2 extends core::Object implements mai::Sealed {
synthetic constructor •() → self::Class2
: super core::Object::•()
;
}
abstract class _Class3&Object&Sealed = core::Object with mai::Sealed /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class3&Object&Sealed
: super core::Object::•()
;
}
class Class3 extends self::_Class3&Object&Sealed {
synthetic constructor •() → self::Class3
: super self::_Class3&Object&Sealed::•()
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object {
synthetic constructor •() → mai::Sealed
: super core::Object::•()
;
}

View file

@ -0,0 +1,52 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:7:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class1 extends Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:9:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class2 implements Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:11:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class3 with Sealed {}
// ^
//
import self as self;
import "main_lib.dart" as mai;
import "dart:core" as core;
import "org-dartlang-testcase:///main_lib.dart";
class Class1 extends mai::Sealed {
synthetic constructor •() → self::Class1
: super mai::Sealed::•()
;
}
class Class2 extends core::Object implements mai::Sealed {
synthetic constructor •() → self::Class2
: super core::Object::•()
;
}
abstract class _Class3&Object&Sealed extends core::Object implements mai::Sealed /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class3&Object&Sealed
: super core::Object::•()
;
}
class Class3 extends self::_Class3&Object&Sealed {
synthetic constructor •() → self::Class3
: super self::_Class3&Object&Sealed::•()
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object {
synthetic constructor •() → mai::Sealed
: super core::Object::•()
;
}

View file

@ -0,0 +1,7 @@
import 'main_lib.dart';
class Class1 extends Sealed {}
class Class2 implements Sealed {}
class Class3 with Sealed {}

View file

@ -0,0 +1,7 @@
import 'main_lib.dart';
class Class1 extends Sealed {}
class Class2 implements Sealed {}
class Class3 with Sealed {}

View file

@ -0,0 +1,52 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:7:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class1 extends Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:9:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class2 implements Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:11:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class3 with Sealed {}
// ^
//
import self as self;
import "main_lib.dart" as mai;
import "dart:core" as core;
import "org-dartlang-testcase:///main_lib.dart";
class Class1 extends mai::Sealed {
synthetic constructor •() → self::Class1
: super mai::Sealed::•()
;
}
class Class2 extends core::Object implements mai::Sealed {
synthetic constructor •() → self::Class2
: super core::Object::•()
;
}
abstract class _Class3&Object&Sealed = core::Object with mai::Sealed /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class3&Object&Sealed
: super core::Object::•()
;
}
class Class3 extends self::_Class3&Object&Sealed {
synthetic constructor •() → self::Class3
: super self::_Class3&Object&Sealed::•()
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object {
synthetic constructor •() → mai::Sealed
: super core::Object::•()
;
}

View file

@ -0,0 +1,42 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:7:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class1 extends Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:9:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class2 implements Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:11:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class3 with Sealed {}
// ^
//
import self as self;
import "main_lib.dart" as mai;
import "dart:core" as core;
import "org-dartlang-testcase:///main_lib.dart";
class Class1 extends mai::Sealed {
synthetic constructor •() → self::Class1
: super mai::Sealed::•()
;
}
class Class2 extends core::Object implements mai::Sealed {
synthetic constructor •() → self::Class2
: super core::Object::•()
;
}
abstract class _Class3&Object&Sealed = core::Object with mai::Sealed /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class3&Object&Sealed
: super core::Object::•()
;
}
class Class3 extends self::_Class3&Object&Sealed {
synthetic constructor •() → self::Class3
: super self::_Class3&Object&Sealed::•()
;
}

View file

@ -0,0 +1,48 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:7:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class1 extends Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:9:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class2 implements Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:11:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class3 with Sealed {}
// ^
//
import self as self;
import "main_lib.dart" as mai;
import "dart:core" as core;
import "org-dartlang-testcase:///main_lib.dart";
class Class1 extends mai::Sealed {
synthetic constructor •() → self::Class1
;
}
class Class2 extends core::Object implements mai::Sealed {
synthetic constructor •() → self::Class2
;
}
abstract class _Class3&Object&Sealed = core::Object with mai::Sealed /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class3&Object&Sealed
: super core::Object::•()
;
}
class Class3 extends self::_Class3&Object&Sealed {
synthetic constructor •() → self::Class3
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object {
synthetic constructor •() → mai::Sealed
;
}

View file

@ -0,0 +1,52 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:7:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class1 extends Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:9:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class2 implements Sealed {}
// ^
//
// pkg/front_end/testcases/sealed_class/extends_implements_with/main.dart:11:7: Error: Sealed class 'Sealed' can't be extended, implemented, or mixed in outside of its library.
// class Class3 with Sealed {}
// ^
//
import self as self;
import "main_lib.dart" as mai;
import "dart:core" as core;
import "org-dartlang-testcase:///main_lib.dart";
class Class1 extends mai::Sealed {
synthetic constructor •() → self::Class1
: super mai::Sealed::•()
;
}
class Class2 extends core::Object implements mai::Sealed {
synthetic constructor •() → self::Class2
: super core::Object::•()
;
}
abstract class _Class3&Object&Sealed extends core::Object implements mai::Sealed /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class3&Object&Sealed
: super core::Object::•()
;
}
class Class3 extends self::_Class3&Object&Sealed {
synthetic constructor •() → self::Class3
: super self::_Class3&Object&Sealed::•()
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object {
synthetic constructor •() → mai::Sealed
: super core::Object::•()
;
}

View file

@ -0,0 +1,5 @@
// 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.
sealed class Sealed {}

View file

@ -0,0 +1 @@
main_lib.dart

View file

@ -0,0 +1,7 @@
// 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.
import 'main_lib.dart';
class Class1 with Sealed {}

View file

@ -0,0 +1,31 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/mixin_with/main.dart:7:7: Error: Sealed mixin 'Sealed' can't be mixed in outside of its library.
// class Class1 with Sealed {}
// ^
//
import self as self;
import "dart:core" as core;
import "main_lib.dart" as mai;
import "org-dartlang-testcase:///main_lib.dart";
abstract class _Class1&Object&Sealed = core::Object with mai::Sealed /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class1&Object&Sealed
: super core::Object::•()
;
}
class Class1 extends self::_Class1&Object&Sealed {
synthetic constructor •() → self::Class1
: super self::_Class1&Object&Sealed::•()
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object /*isMixinDeclaration*/ {
}

View file

@ -0,0 +1,31 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/mixin_with/main.dart:7:7: Error: Sealed mixin 'Sealed' can't be mixed in outside of its library.
// class Class1 with Sealed {}
// ^
//
import self as self;
import "dart:core" as core;
import "main_lib.dart" as mai;
import "org-dartlang-testcase:///main_lib.dart";
abstract class _Class1&Object&Sealed extends core::Object implements mai::Sealed /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class1&Object&Sealed
: super core::Object::•()
;
}
class Class1 extends self::_Class1&Object&Sealed {
synthetic constructor •() → self::Class1
: super self::_Class1&Object&Sealed::•()
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object /*isMixinDeclaration*/ {
}

View file

@ -0,0 +1,3 @@
import 'main_lib.dart';
class Class1 with Sealed {}

View file

@ -0,0 +1,3 @@
import 'main_lib.dart';
class Class1 with Sealed {}

View file

@ -0,0 +1,31 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/mixin_with/main.dart:7:7: Error: Sealed mixin 'Sealed' can't be mixed in outside of its library.
// class Class1 with Sealed {}
// ^
//
import self as self;
import "dart:core" as core;
import "main_lib.dart" as mai;
import "org-dartlang-testcase:///main_lib.dart";
abstract class _Class1&Object&Sealed = core::Object with mai::Sealed /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class1&Object&Sealed
: super core::Object::•()
;
}
class Class1 extends self::_Class1&Object&Sealed {
synthetic constructor •() → self::Class1
: super self::_Class1&Object&Sealed::•()
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object /*isMixinDeclaration*/ {
}

View file

@ -0,0 +1,24 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/mixin_with/main.dart:7:7: Error: Sealed mixin 'Sealed' can't be mixed in outside of its library.
// class Class1 with Sealed {}
// ^
//
import self as self;
import "dart:core" as core;
import "main_lib.dart" as mai;
import "org-dartlang-testcase:///main_lib.dart";
abstract class _Class1&Object&Sealed = core::Object with mai::Sealed /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class1&Object&Sealed
: super core::Object::•()
;
}
class Class1 extends self::_Class1&Object&Sealed {
synthetic constructor •() → self::Class1
: super self::_Class1&Object&Sealed::•()
;
}

View file

@ -0,0 +1,30 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/mixin_with/main.dart:7:7: Error: Sealed mixin 'Sealed' can't be mixed in outside of its library.
// class Class1 with Sealed {}
// ^
//
import self as self;
import "dart:core" as core;
import "main_lib.dart" as mai;
import "org-dartlang-testcase:///main_lib.dart";
abstract class _Class1&Object&Sealed = core::Object with mai::Sealed /*isAnonymousMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class1&Object&Sealed
: super core::Object::•()
;
}
class Class1 extends self::_Class1&Object&Sealed {
synthetic constructor •() → self::Class1
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object /*isMixinDeclaration*/ {
}

View file

@ -0,0 +1,31 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/sealed_class/mixin_with/main.dart:7:7: Error: Sealed mixin 'Sealed' can't be mixed in outside of its library.
// class Class1 with Sealed {}
// ^
//
import self as self;
import "dart:core" as core;
import "main_lib.dart" as mai;
import "org-dartlang-testcase:///main_lib.dart";
abstract class _Class1&Object&Sealed extends core::Object implements mai::Sealed /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •() → self::_Class1&Object&Sealed
: super core::Object::•()
;
}
class Class1 extends self::_Class1&Object&Sealed {
synthetic constructor •() → self::Class1
: super self::_Class1&Object&Sealed::•()
;
}
library /*isNonNullableByDefault*/;
import self as mai;
import "dart:core" as core;
abstract sealed class Sealed extends core::Object /*isMixinDeclaration*/ {
}

View file

@ -0,0 +1,5 @@
// 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.
sealed mixin Sealed {}

View file

@ -0,0 +1 @@
main_lib.dart

View file

@ -9,14 +9,14 @@
import 'sealed_class_as_mixin_lib.dart';
abstract class OutsideA with SealedClass {}
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed class 'SealedClass' can't be extended, implemented, or mixed in outside of its library.
class OutsideB with SealedClass {
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed class 'SealedClass' can't be extended, implemented, or mixed in outside of its library.
@override
int foo = 2;
@ -25,6 +25,6 @@ class OutsideB with SealedClass {
}
abstract class OutsideC = Object with SealedClass;
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed class 'SealedClass' can't be extended, implemented, or mixed in outside of its library.

View file

@ -9,14 +9,14 @@
import 'sealed_class_extend_lib.dart';
abstract class OutsideA extends SealedClass {}
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed class 'SealedClass' can't be extended, implemented, or mixed in outside of its library.
class OutsideB extends SealedClass {
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed class 'SealedClass' can't be extended, implemented, or mixed in outside of its library.
@override
int foo = 2;

View file

@ -9,14 +9,14 @@
import "sealed_class_implement_lib.dart";
abstract class OutsideA implements SealedClass {}
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed class 'SealedClass' can't be extended, implemented, or mixed in outside of its library.
class OutsideB implements SealedClass {
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed class 'SealedClass' can't be extended, implemented, or mixed in outside of its library.
@override
int nonAbstractFoo = 2;

View file

@ -9,14 +9,14 @@
import 'sealed_mixin_with_lib.dart';
abstract class OutsideA with SealedMixin {}
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed mixin 'SealedMixin' can't be mixed in outside of its library.
class OutsideB with SealedMixin {
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed mixin 'SealedMixin' can't be mixed in outside of its library.
@override
int foo = 2;
@ -25,6 +25,6 @@ class OutsideB with SealedMixin {
}
abstract class OutsideC = Object with SealedMixin;
// ^
// ^
// [analyzer] unspecified
// [cfe] unspecified
// [cfe] Sealed mixin 'SealedMixin' can't be mixed in outside of its library.