Skip to content

Mismatch between semantics of compiled and interpreted patterns #422

@LPTK

Description

@LPTK

Based on #421, but the issue already existed before:

pattern XorPairT = Pair(None, Some(_ => 111)) | Pair(Some(_), None)

fun xorPairT(x) = if x is (@compile XorPairT) as output then output else "failed"

xorPairT of Pair(None, None)
//│ = "failed"

// * FIXME: this should match the result of the intepreted pattern
xorPairT of Pair(None, Some(1))
//│ = {first: None, second: {value: 111}}

// * FIXME: this should match the result of the intepreted pattern
xorPairT of Pair(Some(56), None)
//│ = {first: {value: 56}, second: None}

fun xorPairTInterp(x) = if x is XorPairT as output then output else "failed"

xorPairTInterp of Pair(None, None)
//│ = "failed"

xorPairTInterp of Pair(None, Some(1))
//│ = Pair(None, Some(1))

xorPairTInterp of Pair(Some(56), None)
//│ = Pair(Some(56), None)

Generally, I think a user should never be exposed the our internal extraction records, no?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions