From a3a263cae50fa67aa973d75bc9fae1b59bc2bb4c Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Thu, 12 Dec 2024 23:39:29 -0500 Subject: [PATCH 1/5] Update pattern test to account for new DDC JS variable naming A bug recently uncovered in DDC required renaming some variables (primarily around patterns) to avoid declarations from shadowing each other incorrectly. 'a' is now 'a$' as it is the second case that declares a Dart variable named 'a'. --- dwds/test/instances/common/patterns_inspection_common.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dwds/test/instances/common/patterns_inspection_common.dart b/dwds/test/instances/common/patterns_inspection_common.dart index 935ab91d8..cb7ff100c 100644 --- a/dwds/test/instances/common/patterns_inspection_common.dart +++ b/dwds/test/instances/common/patterns_inspection_common.dart @@ -98,8 +98,9 @@ void runTests({ expect(await getFrameVariables(frame), { 'obj': matchListInstance(type: 'Object'), - 'a': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), - 'n': matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), + // Renamed to avoid shadowing variables from previous case. + 'a\$': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), + 'n\$': matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), }); }); }); From 3212357430e9d84eeda1e428ac8f6b54fac3dfd5 Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Thu, 12 Dec 2024 23:48:07 -0500 Subject: [PATCH 2/5] Dart format --- dwds/test/instances/common/patterns_inspection_common.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dwds/test/instances/common/patterns_inspection_common.dart b/dwds/test/instances/common/patterns_inspection_common.dart index cb7ff100c..d146588fa 100644 --- a/dwds/test/instances/common/patterns_inspection_common.dart +++ b/dwds/test/instances/common/patterns_inspection_common.dart @@ -100,7 +100,8 @@ void runTests({ 'obj': matchListInstance(type: 'Object'), // Renamed to avoid shadowing variables from previous case. 'a\$': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), - 'n\$': matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), + 'n\$': + matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), }); }); }); From 4d8acf069d372d03bc1bdb94ecc7739c8f881b6f Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Thu, 12 Dec 2024 23:51:50 -0500 Subject: [PATCH 3/5] Dart format 2 --- dwds/test/instances/common/patterns_inspection_common.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwds/test/instances/common/patterns_inspection_common.dart b/dwds/test/instances/common/patterns_inspection_common.dart index d146588fa..d2bf17ec2 100644 --- a/dwds/test/instances/common/patterns_inspection_common.dart +++ b/dwds/test/instances/common/patterns_inspection_common.dart @@ -100,7 +100,7 @@ void runTests({ 'obj': matchListInstance(type: 'Object'), // Renamed to avoid shadowing variables from previous case. 'a\$': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), - 'n\$': + 'n\$': matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), }); }); From 2849c653403d8c885c3305dd48f3b9e93fbab059 Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Fri, 13 Dec 2024 16:07:03 -0500 Subject: [PATCH 4/5] Add version guard around condition. --- .../common/patterns_inspection_common.dart | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/dwds/test/instances/common/patterns_inspection_common.dart b/dwds/test/instances/common/patterns_inspection_common.dart index d2bf17ec2..85fdb72b7 100644 --- a/dwds/test/instances/common/patterns_inspection_common.dart +++ b/dwds/test/instances/common/patterns_inspection_common.dart @@ -5,6 +5,7 @@ import 'package:test/test.dart'; import 'package:test_common/logging.dart'; import 'package:test_common/test_sdk_configuration.dart'; +import 'package:test_common/utilities.dart'; import 'package:vm_service/vm_service.dart'; import '../../fixtures/context.dart'; @@ -96,13 +97,25 @@ void runTests({ await onBreakPoint('testPatternCase2', (event) async { final frame = event.topFrame!; - expect(await getFrameVariables(frame), { - 'obj': matchListInstance(type: 'Object'), - // Renamed to avoid shadowing variables from previous case. - 'a\$': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), - 'n\$': - matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), - }); + if (dartSdkIsAtLeast('3.7.0-246.0.dev')) { + expect(await getFrameVariables(frame), { + 'obj': matchListInstance(type: 'Object'), + // Renamed to avoid shadowing variables from previous case. + 'a\$': + matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), + 'n\$': + matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), + }); + } else { + expect(await getFrameVariables(frame), { + 'obj': matchListInstance(type: 'Object'), + // Renamed to avoid shadowing variables from previous case. + 'a': + matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), + 'n': + matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), + }); + } }); }); From e266157dfc96969c923fc1d3350c471fc17af46d Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Fri, 13 Dec 2024 16:20:06 -0500 Subject: [PATCH 5/5] Dart format --- dwds/test/instances/common/patterns_inspection_common.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dwds/test/instances/common/patterns_inspection_common.dart b/dwds/test/instances/common/patterns_inspection_common.dart index 85fdb72b7..5b1d68d6c 100644 --- a/dwds/test/instances/common/patterns_inspection_common.dart +++ b/dwds/test/instances/common/patterns_inspection_common.dart @@ -110,8 +110,7 @@ void runTests({ expect(await getFrameVariables(frame), { 'obj': matchListInstance(type: 'Object'), // Renamed to avoid shadowing variables from previous case. - 'a': - matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), + 'a': matchPrimitiveInstance(kind: InstanceKind.kString, value: 'b'), 'n': matchPrimitiveInstance(kind: InstanceKind.kDouble, value: 3.14), });