From 86b43c8789170ec02ab2960395d882477c977419 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Tue, 10 Jan 2023 13:44:18 +0200 Subject: [PATCH 1/5] Fixes #1702. wildcards_A01_t01.dart. Use correct types in list pattern --- LanguageFeatures/Patterns/wildcards_A01_t01.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LanguageFeatures/Patterns/wildcards_A01_t01.dart b/LanguageFeatures/Patterns/wildcards_A01_t01.dart index ada980f515..7434afab73 100644 --- a/LanguageFeatures/Patterns/wildcards_A01_t01.dart +++ b/LanguageFeatures/Patterns/wildcards_A01_t01.dart @@ -61,16 +61,16 @@ main() { Expect.equals(2, _two); Expect.equals(4, __); - var list2 = ["1", 2, "3", 4]; - var [String _, two, _, num ___] = list2; + var list2 = [1, 2, 3.14, 4]; + var [int _, two, _, num ___] = list2; Expect.equals(2, two); Expect.equals(4, ___); Expect.throws(() { - var [int _, _, _, num _] = list2; + var [int _, _, int _, num _] = list2; }); Expect.throws(() { - var [_, String _, _, num _] = list2; + var [_, num _, _, num _] = list2; }); Expect.equals("[_, 2, var x]", test1([1, 2, "3"])); Expect.equals("[String _, _, _]", test1(["0", 1, 2])); From df9b1b34d092fbf81cb9f7abaa843bbf264b1971 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Wed, 11 Jan 2023 10:26:31 +0200 Subject: [PATCH 2/5] Remove excessive check --- LanguageFeatures/Patterns/wildcards_A01_t01.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/LanguageFeatures/Patterns/wildcards_A01_t01.dart b/LanguageFeatures/Patterns/wildcards_A01_t01.dart index 7434afab73..b895834966 100644 --- a/LanguageFeatures/Patterns/wildcards_A01_t01.dart +++ b/LanguageFeatures/Patterns/wildcards_A01_t01.dart @@ -69,9 +69,6 @@ main() { Expect.throws(() { var [int _, _, int _, num _] = list2; }); - Expect.throws(() { - var [_, num _, _, num _] = list2; - }); Expect.equals("[_, 2, var x]", test1([1, 2, "3"])); Expect.equals("[String _, _, _]", test1(["0", 1, 2])); Expect.equals("default", test1([1, 1, 3])); From c57634956d86d8059a8ceeadfc28fc04d01b2501 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Thu, 12 Jan 2023 10:47:52 +0200 Subject: [PATCH 3/5] Fix wildcards_A01_t01.dart according to review notes --- LanguageFeatures/Patterns/wildcards_A01_t01.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LanguageFeatures/Patterns/wildcards_A01_t01.dart b/LanguageFeatures/Patterns/wildcards_A01_t01.dart index b895834966..85f312fe67 100644 --- a/LanguageFeatures/Patterns/wildcards_A01_t01.dart +++ b/LanguageFeatures/Patterns/wildcards_A01_t01.dart @@ -62,7 +62,7 @@ main() { Expect.equals(4, __); var list2 = [1, 2, 3.14, 4]; - var [int _, two, _, num ___] = list2; + var [int _, two, _, int ___] = list2; Expect.equals(2, two); Expect.equals(4, ___); From 55c86df5c9aea7c9ba8fb7886dd23e73ecb2ab55 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Thu, 12 Jan 2023 10:54:10 +0200 Subject: [PATCH 4/5] Fix wildcards_A01_t01.dart according to review notes. Part 2 --- LanguageFeatures/Patterns/wildcards_A01_t01.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/LanguageFeatures/Patterns/wildcards_A01_t01.dart b/LanguageFeatures/Patterns/wildcards_A01_t01.dart index 85f312fe67..fabeebcd93 100644 --- a/LanguageFeatures/Patterns/wildcards_A01_t01.dart +++ b/LanguageFeatures/Patterns/wildcards_A01_t01.dart @@ -62,13 +62,10 @@ main() { Expect.equals(4, __); var list2 = [1, 2, 3.14, 4]; - var [int _, two, _, int ___] = list2; + var [num _, two, _, num ___] = list2; Expect.equals(2, two); Expect.equals(4, ___); - Expect.throws(() { - var [int _, _, int _, num _] = list2; - }); Expect.equals("[_, 2, var x]", test1([1, 2, "3"])); Expect.equals("[String _, _, _]", test1(["0", 1, 2])); Expect.equals("default", test1([1, 1, 3])); From d258b73760d955ef05fe4caf800743bf19ec090e Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Thu, 12 Jan 2023 11:02:22 +0200 Subject: [PATCH 5/5] Fix wildcards_A01_t01.dart according to review notes. Part 3 --- LanguageFeatures/Patterns/wildcards_A01_t01.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/LanguageFeatures/Patterns/wildcards_A01_t01.dart b/LanguageFeatures/Patterns/wildcards_A01_t01.dart index fabeebcd93..d1f454abca 100644 --- a/LanguageFeatures/Patterns/wildcards_A01_t01.dart +++ b/LanguageFeatures/Patterns/wildcards_A01_t01.dart @@ -61,10 +61,14 @@ main() { Expect.equals(2, _two); Expect.equals(4, __); + var [int _, _, num three, num ___] = list1; + Expect.equals(3, three); + Expect.equals(4, ___); + var list2 = [1, 2, 3.14, 4]; - var [num _, two, _, num ___] = list2; + var [num _, two, _, num __x_] = list2; Expect.equals(2, two); - Expect.equals(4, ___); + Expect.equals(4, __x_); Expect.equals("[_, 2, var x]", test1([1, 2, "3"])); Expect.equals("[String _, _, _]", test1(["0", 1, 2]));