Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1874. Update LanguageFeatures/nnbd/weak/overriding tests to work with class modifiers #1960

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@

/// @author [email protected]

// TODO(https://github.com/dart-lang/sdk/issues/51557): Decide if the mixins
// being applied in this test should be "mixin", "mixin class" or the test
// should be left at 2.19.
// @dart=2.19
// SharedOptions=--enable-experiment=class-modifiers

library override_opted_in_lib;

import "dart:async";
import "../../../../Utils/expect.dart";

class OPTED_NULLABLE_ARGS {
mixin class OPTED_NULLABLE_ARGS {
void test_int (int? i ) { Expect.fail("This method should be overriden"); }
void test_object (Object? o ) { Expect.fail("This method should be overriden"); }
void test_dynamic (dynamic i ) { Expect.fail("This method should be overriden"); }
Expand All @@ -23,23 +20,23 @@ class OPTED_NULLABLE_ARGS {
void test_futureOr(FutureOr i ) { Expect.fail("This method should be overriden"); }
}

class OPTED_NONNULLABLE_ARGS {
mixin class OPTED_NONNULLABLE_ARGS {
void test_int (int i ) { Expect.fail("This method should be overriden"); }
void test_object (Object o ) { Expect.fail("This method should be overriden"); }
void test_function(Function f ) { Expect.fail("This method should be overriden"); }
void test_futureOr(FutureOr<int> i) { Expect.fail("This method should be overriden"); }
}

class OPTED_NEVER_ARGS {
mixin class OPTED_NEVER_ARGS {
void test_never(Never n) { Expect.fail("This method should be overriden"); }
}

class OPTED_REQUIRED_ARGS {
mixin class OPTED_REQUIRED_ARGS {
void test_required_nonnullable({required int i}) { Expect.fail("This method should be overriden"); }
void test_required_nullable ({required int? i}) { Expect.fail("This method should be overriden"); }
}

class OPTED_NULLABLE_FIELD {
mixin class OPTED_NULLABLE_FIELD {
int? i;
Object? o;
dynamic d;
Expand All @@ -51,18 +48,18 @@ class OPTED_NULLABLE_FIELD {

void testme() {}

class OPTED_NONNULLABLE_FIELD {
mixin class OPTED_NONNULLABLE_FIELD {
int i = 0;
Object o = 0;
Function f = testme;
FutureOr<int> fi = 0;
}

class OPTED_NEVER_FIELD {
mixin class OPTED_NEVER_FIELD {
Never n = throw "Cannot reach here";
}

class OPTED_NULLABLE_GETTER {
mixin class OPTED_NULLABLE_GETTER {
int? get getInt => throw("This method should be overriden");
Object? get getObject => throw("This method should be overriden");
dynamic get getDynamic => throw("This method should be overriden");
Expand All @@ -71,18 +68,18 @@ class OPTED_NULLABLE_GETTER {
FutureOr get getFutureOr => throw("This method should be overriden");
}

class OPTED_NONNULLABLE_GETTER {
mixin class OPTED_NONNULLABLE_GETTER {
int get getInt => throw("This method should be overriden");
Object get getObject => throw("This method should be overriden");
Function get getFunction => throw("This method should be overriden");
FutureOr<int> get getFutureOrInt => throw("This method should be overriden");
}

class OPTED_NEVER_GETTER {
mixin class OPTED_NEVER_GETTER {
Never get getNever => throw("This method should be overriden");
}

class OPTED_NULLABLE_SETTER {
mixin class OPTED_NULLABLE_SETTER {
void set setInt (int? i) { Expect.fail("This method should be overriden"); }
void set setObject (Object? o) { Expect.fail("This method should be overriden"); }
void set setDynamic (dynamic d) { Expect.fail("This method should be overriden"); }
Expand All @@ -91,18 +88,18 @@ class OPTED_NULLABLE_SETTER {
void set setFutureOr(FutureOr f) { Expect.fail("This method should be overriden"); }
}

class OPTED_NONNULLABLE_SETTER {
mixin class OPTED_NONNULLABLE_SETTER {
void set setInt (int i ) { Expect.fail("This method should be overriden"); }
void set setObject (Object o ) { Expect.fail("This method should be overriden"); }
void set setFunction (Function f ) { Expect.fail("This method should be overriden"); }
void set setFutureOrInt(FutureOr<int> i) { Expect.fail("This method should be overriden"); }
}

class OPTED_NEVER_SETTER {
mixin class OPTED_NEVER_SETTER {
void set setNever(Never n) { Expect.fail("This method should be overriden"); }
}

class OPTED_NULLABLE_RETURN {
mixin class OPTED_NULLABLE_RETURN {
int? getInt() => throw("This method should be overriden");
Object? getObject() => throw("This method should be overriden");
dynamic getDynamic() => throw("This method should be overriden");
Expand All @@ -111,26 +108,26 @@ class OPTED_NULLABLE_RETURN {
FutureOr getFutureOr() => throw("This method should be overriden");
}

class OPTED_NONNULLABLE_RETURN {
mixin class OPTED_NONNULLABLE_RETURN {
int getInt() => throw("This method should be overriden");
Object getObject() => throw("This method should be overriden");
Function getFunction() => throw("This method should be overriden");
FutureOr<int> getFutureOrInt() => throw("This method should be overriden");
}

class OPTED_NEVER_RETURN {
mixin class OPTED_NEVER_RETURN {
Never getNever() => throw("This method should be overriden");
}

class OPTED_NONNULLABLE_INT <T extends int > {}
class OPTED_NONNULLABLE_OBJECT <T extends Object > {}
class OPTED_NONNULLABLE_FUNCTION<T extends Function> {}
mixin class OPTED_NONNULLABLE_INT <T extends int > {}
mixin class OPTED_NONNULLABLE_OBJECT <T extends Object > {}
mixin class OPTED_NONNULLABLE_FUNCTION<T extends Function> {}

class OPTED_NULLABLE <T> {}
class OPTED_DYNAMIC <T extends dynamic> {}
class OPTED_NULLABLE_INT <T extends int?> {}
class OPTED_NULLABLE_OBJECT <T extends Object?> {}
class OPTED_NULLABLE_FUNCTION<T extends Function?> {}
class OPTED_NULL <T extends Null> {}
mixin class OPTED_NULLABLE <T> {}
mixin class OPTED_DYNAMIC <T extends dynamic> {}
mixin class OPTED_NULLABLE_INT <T extends int?> {}
mixin class OPTED_NULLABLE_OBJECT <T extends Object?> {}
mixin class OPTED_NULLABLE_FUNCTION<T extends Function?> {}
mixin class OPTED_NULL <T extends Null> {}

class OPTED_NEVER<T extends Never> {}
mixin class OPTED_NEVER<T extends Never> {}