You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a18214f I've added 2 tests regarding structural pattern matching, based on issues encountered in #12120.
They are following:
group_builder.specify "structural pattern matching should be able to match the primary type" <|
ab = make_a_and_b
r = case ab of
A.A_Ctor x -> "matched: "+x.to_text
_ -> "structural matching of A.A_Ctor failed"
r.should_equal "matched: 1"
group_builder.specify "should structural matching match other types?" <|
ab = make_a_and_b
r = case ab of
B.B_Ctor x -> "matched: "+x.to_text
_ -> "structural matching of B.B_Ctor failed"
r.should_equal "matched: (A_Ctor 1)"
In my opinion the first test should surely pass - if the value is A with some extra B intersections, it should not only match _:A but also the 'structural' matching.
As for the second test - I don't have a strong opinion, although I think that if a type is both A & B then it should probably match the B part structurally too (of course as long as the constructor also matches, if B type had more than 1 constructor).
The text was updated successfully, but these errors were encountered:
- [FAILED] structural pattern matching should be able to match the primary type [42ms]
Reason: 'structural matching of A.A_Ctor failed' did not equal 'matched: 1' (at Base_Tests\src\Semantic\Multi_Value_As_Type_Refinement_Spec.enso:175:13-39).
- [FAILED] should structural matching match other types? [7ms]
Reason: 'structural matching of B.B_Ctor failed' did not equal 'matched: (A_Ctor 1)' (at Base_Tests\src\Semantic\Multi_Value_As_Type_Refinement_Spec.enso:182:13-48).
In a18214f I've added 2 tests regarding structural pattern matching, based on issues encountered in #12120.
They are following:
In my opinion the first test should surely pass - if the value is
A
with some extraB
intersections, it should not only match_:A
but also the 'structural' matching.As for the second test - I don't have a strong opinion, although I think that if a type is both
A & B
then it should probably match theB
part structurally too (of course as long as the constructor also matches, ifB
type had more than 1 constructor).The text was updated successfully, but these errors were encountered: