[gardening] Fix vm/cc/IsolateReload_{TypedefToNotTypeDef,NotTypedefToTypeDef} tests

With introduction to Dart 2.0 and Kernel as intermediate format, the VM
consumes kernel. The kernel is produced by CFE which lowers named
function type definitions to function types.

We therefore no longer have name classes between typedefs and classes
and the corresponding vm/cc/IsolateReload_* can be updated to no longer
expect an error.

Issue https://github.com/dart-lang/sdk/issues/50521
Issue https://github.com/dart-lang/sdk/issues/32190

TEST=Fixes vm/cc/IsolateReload_*Typedef* tests

Change-Id: Ic0697c5de03ef28e6cca104f5fbcb214e99d3fd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284182
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
Martin Kustermann 2023-02-20 13:54:29 +00:00 committed by Commit Queue
parent b74f4e1818
commit 15ecb9b39f
3 changed files with 8 additions and 7 deletions

View file

@ -258,7 +258,6 @@ cc/IsolateReload_LiveStack: Fail
cc/IsolateReload_MainLibModified: Crash
cc/IsolateReload_NoLibsModified: Crash
cc/IsolateReload_NotEnumToEnum: Skip
cc/IsolateReload_NotTypedefToTypedef: Fail
cc/IsolateReload_PendingSuperCall: Fail
cc/IsolateReload_PrefixImportedLibModified: Crash
cc/IsolateReload_RunNewFieldInitializersSuperClass: Skip
@ -280,7 +279,6 @@ cc/IsolateReload_TopLevelParseError: Fail
cc/IsolateReload_TypeIdentity: Fail
cc/IsolateReload_TypeIdentityGeneric: Fail
cc/IsolateReload_TypeIdentityParameter: Fail
cc/IsolateReload_TypedefToNotTypedef: Fail
cc/Parser_AllocateVariables_CaptureLoopVar: Fail
cc/Parser_AllocateVariables_CapturedVar: Fail
cc/Parser_AllocateVariables_Issue7681: Fail

View file

@ -269,8 +269,6 @@ cc/DebuggerAPI_ScriptGetTokenInfo_MultiLineInterpolation: Fail
cc/Debugger_PrintBreakpointsToJSONArray: Fail
cc/Debugger_Rewind_Optimized: SkipSlow
cc/Debugger_SetBreakpointInPartOfLibrary: Crash
cc/IsolateReload_NotTypedefToTypedef: Fail
cc/IsolateReload_TypedefToNotTypedef: Fail
dart/spawn_shutdown_test: SkipSlow
dart_2/spawn_shutdown_test: SkipSlow

View file

@ -4631,6 +4631,9 @@ TEST_CASE(IsolateReload_ExistingStaticFieldChangesTypeIndirectFunction) {
}
TEST_CASE(IsolateReload_TypedefToNotTypedef) {
// The CFE lowers typedefs to function types and as such the VM will not see
// any name collision between a class and a typedef class (which doesn't exist
// anymore).
const char* kScript =
"typedef bool Predicate(dynamic x);\n"
"main() {\n"
@ -4650,8 +4653,7 @@ TEST_CASE(IsolateReload_TypedefToNotTypedef) {
"}\n";
Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
EXPECT_ERROR(result,
"Typedef class cannot be redefined to be a non-typedef class");
EXPECT_VALID(result);
}
TEST_CASE(IsolateReload_NotTypedefToTypedef) {
@ -4667,6 +4669,9 @@ TEST_CASE(IsolateReload_NotTypedefToTypedef) {
EXPECT_VALID(lib);
EXPECT_STREQ("false", SimpleInvokeStr(lib, "main"));
// The CFE lowers typedefs to function types and as such the VM will not see
// any name collision between a class and a typedef class (which doesn't exist
// anymore).
const char* kReloadScript =
"typedef bool Predicate(dynamic x);\n"
"main() {\n"
@ -4674,7 +4679,7 @@ TEST_CASE(IsolateReload_NotTypedefToTypedef) {
"}\n";
Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
EXPECT_ERROR(result, "Class cannot be redefined to be a typedef class");
EXPECT_VALID(result);
}
TEST_CASE(IsolateReload_TypedefAddParameter) {