[cfe] Add test for unused cyclic redirecting factories

Closes #46334

Change-Id: Iaec6a958e1850aacec21617be76062c200360f21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211261
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Johnni Winther 2021-08-26 13:49:28 +00:00 committed by commit-bot@chromium.org
parent 3be0f377a5
commit 7959f037bd
6 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,9 @@
// Copyright (c) 2021, 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 C {
factory C() = C;
}
main() {}

View file

@ -0,0 +1,5 @@
class C {
factory C() = C;
}
main() {}

View file

@ -0,0 +1,5 @@
class C {
factory C() = C;
}
main() {}

View file

@ -0,0 +1,19 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/issue46334.dart:6:11: Error: Cyclic definition of factory 'C'.
// factory C() = C;
// ^
//
import self as self;
import "dart:core" as core;
class C extends core::Object {
static final field dynamic _redirecting# = <dynamic>[self::C::•]/*isLegacy*/;
static factory •() → self::C
return invalid-expression "pkg/front_end/testcases/general/issue46334.dart:6:11: Error: Cyclic definition of factory 'C'.
factory C() = C;
^";
}
static method main() → dynamic {}

View file

@ -0,0 +1,20 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/issue46334.dart:6:11: Error: Cyclic definition of factory 'C'.
// factory C() = C;
// ^
//
import self as self;
import "dart:core" as core;
class C extends core::Object {
static final field dynamic _redirecting# = <dynamic>[self::C::•]/*isLegacy*/;
static factory •() → self::C
return invalid-expression "pkg/front_end/testcases/general/issue46334.dart:6:11: Error: Cyclic definition of factory 'C'.
factory C() = C;
^";
}
static method main() → dynamic
;

View file

@ -0,0 +1,19 @@
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/issue46334.dart:6:11: Error: Cyclic definition of factory 'C'.
// factory C() = C;
// ^
//
import self as self;
import "dart:core" as core;
class C extends core::Object {
static final field dynamic _redirecting# = <dynamic>[self::C::•]/*isLegacy*/;
static factory •() → self::C
return invalid-expression "pkg/front_end/testcases/general/issue46334.dart:6:11: Error: Cyclic definition of factory 'C'.
factory C() = C;
^";
}
static method main() → dynamic {}