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

Pattern matching a EnsoMultiValue ignores 2nd & co. types #11828

Closed
JaroslavTulach opened this issue Dec 11, 2024 · 2 comments · Fixed by #11850
Closed

Pattern matching a EnsoMultiValue ignores 2nd & co. types #11828

JaroslavTulach opened this issue Dec 11, 2024 · 2 comments · Fixed by #11850
Assignees

Comments

@JaroslavTulach
Copy link
Member

Pattern matching on type on first value of a EnsoMultiValue works, but we want to match on other values as well:

diff --git test/Base_Tests/src/Semantic/Multi_Value_Convert_Spec.enso test/Base_Tests/src/Semantic/Multi_Value_Convert_Spec.enso
index ca768daaa0..2e54642532 100644
--- test/Base_Tests/src/Semantic/Multi_Value_Convert_Spec.enso
+++ test/Base_Tests/src/Semantic/Multi_Value_Convert_Spec.enso
@@ -84,6 +84,41 @@ add_specs suite_builder =
                 _ -> "what?"
             c1 . should_equal "c"
 
+        group_builder.specify "case of second" <|
+            abc = 3.14 : A&B&C
+            c1 = case abc of
+                b:B -> b.b
+                a:A -> a.a
+                c:C -> c.c
+                _ -> "what?"
+            c1 . should_equal "b"
+
+        group_builder.specify "case of third" <|
+            abc = 3.14 : A&B&C
+            c1 = case abc of
+                c:C -> c.c
+                b:B -> b.b
+                a:A -> a.a
+                _ -> "what?"
+            c1 . should_equal "c"
+
+        group_builder.specify "case of second from extra types" <|
+            abc = 3.14 : A&B&C
+            c1 = case abc:A of
+                b:B -> b.b
+                a:A -> a.a
+                c:C -> c.c
+                _ -> "what?"
+            c1 . should_equal "b"
+
+        group_builder.specify "case of third  from extra types" <|
+            abc = 3.14 : A&B&C
+            c1 = case abc:A of
+                c:C -> c.c
+                b:B -> b.b
+                a:A -> a.a
+                _ -> "what?"
+            c1 . should_equal "c"
 
 main filter=Nothing =
     suite = Test.build suite_builder->

Originally posted by @JaroslavTulach in #11600 (comment)

@JaroslavTulach JaroslavTulach self-assigned this Dec 12, 2024
@JaroslavTulach JaroslavTulach moved this from ❓New to ⚙️ Design in Issues Board Dec 12, 2024
@JaroslavTulach JaroslavTulach moved this from ⚙️ Design to 👁️ Code review in Issues Board Dec 13, 2024
@github-project-automation github-project-automation bot moved this from 👁️ Code review to 🟢 Accepted in Issues Board Dec 13, 2024
@enso-bot
Copy link

enso-bot bot commented Dec 14, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-12-13):

Progress: - case of fixes: #11850

@enso-bot
Copy link

enso-bot bot commented Dec 16, 2024

Jaroslav Tulach reports a new STANDUP for the last Saturday (2024-12-14):

Progress: - updating if_then_else

  • analyzing duplicates in IR: 41162aa It should be finished by 2024-12-14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🟢 Accepted
Development

Successfully merging a pull request may close this issue.

1 participant