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

Add match case or_pattern #847

Draft
wants to merge 1 commit into
base: sail2
Choose a base branch
from
Draft

Conversation

trdthg
Copy link
Contributor

@trdthg trdthg commented Dec 26, 2024

try resolve #691, Currently, this is a minimal runnable example, and there are several points that may need attention

  • Added a new variant Pat_many
  • The desuger occurs during the initial_check process, so there will be no Pat_many appearances after desuger
    • But you have to add an error wherever Pat_many appears, Just like DEF_scattered. Is there a way to avoid this or eliminate the Pat_many variants?
  • Set P_id to p#i, where i is the index of the origin pats in pat_list

-ddump-tc-ast 参考:

function main() : unit -> unit = {
    match 1 {
        1 => (),
        2, 3 => (),
    }
}

$[complete]
function main () : unit = {
    $[complete] match 1 {
      ($[int_wildcard 1] _) => (),
      p#1 if $[complete] match p#1 {
        2 => true,
        3 => true,
        _ => false
      } => ()
    }
}

Copy link

Test Results

   12 files  ±0     24 suites  ±0   0s ⏱️ ±0s
  738 tests ±0    738 ✅ ±0  0 💤 ±0  0 ❌ ±0 
2 466 runs  ±0  2 465 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit c3dd825. ± Comparison against base commit fd18b93.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support "or" patterns - multiple patterns for one match branch
1 participant